factory() публичный статический Метод

Static method to instantiate the method generator object and return itself to facilitate chaining methods together.
public static factory ( string $name, string $visibility = 'public', boolean $static = false ) : MethodGenerator
$name string
$visibility string
$static boolean
Результат MethodGenerator
Пример #1
0
 public function testRender()
 {
     $m = MethodGenerator::factory('testMethod');
     $m->setBody('some body code', true);
     $m->appendToBody('some more body code');
     $m->appendToBody('even more body code', false);
     $m->addArgument('testVar', 123, 'int');
     $m->addParameter('oneMoreTestVar', 789, 'int');
     $codeStr = (string) $m;
     $code = $m->render(true);
     ob_start();
     $m->render();
     $output = ob_get_clean();
     $this->assertContains('function testMethod($testVar = 123, $oneMoreTestVar = 789)', $output);
     $this->assertContains('function testMethod($testVar = 123, $oneMoreTestVar = 789)', $code);
     $this->assertContains('function testMethod($testVar = 123, $oneMoreTestVar = 789)', $codeStr);
 }