Zend\Code\Generator\MethodGenerator::__construct PHP Method

__construct() public method

public __construct ( string $name = null, array $parameters = [], integer $flags = self::FLAG_PUBLIC, string $body = null, Zend\Code\Generator\DocBlockGenerator | string $docBlock = null )
$name string
$parameters array
$flags integer
$body string
$docBlock Zend\Code\Generator\DocBlockGenerator | string
    public function __construct($name = null, array $parameters = [], $flags = self::FLAG_PUBLIC, $body = null, $docBlock = null)
    {
        if ($name) {
            $this->setName($name);
        }
        if ($parameters) {
            $this->setParameters($parameters);
        }
        if ($flags !== self::FLAG_PUBLIC) {
            $this->setFlags($flags);
        }
        if ($body) {
            $this->setBody($body);
        }
        if ($docBlock) {
            $this->setDocBlock($docBlock);
        }
    }

Usage Example

Example #1
0
 /**
  * @param \rg\injektor\generators\FactoryGenerator $factoryGenerator
  */
 public function __construct(FactoryGenerator $factoryGenerator)
 {
     parent::__construct('getInstance');
     $this->factoryGenerator = $factoryGenerator;
     $parameter = new \Zend\Code\Generator\ParameterGenerator('parameters', 'array', array());
     $this->setParameter($parameter);
 }
All Usage Examples Of Zend\Code\Generator\MethodGenerator::__construct