PhpPeg\PHPBuilder::render PHP Method

render() public method

public render ( $array = NULL, $indent = "" )
    function render($array = NULL, $indent = "")
    {
        if ($array === NULL) {
            $array = $this->lines;
        }
        $out = [];
        foreach ($array as $line) {
            if (is_array($line)) {
                list($entry, $block) = $line;
                $str = $this->render($block, $indent . "\t");
                if (strlen($str) < 40) {
                    $out[] = $indent . $entry . ' { ' . ltrim($str) . ' }';
                } else {
                    $out[] = $indent . $entry . ' {';
                    $out[] = $str;
                    $out[] = $indent . '}';
                }
            } else {
                $out[] = $indent . $line;
            }
        }
        return implode(PHP_EOL, $out);
    }