Pop\Code\Generator\NamespaceGenerator::factory PHP Метод

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

Static method to instantiate the property generator object and return itself to facilitate chaining methods together.
public static factory ( string $namespace ) : NamespaceGenerator
$namespace string
Результат NamespaceGenerator
    public static function factory($namespace)
    {
        return new self($namespace);
    }

Usage Example

Пример #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);
 }