Pop\Code\Generator\InterfaceGenerator::render PHP Method

render() public method

Render method
public render ( boolean $ret = false ) : mixed
$ret boolean
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;
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Render method
  *
  * @param  boolean $ret
  * @return mixed
  */
 public function render($ret = false)
 {
     $this->output = '<?php' . PHP_EOL;
     $this->output .= null !== $this->docblock ? $this->docblock->render(true) . PHP_EOL : null;
     if (null !== $this->namespace) {
         $this->output .= $this->namespace->render(true) . PHP_EOL;
     }
     if (null !== $this->code) {
         $this->output .= $this->code->render(true) . PHP_EOL;
     }
     if (null !== $this->body) {
         $this->output .= PHP_EOL . $this->body . PHP_EOL . PHP_EOL;
     }
     if ($this->close) {
         $this->output .= '?>' . PHP_EOL;
     }
     if ($ret) {
         return $this->output;
     } else {
         echo $this->output;
     }
 }