/**
     * @return ClassMethod
     */
    protected function generateAdd()
    {
        $setter = new ClassMethod('add' . ucfirst($this->classProperty->getName()));
        $setter->setDescription('Add item to ' . $this->classProperty->getName());
        $setterParam = new MethodParameter($this->classProperty->getName(), 'mixed');
        $setter->addParameter($setterParam);
        $body = <<<BODY
\t\$this->{$this->classProperty->getName()} = \${$this->classProperty->getName()};
BODY;
        $setter->setBody($body);
        return $setter;
    }
예제 #2
0
 protected function generateImplementMethods()
 {
     $output = '';
     foreach ($this->baseClass->getImplements() as $implement) {
         $reflection = new \ReflectionClass($implement);
         foreach ($reflection->getMethods() as $method) {
             $implementor = new ClassMethod($method->name, $method);
             $implementor->setDescription('Implementation of ' . $method->getName() . ' interface method');
             $implementor->setBody(' // TODO: Code implementation');
             $output .= PHP_EOL . $implementor->generate() . PHP_EOL;
         }
     }
     return $output;
 }