PHPParser.js
{
"type": "file",
"namespace": {
"type": "namespace",
"name": "Taeluf\\PHTML",
"declaration": "namespace Taeluf\\PHTML;",
"class": [
{
"type": "class",
"namespace": "Taeluf\\PHTML",
"fqn": "Taeluf\\PHTML\\PHPParser",
"name": "PHPParser",
"declaration": "class PHPParser",
"properties": [
{
"type": "property",
"modifiers": [
"protected",
"string"
],
"docblock": {
"type": "docblock",
"description": "The source HTML + PHP code\n",
"attribute": [
{
"type": "attribute",
"name": "var",
"description": "string"
}
]
},
"name": "src",
"declaration": "protected string $src;"
},
{
"type": "property",
"modifiers": [
"protected",
"object"
],
"docblock": {
"type": "docblock",
"description": "The parsed pieces of code in the format:\n [\n 'html' => '<div>A string of code with php placeholders like <b>phpadsfwefhaksldfjaskdlfjaskldfjasldfkphp<\/b> <\/div> and trailing text...',\n 'php' => [\n 'phpadsfwefhaksldfjaskdlfjaskldfjasldfkphp' => '<?=\"Something echod\";?>', \n 'phpid2'=>'<?php \/\/ another code block\/?>'\n ]\n ]\nThe array is simply (object) cast"
},
"name": "pieces",
"declaration": "protected object $pieces;"
}
],
"methods": [
{
"type": "method",
"args": [
{
"type": "arg",
"arg_types": [
"string"
],
"name": "htmlPHPString",
"declaration": "string $htmlPHPString"
}
],
"docblock": {
"type": "docblock",
"description": "Create a new PHP parser instance from a string\n",
"attribute": [
{
"type": "attribute",
"name": "param",
"description": "mixed $htmlPHPString - a block of HTML + PHP code. PHP code will be inside open (<?php or <?=) and close (?>) tags"
},
{
"type": "attribute",
"name": "return",
"description": "void"
}
]
},
"modifiers": [
"public"
],
"name": "__construct",
"body": [],
"declaration": "public function __construct(string $htmlPHPString)"
},
{
"type": "method",
"args": [],
"docblock": {
"type": "docblock",
"description": "Return the parsed pieces. See doc for protected $pieces\n",
"attribute": [
{
"type": "attribute",
"name": "return",
"description": "object"
}
]
},
"modifiers": [
"public"
],
"name": "pieces",
"return_types": [
"object"
],
"body": [],
"declaration": "public function pieces(): object"
},
{
"type": "method",
"args": [],
"docblock": {
"type": "docblock",
"description": "Separate the source code into it's pieces. See the protected $pieces docs",
"attribute": [
{
"type": "attribute",
"name": "return",
"description": "object just an array cast to object"
}
]
},
"modifiers": [
"protected"
],
"name": "separatePHP",
"return_types": [
"object"
],
"body": {
"_source": null,
"_type": "array"
},
"declaration": "protected function separatePHP(): object"
},
{
"type": "method",
"args": [
{
"type": "arg",
"name": "length",
"value": "26",
"declaration": "$length = 26"
}
],
"docblock": {
"type": "docblock",
"description": "Generates a random string of characters a-z, all lowercase & returns them\n this is used for the PHP placeholders\n",
"attribute": [
{
"type": "attribute",
"name": "param",
"description": "int $length"
},
{
"type": "attribute",
"name": "return",
"description": "string"
}
]
},
"modifiers": [
"protected"
],
"name": "randomAlpha",
"return_types": [
"string"
],
"body": [],
"declaration": "protected function randomAlpha($length = 26): string"
},
{
"type": "method",
"args": [
{
"type": "arg",
"name": "length",
"value": "26",
"declaration": "$length = 26"
}
],
"docblock": {
"type": "docblock",
"description": "Generates a random string of characters a-z, all lowercase & returns them\n this is used for the PHP placeholders\n",
"attribute": [
{
"type": "attribute",
"name": "param",
"description": "int $length"
},
{
"type": "attribute",
"name": "return",
"description": "string"
}
]
},
"modifiers": [
"static",
"public"
],
"name": "getRandomAlpha",
"return_types": [
"string"
],
"body": [],
"declaration": "static public function getRandomAlpha($length = 26): string"
},
{
"type": "method",
"args": [],
"docblock": {
"type": "docblock",
"description": "Tokenize the src code into a slightly better format than token_get_all\n",
"attribute": [
{
"type": "attribute",
"name": "return",
"description": "array of tokens"
}
]
},
"modifiers": [
"protected"
],
"name": "tokens",
"return_types": [
"array"
],
"body": {
"_source": null,
"_type": "array"
},
"declaration": "protected function tokens(): array"
}
]
}
]
}
}