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

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

Render docblock
public render ( boolean $ret = false ) : mixed
$ret boolean
Результат mixed
    public function render($ret = false)
    {
        $this->output = $this->indent . '/**' . PHP_EOL;
        if (!empty($this->desc)) {
            $desc = trim($this->desc);
            $descAry = explode("\n", $desc);
            $i = 0;
            foreach ($descAry as $d) {
                $i++;
                $this->output .= $this->indent . ' * ' . wordwrap($d, 70, PHP_EOL . $this->indent . " * ") . PHP_EOL;
                if ($i < count($descAry)) {
                    $this->output .= $this->indent . ' * ' . PHP_EOL;
                }
            }
        }
        $this->output .= $this->formatTags();
        $this->output .= $this->indent . ' */' . 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\DocblockGenerator::render