Phtml.printr.js

Array
(
    [type] => file
    [namespace] => Array
        (
            [type] => namespace
            [name] => Taeluf
            [declaration] => namespace Taeluf;
            [class] => Array
                (
                    [0] => Array
                        (
                            [type] => class
                            [namespace] => Taeluf
                            [fqn] => Taeluf\Phtml
                            [name] => Phtml
                            [extends] => \DOMDocument
                            [declaration] => class Phtml extends \DOMDocument
                            [properties] => Array
                                (
                                    [0] => Array
                                        (
                                            [type] => property
                                            [modifiers] => Array
                                                (
                                                    [0] => protected
                                                    [1] => string
                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => The source HTML + PHP code

                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => var
                                                                    [description] => string
                                                                )

                                                        )

                                                )

                                            [name] => src
                                            [declaration] => protected string $src;
                                        )

                                    [1] => Array
                                        (
                                            [type] => property
                                            [modifiers] => Array
                                                (
                                                    [0] => protected
                                                    [1] => string
                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => The source code with all the PHP replaced by placeholders
                                                )

                                            [name] => cleanSrc
                                            [declaration] => protected string $cleanSrc;
                                        )

                                    [2] => Array
                                        (
                                            [type] => property
                                            [modifiers] => Array
                                                (
                                                    [0] => protected
                                                    [1] => array
                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => [ 'phpplaceholder' => $phpCode, 'placeholder2' => $morePHP ]
                                                )

                                            [name] => php
                                            [declaration] => protected array $php;
                                        )

                                    [3] => Array
                                        (
                                            [type] => property
                                            [modifiers] => Array
                                                (
                                                    [0] => protected
                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => A random string used when adding php code to a node's tag declaration. This string is later removed during output()
                                                )

                                            [name] => phpAttrValue
                                            [declaration] => protected $phpAttrValue;
                                        )

                                )

                            [comments] => Array
                                (
                                    [0] => /**
                                    [1] => * True if the source html had a '<html>' tag
                                    [2] => * Except we're not implementing that???
                                    [3] => * @var bool
                                    [4] => */
                                    [5] => protected bool $isHTMLDoc = false;
                                )

                            [methods] => Array
                                (
                                    [0] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => html
                                                            [declaration] => $html
                                                        )

                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => Create a DOMDocument, passing your HTML + PHP to __construct. 


                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => param
                                                                    [description] => mixed $html a block of HTML + PHP code. It does not have to have PHP. PHP will be handled gracefully.
                                                                )

                                                            [1] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => return
                                                                    [description] => void
                                                                )

                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => __construct
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function __construct($html)
                                        )

                                    [1] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [arg_types] => Array
                                                                (
                                                                    [0] => string
                                                                )

                                                            [name] => string
                                                            [declaration] => string $string
                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => placeholder
                                            [return_types] => Array
                                                (
                                                    [0] => string
                                                )

                                            [body] => Tlf\Lexer\StringAst Object
                                                (
                                                    [_path:protected] => 
                                                    [_name:protected] => 
                                                    [_ext:protected] => 
                                                    [_source] => 
                                                    [_tree:protected] => Array
                                                        (
                                                            [type] => array
                                                        )

                                                    [_type] => array
                                                    [passthrough:protected] => Array
                                                        (
                                                        )

                                                )

                                            [declaration] => public function placeholder(string $string): string
                                        )

                                    [2] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [arg_types] => Array
                                                                (
                                                                    [0] => string
                                                                )

                                                            [name] => placeholder
                                                            [declaration] => string $placeholder
                                                        )

                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => Get the code that's represented by the placeholder
                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => return
                                                                    [description] => the stored code or null
                                                                )

                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => codeFromPlaceholder
                                            [return_types] => Array
                                                (
                                                    [0] => string
                                                )

                                            [body] => Tlf\Lexer\StringAst Object
                                                (
                                                    [_path:protected] => 
                                                    [_name:protected] => 
                                                    [_ext:protected] => 
                                                    [_source] => 
                                                    [_tree:protected] => Array
                                                        (
                                                            [type] => array
                                                        )

                                                    [_type] => array
                                                    [passthrough:protected] => Array
                                                        (
                                                        )

                                                )

                                            [declaration] => public function codeFromPlaceholder(string $placeholder): string
                                        )

                                    [3] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [arg_types] => Array
                                                                (
                                                                    [0] => string
                                                                )

                                                            [name] => enclosedPHP
                                                            [declaration] => string $enclosedPHP
                                                        )

                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => Get a placeholder for the given block of code
