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

render() публичный Метод

Render property
public render ( boolean $ret = false ) : mixed
$ret boolean
Результат mixed
    public function render($ret = false)
    {
        $this->docblock = new DocblockGenerator(null, $this->indent);
        $this->docblock->setTag('namespace');
        $this->output = $this->docblock->render(true);
        $this->output .= $this->indent . 'namespace ' . $this->namespace . ';' . PHP_EOL;
        if (count($this->use) > 0) {
            $this->output .= PHP_EOL;
            foreach ($this->use as $ns => $as) {
                $this->output .= $this->indent . 'use ';
                $this->output .= $ns;
                if (null !== $as) {
                    $this->output .= ' as ' . $as;
                }
                $this->output .= ';' . PHP_EOL;
            }
        }
        if ($ret) {
            return $this->output;
        } else {
            echo $this->output;
        }
    }

Usage Example

Пример #1
0
 /**
  * Render method
  *
  * @param  boolean $ret
  * @return mixed
  */
 public function render($ret = false)
 {
     $this->output = null !== $this->namespace ? $this->namespace->render(true) . PHP_EOL : null;
     $this->output .= null !== $this->docblock ? $this->docblock->render(true) : null;
     $this->output .= 'interface ' . $this->name;
     if (null !== $this->parent) {
         $this->output .= ' extends ' . $this->parent;
     }
     $this->output .= PHP_EOL . '{' . PHP_EOL;
     $this->output .= $this->formatMethods() . PHP_EOL;
     $this->output .= '}' . PHP_EOL;
     if ($ret) {
         return $this->output;
     } else {
         echo $this->output;
     }
 }
All Usage Examples Of Pop\Code\Generator\NamespaceGenerator::render