This is cli for generating php code setter and getter.
First Install GO to your environment
$ git clone git@github.com:Gujarats/php-generator.git
$ cd php-generator
$ go build
$ go install
For example we have file called TestClass.php to generate getter and setter simply follow this :
class TestClass{
private $myVar;
private $newVaria;
private $newVar;
private $TestVar;
}
Use this commadn to generate the code :
$ php-generator generator TestClass.php
And the result :
class TestClass{
private $myVar;
private $newVaria;
private $newVar;
private $TestVar;
public function __construct($myVar,$newVaria,$newVar,$TestVar){
$this->myVar=$myVar;
$this->newVaria=$newVaria;
$this->newVar=$newVar;
$this->TestVar=$TestVar;
}
public function getMyVar(){
return $this->myVar;
}
public function setMyVar($myVar){
$this->myVar=$myVar;
}
public function getNewVaria(){
return $this->newVaria;
}
public function setNewVaria($newVaria){
$this->newVaria=$newVaria;
}
public function getNewVar(){
return $this->newVar;
}
public function setNewVar($newVar){
$this->newVar=$newVar;
}
public function getTestVar(){
return $this->TestVar;
}
public function setTestVar($TestVar){
$this->TestVar=$TestVar;
}
}