factory() public static méthode

Static method to instantiate the property generator object and return itself to facilitate chaining methods together.
public static factory ( string $namespace ) : NamespaceGenerator
$namespace string
Résultat NamespaceGenerator
Exemple #1
0
 public function testSetUsesAndRender()
 {
     $n = NamespaceGenerator::factory('TestNamespace');
     $n->setUse('Test\\Space\\One', 'One');
     $n->setUses(array(array('Test\\Space\\Two', 'Two'), 'Test\\Space\\Three'));
     $codeStr = (string) $n;
     $code = $n->render(true);
     ob_start();
     $n->render();
     $output = ob_get_clean();
     $this->assertContains('use Test\\Space\\One as One', $code);
     $this->assertContains('Test\\Space\\Two as Two', $code);
     $this->assertContains('use Test\\Space\\One', $codeStr);
     $this->assertContains('Test\\Space\\Two', $codeStr);
     $this->assertContains('use Test\\Space\\One', $output);
     $this->assertContains('Test\\Space\\Two', $output);
 }