/** * Creates a partial code for class method. * ` @param Stagehand_PHP_Class_Method $method * @return string */ protected function _createMethodCode($method) { if ($method->isFinal()) { return; } return $method->renderInterface(); }
/** * @test */ public function renderInterface() { $name = 'getFoo'; $method = new Stagehand_PHP_Class_Method($name); $method->setCode('$a = 0; return 1;'); $this->assertEquals($method->renderInterface(), <<<EOF public function getFoo(); EOF ); $foo = new Stagehand_PHP_Class_Method_Argument('foo'); $bar = new Stagehand_PHP_Class_Method_Argument('bar'); $bar->setRequirement(false); $bar->setValue(10); $method->addArgument($foo); $method->addArgument($bar); $this->assertEquals($method->renderInterface(), <<<EOF public function getFoo(\$foo, \$bar = 10); EOF ); $method->defineProtected(); $this->assertNull($method->renderInterface()); $method->definePrivate(); $this->assertNull($method->renderInterface()); }