Intention is to parse a single '<?php //piece of php code ?>' and not '<?php //stuff ?><?php //more stuff?>'
When used as intended, will return a single 'word' that is the placeholder for the given code

                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => param
                                                                    [description] => mixed $enclosedPHP an HTML + PHP string
                                                                )

                                                            [1] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => return
                                                                    [description] => string the parsed block of content where PHP code blocks are replaced by placeholders.
                                                                )

                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => phpPlaceholder
                                            [return_types] => Array
                                                (
                                                    [0] => string
                                                )

                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function phpPlaceholder(string $enclosedPHP): string
                                        )

                                    [4] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [arg_types] => Array
                                                                (
                                                                    [0] => string
                                                                )

                                                            [name] => codeWithPlaceholders
                                                            [declaration] => string $codeWithPlaceholders
                                                        )

                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => Decode the given code by replacing PHP placeholders with the PHP code itself

                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => param
                                                                    [description] => mixed $str
                                                                )

                                                            [1] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => return
                                                                    [description] => void
                                                                )

                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => fillWithPHP
                                            [return_types] => Array
                                                (
                                                    [0] => string
                                                )

                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function fillWithPHP(string $codeWithPlaceholders): string
                                        )

                                    [5] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => See output()

                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => return
                                                                    [description] => string
                                                                )

                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => __toString
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function __toString()
                                        )

                                    [6] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => withPHP
                                                            [value] => true
                                                            [declaration] => $withPHP=true
                                                        )

                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => Return the decoded document as as tring. All PHP will be back in its place

                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => param
                                                                    [description] => mixed $withPHP passing FALSE means placeholders will still be present & PHP code will not be
                                                                )

                                                            [1] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => return
                                                                    [description] => string the final document with PHP where it belongs
                                                                )

                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => output
                                            [body] => Tlf\Lexer\StringAst Object
                                                (
                                                    [_path:protected] => 
                                                    [_name:protected] => 
                                                    [_ext:protected] => 
                                                    [_source] => 
                                                    [_tree:protected] => Array
                                                        (
                                                            [type] => array
                                                        )

                                                    [_type] => array
                                                    [passthrough:protected] => Array
                                                        (
                                                        )

                                                )

                                            [declaration] => public function output($withPHP=true)
                                        )

                                    [7] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => html
                                                            [declaration] => $html
                                                        )

                                                    [1] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => withPHP
                                                            [value] => true
                                                            [declaration] => $withPHP=true
                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => fill_php
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function fill_php($html, $withPHP=true)
                                        )

                                    [8] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => xpath
                                                            [declaration] => $xpath
                                                        )

                                                    [1] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => refNode
                                                            [value] => null
                                                            [declaration] => $refNode=null
                                                        )

                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => get the results of an xpath query

                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => param
                                                                    [description] => mixed $xpath the xpath query, such as: //tagname[@attributename="value"]
                 If you use a refnode, prepend '.' at the beginning of your xpath query string
                                                                )

                                                            [1] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => param
                                                                    [description] => mixed $refNode a parent-node to search under
                                                                )

                                                            [2] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => return
                                                                    [description] => array the resulting DomNodeList is converted to an array & returned
                                                                )

                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => xpath
                                            [body] => Tlf\Lexer\StringAst Object
                                                (
                                                    [_path:protected] => 
                                                    [_name:protected] => 
                                                    [_ext:protected] => 
                                                    [_source] => 
                                                    [_tree:protected] => Array
                                                        (
                                                            [type] => array
                                                        )

                                                    [_type] => array
                                                    [passthrough:protected] => Array
                                                        (
                                                        )

                                                )

                                            [declaration] => public function xpath($xpath,$refNode=null)
                                        )

                                    [9] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => node
                                                            [declaration] => $node
                                                        )

                                                    [1] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => phpCode
                                                            [declaration] => $phpCode
                                                        )

                                                )

                                            [docblock] => Array
                                                (
                                                    [type] => docblock
                                                    [description] => Set an attribute that will place PHP code inside the tag declartion of a node. 
Basically: `<node phpCodePlaceholder>`, which pHtml will later convert to `<node <?='some_stuff'?>>`. 
This avoids problems caused by attributes requiring a `=""`, which `DOMDocument` automatically places.

                                                    [attribute] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => param
                                                                    [description] => $phpCode A block of php code with opening & closing tags like <?='some stuff'?>
                                                                )

                                                            [1] => Array
                                                                (
                                                                    [type] => attribute
                                                                    [name] => return
                                                                    [description] => \Taeluf\PHTML\ValuelessAttribute
                                                                )

                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => addPhpToTag
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function addPhpToTag($node, $phpCode)
                                        )

                                    [10] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [arg_types] => Array
                                                                (
                                                                    [0] => \DOMNode
                                                                )

                                                            [name] => node
                                                            [declaration] => \DOMNode $node
                                                        )

                                                    [1] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => phpCode
                                                            [declaration] => $phpCode
                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => insertCodeBefore
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function insertCodeBefore(\DOMNode $node, $phpCode)
                                        )

                                    [11] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [arg_types] => Array
                                                                (
                                                                    [0] => \DOMNode
                                                                )

                                                            [name] => node
                                                            [declaration] => \DOMNode $node
                                                        )

                                                    [1] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => phpCode
                                                            [declaration] => $phpCode
                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => insertCodeAfter
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function insertCodeAfter(\DOMNode $node, $phpCode)
                                        )

                                    [12] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => html
                                                            [declaration] => $html
                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => cleanHTML
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function cleanHTML($html)
                                        )

                                    [13] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => html
                                                            [declaration] => $html
                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => restoreHtml
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function restoreHtml($html)
                                        )

                                    [14] => Array
                                        (
                                            [type] => method
                                            [args] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [type] => arg
                                                            [name] => param
                                                            [declaration] => $param
                                                        )

                                                )

                                            [modifiers] => Array
                                                (
                                                    [0] => public
                                                )

                                            [name] => __get
                                            [body] => Array
                                                (
                                                )

                                            [declaration] => public function __get($param)
                                        )

                                )

                        )

                )

        )

)