/** * Create all getters and setters from Property Collection. * @return void */ public function generateGettersAndSettersFromProperties() { $propertyIterator = $this->getPropertyCollection()->getIterator(); foreach ($propertyIterator as $property) { $this->getMethodCollection()->add(Method::createGetterFromProperty($property)); $this->getMethodCollection()->add(Method::createSetterFromProperty($property)); } }
public function testFinalMethodToString() { $method = new Method(); $method->setName('test')->setVisibility(Visibility::TYPE_PUBLIC)->setCode('$test = 0;')->setIsFinal()->addArgument(new Argument(array('name' => 'arg')))->setDescription('test description'); $expected = PHP_EOL . ' /**' . PHP_EOL . ' * test description' . PHP_EOL . ' * @param mixed $arg' . PHP_EOL . ' */' . PHP_EOL . ' final public function test($arg)' . PHP_EOL . ' {' . PHP_EOL . ' $test = 0;' . PHP_EOL . ' }' . PHP_EOL; $this->assertEquals($expected, $method->toString()); }