public function testAnnotationClassMethodBlockToString() { $file = new PhpFile('foo'); $file->addChild(new PhpAnnotationBlock(array('date is the key', 'time is the core key'))); $class = new PhpClass('Foo'); $class->addChild(new PhpMethod('Bar')); $file->addChild($class); $this->assertSame("<?php\n/**\n * date is the key\n * time is the core key\n */\nclass Foo\n{\n public function Bar()\n {\n }\n}\n", $file->toString()); }
public function testSimpleClassPublicMethodToString() { $class = new PhpClass('Foo'); $method = new PhpMethod('bar', array('bar', 'foo', 'sample'), PhpMethod::ACCESS_PRIVATE); $method->addChild(new PhpVariable('foo', 1)); $class->addChild($method); $this->assertSame("class Foo\n{\n private function bar(\$bar, \$foo, \$sample)\n {\n \$foo = 1;\n }\n}", $class->toString()); }
/** * @param PhpAnnotationBlockElement $annotationBlock * @return AbstractComponent */ public function addAnnotationBlockElement(PhpAnnotationBlockElement $annotationBlock) { $this->mainElement->addChild($annotationBlock); return $this; }