diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..742d46f --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.pre linguist-language=PHP diff --git a/.gitignore b/.gitignore index 61ead86..3f1d064 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /vendor +/coverage diff --git a/composer.json b/composer.json index a344864..c5d0a66 100644 --- a/composer.json +++ b/composer.json @@ -1,18 +1,31 @@ { "name": "pre/phpx", "type": "pre-compiler", + "license": "MIT", "require": { - "pre/plugin": "^0.7.7" + "pre/plugin": "^0.11.0", + "nikic/php-parser": "^4.0", + "gajus/dindent": "^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0|^6.0" }, "autoload": { "files": [ - "src/parser.php", - "src/renderers.php" + "source/functions.php" + ], + "psr-4": { + "Pre\\Phpx\\": "source" + } + }, + "autoload-dev": { + "files": [ + "tests/TestCase.php" ] }, "extra": { "compilers": [ - "Pre\\Phpx\\compile" + "\\Pre\\Phpx\\compile" ] } } diff --git a/composer.lock b/composer.lock index efb1618..66595d1 100644 --- a/composer.lock +++ b/composer.lock @@ -1,95 +1,378 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7515577887fd7239e602040e9f8d78bf", + "content-hash": "f5f0f5e0de23f57b10304394c4bd84ef", "packages": [ { - "name": "doctrine/annotations", - "version": "v1.5.0", + "name": "gajus/dindent", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "5beebb01b025c94e93686b7a0ed3edae81fe3e7f" + "url": "https://github.com/gajus/dindent.git", + "reference": "d81c3a6f78fbe1ab26f5e753098bbbef6b6a9f3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/5beebb01b025c94e93686b7a0ed3edae81fe3e7f", - "reference": "5beebb01b025c94e93686b7a0ed3edae81fe3e7f", + "url": "https://api.github.com/repos/gajus/dindent/zipball/d81c3a6f78fbe1ab26f5e753098bbbef6b6a9f3c", + "reference": "d81c3a6f78fbe1ab26f5e753098bbbef6b6a9f3c", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "autoload": { + "psr-4": { + "Gajus\\Dindent\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Gajus Kuizinas", + "email": "gk@anuary.com" + } + ], + "description": "HTML indentation library for development and testing.", + "homepage": "https://github.com/gajus/dindent", + "keywords": [ + "format", + "html", + "indent" + ], + "time": "2014-10-08T10:03:04+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.0.3", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d", + "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5 || ^7.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2018-07-15T17:25:16+00:00" + }, + { + "name": "pre/plugin", + "version": "0.11.0", + "source": { + "type": "git", + "url": "https://github.com/preprocess/pre-plugin.git", + "reference": "74bf7893cea59077cca120ca73987c0297820efc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/preprocess/pre-plugin/zipball/74bf7893cea59077cca120ca73987c0297820efc", + "reference": "74bf7893cea59077cca120ca73987c0297820efc", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1" + }, + "require-dev": { + "composer/composer": "^1.3", + "phpunit/phpunit": "^5.0|^6.0" + }, + "type": "composer-plugin", + "extra": { + "class": [ + "\\Pre\\Plugin\\Composer\\Plugin" + ] + }, + "autoload": { + "psr-4": { + "Pre\\Plugin\\": "source" + }, + "files": [ + "source/environment.php", + "source/expanders.php", + "source/parsers.php", + "source/functions.php", + "source/autoload.php", + "source/macros.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "time": "2018-09-10T11:17:14+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "doctrine/lexer": "1.*", "php": "^7.1" }, "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^5.7" + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-07-22T11:58:36+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2018-06-11T23:09:50+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" }, { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" }, { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" }, { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" }, { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2017-07-22T10:58:02+00:00" + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" }, { - "name": "doctrine/lexer", - "version": "v1.0.1", + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" }, "type": "library", "extra": { @@ -98,8 +381,10 @@ } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -108,91 +393,106 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" } ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", "keywords": [ - "lexer", - "parser" + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" ], - "time": "2014-09-09T13:34:57+00:00" + "time": "2017-09-11T18:02:19+00:00" }, { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.4.0", + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", "source": { "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "63661f3add3609e90e4ab8115113e189ae547bb4" + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/63661f3add3609e90e4ab8115113e189ae547bb4", - "reference": "63661f3add3609e90e4ab8115113e189ae547bb4", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", "shasum": "" }, "require": { - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "gecko-packages/gecko-php-unit": "^2.0", - "php": "^5.6 || >=7.0 <7.2", - "sebastian/diff": "^1.4", - "symfony/console": "^3.0", - "symfony/event-dispatcher": "^3.0", - "symfony/filesystem": "^3.0", - "symfony/finder": "^3.0", - "symfony/options-resolver": "^3.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0", - "symfony/stopwatch": "^3.0" - }, - "conflict": { - "hhvm": "*" + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1", - "justinrainbow/json-schema": "^5.0", - "phpunit/phpunit": "^4.8.35 || ^5.4.3", - "satooshi/php-coveralls": "^1.0", - "symfony/phpunit-bridge": "^3.2.2" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, - "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } }, - "bin": [ - "php-cs-fixer" + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "type": "application", + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php" - ] + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -200,90 +500,207 @@ ], "authors": [ { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Mike van Riel", + "email": "me@mikevanriel.com" } ], - "description": "A tool to automatically fix PHP code style", - "time": "2017-07-18T15:35:40+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { - "name": "gecko-packages/gecko-php-unit", - "version": "v2.1", + "name": "phpspec/prophecy", + "version": "1.8.0", "source": { "type": "git", - "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", - "reference": "5b9e9622c7efd3b22655270b80c03f9e52878a6e" + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/5b9e9622c7efd3b22655270b80c03f9e52878a6e", - "reference": "5b9e9622c7efd3b22655270b80c03f9e52878a6e", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { - "php": "^5.3.6 || ^7.0" + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.4.3" + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, "autoload": { - "psr-4": { - "GeckoPackages\\PHPUnit\\": "src\\PHPUnit" + "psr-0": { + "Prophecy\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Additional PHPUnit tests.", - "homepage": "https://github.com/GeckoPackages", + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", "keywords": [ - "extension", - "filesystem", - "phpunit" + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" ], - "time": "2017-06-20T11:22:48+00:00" + "time": "2018-08-05T17:53:17+00:00" }, { - "name": "nikic/php-parser", - "version": "v3.1.0", + "name": "phpunit/php-code-coverage", + "version": "5.3.2", "source": { "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4d4896e553f2094e657fe493506dc37c509d4e2b" + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4d4896e553f2094e657fe493506dc37c509d4e2b", - "reference": "4d4896e553f2094e657fe493506dc37c509d4e2b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": ">=5.5" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "phpunit/phpunit": "^6.0" }, - "bin": [ - "bin/php-parse" + "suggest": { + "ext-xdebug": "^2.5.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" ], + "time": "2018-04-06T15:36:58+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -291,182 +708,233 @@ ], "authors": [ { - "name": "Nikita Popov" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "A PHP parser written in PHP", + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ - "parser", - "php" + "template" ], - "time": "2017-07-28T14:45:09+00:00" + "time": "2015-06-21T13:50:34+00:00" }, { - "name": "paragonie/random_compat", - "version": "v2.0.10", + "name": "phpunit/php-timer", + "version": "1.0.9", "source": { "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d", - "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { - "files": [ - "lib/random.php" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" } ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "csprng", - "pseudorandom", - "random" + "timer" ], - "time": "2017-03-13T16:27:32+00:00" + "time": "2017-02-26T11:10:40+00:00" }, { - "name": "pre/plugin", - "version": "0.7.6", + "name": "phpunit/php-token-stream", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/preprocess/pre-plugin.git", - "reference": "70f4c0bc9152a0b2b5b0444655350b8ba858fb84" + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/preprocess/pre-plugin/zipball/70f4c0bc9152a0b2b5b0444655350b8ba858fb84", - "reference": "70f4c0bc9152a0b2b5b0444655350b8ba858fb84", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1", - "friendsofphp/php-cs-fixer": "^2.0", - "tuupola/base62": "^0.8", - "yay/yay": "^0.2" + "ext-tokenizer": "*", + "php": "^7.0" }, "require-dev": { - "composer/composer": "^1.3", - "phpunit/phpunit": "^5.0|^6.0" + "phpunit/phpunit": "^6.2.4" }, - "type": "composer-plugin", + "type": "library", "extra": { - "class": [ - "Pre\\Plugin\\Integration\\Plugin" - ] + "branch-alias": { + "dev-master": "2.0-dev" + } }, "autoload": { - "files": [ - "src/autoload.php", - "src/functions.php", - "src/expanders.php", - "src/bootstrap.php" - ], - "psr-4": { - "Pre\\Plugin\\": "src" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" ], - "time": "2017-08-16T08:08:58+00:00" + "time": "2017-11-27T05:48:46+00:00" }, { - "name": "psr/log", - "version": "1.0.2", + "name": "phpunit/phpunit", + "version": "6.5.13", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "0973426fb012359b2f18d3bd1e90ef1172839693" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0973426fb012359b2f18d3bd1e90ef1172839693", + "reference": "0973426fb012359b2f18d3bd1e90ef1172839693", "shasum": "" }, "require": { - "php": ">=5.3.0" + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^5.0.9", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" }, + "bin": [ + "phpunit" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "6.5.x-dev" } }, "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", "keywords": [ - "log", - "psr", - "psr-3" + "phpunit", + "testing", + "xunit" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2018-09-08T15:10:43+00:00" }, { - "name": "sebastian/diff", - "version": "1.4.3", + "name": "phpunit/phpunit-mock-objects", + "version": "5.0.10", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", + "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "conflict": { + "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^6.5.11" + }, + "suggest": { + "ext-soap": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -479,716 +947,649 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", "keywords": [ - "diff" + "mock", + "xunit" ], - "time": "2017-05-22T07:24:03+00:00" + "time": "2018-08-09T05:50:03+00:00" }, { - "name": "symfony/console", - "version": "v3.3.6", + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "b0878233cb5c4391347e5495089c7af11b8e6201" + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/b0878233cb5c4391347e5495089c7af11b8e6201", - "reference": "b0878233cb5c4391347e5495089c7af11b8e6201", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/debug": "~2.8|~3.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" + "php": "^5.6 || ^7.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/http-kernel": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/filesystem": "", - "symfony/process": "" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2017-07-29T21:27:59+00:00" + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" }, { - "name": "symfony/debug", - "version": "v3.3.6", + "name": "sebastian/comparator", + "version": "2.1.3", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "7c13ae8ce1e2adbbd574fc39de7be498e1284e13" + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/7c13ae8ce1e2adbbd574fc39de7be498e1284e13", - "reference": "7c13ae8ce1e2adbbd574fc39de7be498e1284e13", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", "shasum": "" }, "require": { - "php": ">=5.5.9", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "php": "^7.0", + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2017-07-28T15:27:31+00:00" + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-02-01T13:46:46+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v3.3.6", + "name": "sebastian/diff", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e" + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/67535f1e3fd662bdc68d7ba317c93eecd973617e", - "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", "shasum": "" }, "require": { - "php": ">=5.5.9" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" + "php": "^7.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "phpunit/phpunit": "^6.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "2.0-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-06-09T14:53:08+00:00" + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-08-03T08:09:46+00:00" }, { - "name": "symfony/filesystem", - "version": "v3.3.6", + "name": "sebastian/environment", + "version": "3.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "427987eb4eed764c3b6e38d52a0f87989e010676" + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/427987eb4eed764c3b6e38d52a0f87989e010676", - "reference": "427987eb4eed764c3b6e38d52a0f87989e010676", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2017-07-11T07:17:58+00:00" + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2017-07-01T08:51:00+00:00" }, { - "name": "symfony/finder", - "version": "v3.3.6", + "name": "sebastian/exporter", + "version": "3.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4" + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/baea7f66d30854ad32988c11a09d7ffd485810c4", - "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2017-06-01T21:01:25+00:00" + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" }, { - "name": "symfony/options-resolver", - "version": "v3.3.6", + "name": "sebastian/global-state", + "version": "2.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "ff48982d295bcac1fd861f934f041ebc73ae40f0" + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ff48982d295bcac1fd861f934f041ebc73ae40f0", - "reference": "ff48982d295bcac1fd861f934f041ebc73ae40f0", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "2.0-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony OptionsResolver Component", - "homepage": "https://symfony.com", + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", "keywords": [ - "config", - "configuration", - "options" + "global state" ], - "time": "2017-04-12T14:14:56+00:00" + "time": "2017-04-27T15:39:26+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.5.0", + "name": "sebastian/object-enumerator", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, - "suggest": { - "ext-mbstring": "For best performance" + "require-dev": { + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-06-14T15:44:48+00:00" + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" }, { - "name": "symfony/polyfill-php70", - "version": "v1.5.0", + "name": "sebastian/object-reflector", + "version": "1.1.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "b6482e68974486984f59449ecea1fbbb22ff840f" + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/b6482e68974486984f59449ecea1fbbb22ff840f", - "reference": "b6482e68974486984f59449ecea1fbbb22ff840f", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0", - "php": ">=5.3.3" + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.1-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], "classmap": [ - "Resources/stubs" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2017-06-14T15:44:48+00:00" + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { - "name": "symfony/polyfill-php72", - "version": "v1.5.0", + "name": "sebastian/recursion-context", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "8abc9097f5001d310f0edba727469c988acc6ea7" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/8abc9097f5001d310f0edba727469c988acc6ea7", - "reference": "8abc9097f5001d310f0edba727469c988acc6ea7", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2017-07-11T13:25:55+00:00" + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" }, { - "name": "symfony/process", - "version": "v3.3.6", + "name": "sebastian/resource-operations", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "07432804942b9f6dd7b7377faf9920af5f95d70a" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/07432804942b9f6dd7b7377faf9920af5f95d70a", - "reference": "07432804942b9f6dd7b7377faf9920af5f95d70a", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2017-07-13T13:05:09+00:00" + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" }, { - "name": "symfony/stopwatch", - "version": "v3.3.6", + "name": "sebastian/version", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "602a15299dc01556013b07167d4f5d3a60e90d15" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/602a15299dc01556013b07167d4f5d3a60e90d15", - "reference": "602a15299dc01556013b07167d4f5d3a60e90d15", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2017-04-12T14:14:56+00:00" + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" }, { - "name": "tuupola/base62", - "version": "0.8.0", + "name": "theseer/tokenizer", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/tuupola/base62.git", - "reference": "5218b96d005e43124ae9d763efb091ee20505ae9" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tuupola/base62/zipball/5218b96d005e43124ae9d763efb091ee20505ae9", - "reference": "5218b96d005e43124ae9d763efb091ee20505ae9", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0" - }, - "require-dev": { - "paragonie/random_compat": "^2.0", - "phpbench/phpbench": "^0.13.0", - "phpunit/phpunit": "^4.8", - "squizlabs/php_codesniffer": "^2.5" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" }, "type": "library", "autoload": { - "psr-4": { - "Tuupola\\": "src" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mika Tuupola", - "email": "tuupola@appelsiini.net", - "homepage": "http://www.appelsiini.net/", + "name": "Arne Blankerts", + "email": "arne@blankerts.de", "role": "Developer" } ], - "description": "Base62 encoder and decoder for arbitrary data", - "homepage": "https://github.com/tuupola/base62", - "keywords": [ - "base62" - ], - "time": "2017-03-12T07:14:17+00:00" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" }, { - "name": "yay/yay", - "version": "0.2.0", + "name": "webmozart/assert", + "version": "1.3.0", "source": { "type": "git", - "url": "https://github.com/marcioAlmada/yay.git", - "reference": "9013a0a1c4d08eb197d8afec009652d90233ffe5" + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/marcioAlmada/yay/zipball/9013a0a1c4d08eb197d8afec009652d90233ffe5", - "reference": "9013a0a1c4d08eb197d8afec009652d90233ffe5", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { - "ext-mbstring": "*", - "ext-tokenizer": "*", - "nikic/php-parser": "^2.1|^3.0", - "php": "7.*" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5.2" + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" }, - "bin": [ - "bin/yay", - "bin/yay-pretty" - ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, "autoload": { - "files": [ - "src/parsers.php", - "src/expanders.php" - ], "psr-4": { - "Yay\\": "src/" + "Webmozart\\Assert\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1197,21 +1598,19 @@ ], "authors": [ { - "name": "Márcio Almada", - "email": "marcio3w@gmail.com", - "homepage": "https://github.com/marcioAlmada" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "A high level PHP Pre-Processor", + "description": "Assertions to validate method input/output with nice error messages.", "keywords": [ - "language", - "pre-processor", - "syntax" + "assert", + "check", + "validate" ], - "time": "2017-05-08T03:18:20+00:00" + "time": "2018-01-29T19:49:41+00:00" } ], - "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 0000000..fcbcaec --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1 @@ +/custom-renderer-fixture.php diff --git a/examples/custom-renderer-fixture.pre b/examples/custom-renderer-fixture.pre new file mode 100644 index 0000000..56a69fa --- /dev/null +++ b/examples/custom-renderer-fixture.pre @@ -0,0 +1,41 @@ + "", "children" => null]; + } + + if (isset($props->children) && is_array($props->children)) { + $props->children = join("", $props->children); + } + + if (!isset($props->children)) { + $props->children = null; + } + + return "<{$name} class=\"{$props->class}\">{$props->children}"; +} + +function RequiredFieldError($props) { + return ( +
+ + You forgot the {" " . $props->name . " "} field. +
+ ); +} + +function Fields($props) { + return ; +} diff --git a/examples/custom-renderer.php b/examples/custom-renderer.php new file mode 100644 index 0000000..5b0dd7f --- /dev/null +++ b/examples/custom-renderer.php @@ -0,0 +1,12 @@ + + + + + tests + + + + + source + + + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..9165440 --- /dev/null +++ b/readme.md @@ -0,0 +1,177 @@ +# Phpx + +Documentation can be found at [preprocess.io](https://preprocess.io#phpx). + +## Motivation + +I wanted to write a custom compiler, and this syntax appeals to me. It's not a replacement for Javascript, or even a very good implementation. But, I like it. That's all that counts. + +If you want to write component-based code, without writing Javascript; then this might work for you. + +## Getting started + +- Clone the repository +- Install the Compoer dependencies +- Run the tests _or_ execute the example scripts + +This should work on PHP 7.2 (where it was developed and tested). Make an issue if it's not working on 7.2 _or_ if you'd like to see things added. + +## What does it render? + +The goal was to decouple the compiler from the renderers. Once the Pre\Phpx\Html renderer moves out, you'll need to import it into your project or create a custom `render` function. The Pre\Phpx\Html `render` function looks like this: + +```php +public function render($name, $props = null) +{ + $props = $this->propsFrom($props); + + if ($function = globalFunctionMatching($name)) { + return call_user_func($function, $props); + } + + if ($class = globalClassMatching($name)) { + return (new $class($props))->render(); + } + + // render HTML from a list of allowed elements... + + return $this->format("..."); +} +``` + +This means you can define your own namespaced functions and classes, and use them in the Pre\Phpx\Html `render` function, like: + +```php +namespace Example\Application; + +// don't forget to define or import render +// everywhere you use HTML-in-PHP syntax +use function Pre\Phpx\Html\render; + +function MyForm($props) { + return ( +
+ {$props->showLabel ? : null} + +
+ ); +} + +// ...later + +print render(); +``` + +If you'd prefer to have your components automatically prefixed, define your own `render` function, You can extend the Pre\Phpx\Html `render` function: + +```php +namespace Example\Application; + +use function Pre\Phpx\classMatching; +use function Pre\Phpx\functionMatching; +use function Pre\Phpx\Html\render as renderHtml; +use function Pre\Phpx\Html\propsFrom; + +define("NAMESPACES", [ + // remove this if you only have + // namespaced classes and functions + "global", + + // classes and functions will + // be loaded from this namespace + "Example\\Application", +]); + +function render($name, $props = null) +{ + $props = propsFrom($props); + + if ($function = functionMatching(NAMESPACES, $name)) { + return call_user_func($function, $props); + } + + if ($class = classMatching(NAMESPACES, $name)) { + return (new $class($props))->render(); + } + + return renderHtml($name, $props); +} + +// ...later + +print render(); +``` + +You can define components as functions or classes: + +```php +function MyForm($props) { + // render things... +} + +// ...or + +class MyForm +{ + public function __construct($props) + { + // ...store and manipulate the props + } + + public function render() + { + // render things... + } +} +``` + +Since you can define a custom render function, you can decide what your components are allowed to return. HTML-in-PHP syntax is converted to the following form: + +```php +use function Pre\Phpx\Html\Example\render; + +function MyForm($props) { + return ( +
+ {$props->showLabel ? : null} + +
+ ); +} + +// ...becomes + +use function Pre\Phpx\Html\Example\render; + +function MyForm($props) +{ + return render("form", [ + "children" => [ + $props->showLabel ? + render("label", [ + "htmlFor" => "email", + "children" => "Email", + ]) : + null, + render("input", [ + "type" => "text", + "name" => "email", + "id" => "email", + ]), + ], + ]); +} +``` + +You decide what your components return and what your `render` function does. The Pre\Phpx\Html `render` function outputs strings of HTML, and expects components rendered by it to return strings (so that they can be concatenated in an array of children). + +> Returning `null` will also work. + +## Roadmap + +- [ ] Support HTML tag warnings and rewriting +- [ ] Move HTML renderer to its own library +- [ ] Set up StyleCI and Travis +- [ ] Write more tests +- [ ] Experiment with other renderers +- [ ] Document like it's 1999 diff --git a/source/Parser.php b/source/Parser.php new file mode 100644 index 0000000..33e4814 --- /dev/null +++ b/source/Parser.php @@ -0,0 +1,366 @@ +printer = new Printer(); + } + } + + public function tokens($code) + { + $tokens = []; + + $length = strlen($code); + $cursor = 0; + + $elementLevel = 0; + $elementStarted = null; + $elementEnded = null; + + $attributes = []; + $attributeLevel = 0; + $attributeStarted = null; + $attributeEnded = null; + + $expressionLevel = 0; + $expressionStarted = null; + $expressionEnded = null; + + $nestedLevel = 0; + $inQuote = false; + + $carry = 0; + + while ($cursor < $length) { + if ($code[$cursor] === '"' || $code[$cursor] === "'" && $code[$cursor - 1] !== "\\") { + $inQuote = !$inQuote; + } + + if ($code[$cursor] === "{" && $elementStarted !== null) { + if ($attributeLevel === 0) { + $attributeStarted = $cursor; + } + + $attributeLevel++; + } + + if ($code[$cursor] === "}" && $elementStarted !== null) { + $attributeLevel--; + + if ($attributeLevel === 0) { + $attributeEnded = $cursor; + } + } + + if ($attributeStarted !== null && $attributeEnded !== null) { + $position = (string) count($attributes); + $positionLength = strlen($position); + + $attribute = substr( + $code, + $attributeStarted + 1, + $attributeEnded - $attributeStarted - 1 + ); + + $attributes[$position] = $attribute; + + $before = substr($code, 0, $attributeStarted + 1); + $after = substr($code, $attributeEnded); + + $code = $before . $position . $after; + + $cursor = $attributeStarted + $positionLength + 2 /* braces */; + $length = strlen($code); + + $attributeStarted = null; + $attributeEnded = null; + + continue; + } + + if ($code[$cursor] === "{" && $elementStarted === null && $nestedLevel > 0) { + if ($expressionLevel === 0) { + $expressionStarted = $cursor; + } + + $expressionLevel++; + } + + if ($code[$cursor] === "}" && $elementStarted === null && $nestedLevel > 0) { + $expressionLevel--; + + if ($expressionLevel === 0) { + $expressionEnded = $cursor; + } + } + + if ($expressionStarted !== null && $expressionEnded !== null) { + $distance = $expressionEnded - $expressionStarted; + + $carry += $cursor; + + $before = trim(substr($code, 0, $expressionStarted)); + $expression = trim(substr($code, $expressionStarted + 1, $distance - 1)); + $after = trim(substr($code, $expressionEnded + 1)); + + $tokens[] = ["type" => "literal", "value" => $before, "started" => $expressionStarted]; + $tokens[] = ["type" => "expression", "value" => $this->nodes($this->tokens($expression)), "started" => $carry]; + + $code = $after; + $length = strlen($code); + $cursor = 0; + + $expressionStarted = null; + $expressionEnded = null; + + continue; + } + + preg_match("#^#", substr($code, $cursor - 1, 2), $matchesEqualBefore); + preg_match("#^>=#", substr($code, $cursor, 2), $matchesEqualAfter); + + if ( + $code[$cursor] === ">" + && !$matchesEqualBefore && !$matchesEqualAfter + && $attributeLevel < 1 + && $elementStarted !== null + && $expressionStarted === null + ) { + $elementLevel--; + $elementEnded = $cursor; + } + + if ($elementStarted !== null && $elementEnded !== null) { + $distance = $elementEnded - $elementStarted; + + $carry += $cursor; + + $before = trim(substr($code, 0, $elementStarted)); + $tag = trim(substr($code, $elementStarted, $distance + 1)); + $after = trim(substr($code, $elementEnded + 1)); + + $token = ["type" => "tag", "value" => $tag, "started" => $carry]; + + foreach ($attributes as $key => $value) { + $attributes[$key] = $this->tokens($value); + } + + if (count($attributes)) { + $token["attributes"] = $attributes; + } + + $tokens[] = ["type" => "literal", "value" => $before]; + $tokens[] = $token; + + if (preg_match("#/>$#", $tag)) { + preg_match("#<([a-zA-Z.\-_]+)#", $tag, $matchesName); + + $previous = $tokens[count($tokens) - 1]; + $tokens[count($tokens) - 1]["value"] = trim(substr($previous["value"], 0, strlen($previous["value"]) - 2)) . ">"; + + $name = $matchesName[1]; + $tokens[] = ["type" => "tag", "value" => ""]; + } + + $attributes = []; + + $code = $after; + $length = strlen($code); + $cursor = 0; + + $elementStarted = null; + $elementEnded = null; + + continue; + } + + $cursor++; + } + + $tokens[] = ["type" => "literal", "value" => trim($code)]; + + return array_values(array_filter($tokens, function ($token) { + if ($token["type"] === "literal" && !trim($token["value"])) { + return false; + } + + return true; + })); + } + + public function nodes($tokens) + { + $nodes = []; + $current = null; + + $cursor = 0; + $length = count($tokens); + + while ($cursor < $length) { + $token =& $tokens[$cursor]; + + if ($token["type"] === "tag" && $token["value"][1] !== "/") { + preg_match("#^<([a-zA-Z.\-_]+)#", $token["value"], $matches); + + if ($current !== null) { + $token["parent"] =& $current; + $current["children"][] =& $token; + } else { + $token["parent"] = null; + $nodes[] =& $token; + } + + $current =& $token; + $current["name"] = str_replace(".", "\\", $matches[1]); + $current["children"] = []; + + if (isset($current["attributes"])) { + foreach ($current["attributes"] as $key => $value) { + $current["attributes"][$key] = $this->nodes($value); + } + } + } elseif ($token["type"] === "tag" && $token["value"][1] === "/") { + preg_match("#^removeParents($nodes); + } + + private function removeParents($nodes) + { + foreach ($nodes as $i => $_) { + unset($nodes[$i]["parent"]); + + if (isset($nodes[$i]["children"])) { + $nodes[$i]["children"] = $this->removeParents($nodes[$i]["children"]); + } + } + + return $nodes; + } + + public function translate($nodes, $quoteLiterals = false, $combineChildren = false) + { + $code = ""; + + foreach ($nodes as $node) { + if ($node["type"] === "literal") { + if ($quoteLiterals) { + $code .= "\"" . addSlashes($node["value"]) . "\""; + } else { + $code .= $node["value"]; + } + + if ($combineChildren) { + $code .= ", "; + } + + continue; + } + if ($node["type"] === "expression") { + $code .= $this->translate($node["value"]); + + if ($combineChildren) { + $code .= ", "; + } + + continue; + } + + $code .= " render(\"{$node["name"]}\", [" . PHP_EOL; + + + if (isset($node["attributes"])) { + preg_match_all("#(\S+)={[^}]+?}#", $node["value"], $matches); + + foreach ($matches[1] as $i => $name) { + $code .= "\"{$name}\" => " . $this->translate($node["attributes"][$i], false, false) . "," . PHP_EOL; + } + } + + if (isset($node["children"]) && count($node["children"]) > 0) { + $translated = $this->translate($node["children"], true, true); + + if (count($node["children"]) > 1) { + $code .= "\"children\" => [{$translated}]," . PHP_EOL; + } else { + $code .= "\"children\" => {$translated}," . PHP_EOL; + } + } + + $code .= "]) "; + + if ($combineChildren) { + $code .= ", "; + } + } + + return trim($code, " .,"); + } + + public function format($code) + { + $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); + + try { + $parsed = $parser->parse($code); + } catch (Exception $e) { + throw new Exception("could not parse code"); + } + + return $this->printer->prettyPrintFile($parsed); + } +} diff --git a/source/Printer.php b/source/Printer.php new file mode 100644 index 0000000..c33f0d8 --- /dev/null +++ b/source/Printer.php @@ -0,0 +1,81 @@ +nl; + return preg_replace("#\{\s*{$nl}\s*{$nl}#", "{{$nl}", parent::pStmts($nodes, $indent)); + } + + protected function pStmt_Function(Stmt\Function_ $node) + { + return $this->nl . parent::pStmt_Function($node); + } + + protected function pExpr_Print(Expr\Print_ $node) + { + return $this->nl . $this->pPrefixOp(Expr\Print_::class, 'print ', $node->expr); + } + + protected function pStmt_Namespace(Stmt\Namespace_ $node) + { + $nl = $this->nl; + $name = is_null($node->name) ? "" : " " . $this->p($node->name); + + if ($this->canUseSemicolonNamespaces) { + return "{$nl}namespace{$name};{$nl}" . $this->pStmts($node->stmts, false); + } + + return "{$nl}namespace{$name}{$nl}{" . $this->pStmts($node->stmts) . "{$nl}}"; + } + + protected function pExpr_Ternary(Expr\Ternary $node) + { + $nl = $this->nl; + + if (is_null($node->if)) { + $results = $this->pInfixOp( + Expr\Ternary::class, + $node->cond, + "?: ", + $node->else + ); + } else { + $results = $this->pInfixOp( + Expr\Ternary::class, + $node->cond, + " ?{$nl}" . $this->p($node->if) . " :{$nl}", + $node->else + ); + } + + return $this->indentMore($results); + } + + protected function indentMore($code, $indent = " ") + { + $nl = $this->nl; + return preg_replace("#({$nl})(\s*)#", "$1{$indent}$2", $code); + } + + protected function pExpr_Array(Expr\Array_ $node) + { + if (count($node->items) < 1) { + return "[]"; + } + + return "[" . $this->pMaybeMultiline($node->items, true) . "]"; + } + + private function pMaybeMultiline(array $nodes) + { + return $this->pCommaSeparatedMultiline($nodes, true) . $this->nl; + } +} diff --git a/source/functions.php b/source/functions.php new file mode 100644 index 0000000..5240511 --- /dev/null +++ b/source/functions.php @@ -0,0 +1,55 @@ +format($parser->translate($parser->nodes($parser->tokens($code)))); +} + +function functionMatching(array $namespaces, $name) +{ + if (in_array("global", $namespaces)) { + if ($matching = globalFunctionMatching($name)) { + return $matching; + } + } + + foreach ($namespaces as $namespace) { + if (function_exists("\\{$namespace}\\{$name}")) { + return "\\{$namespace}\\{$name}"; + } + } +} + +function globalFunctionMatching($name) +{ + if (function_exists("\\{$name}")) { + return "\\{$name}"; + } +} + +function classMatching(array $namespaces, $name) +{ + if (in_array("global", $namespaces)) { + if ($matching = globalClassMatching($name)) { + return $matching; + } + } + + foreach ($namespaces as $namespace) { + if (class_exists("\\{$namespace}\\{$name}")) { + return "\\{$namespace}\\{$name}"; + } + } +} + +function globalClassMatching($name) +{ + if (class_exists("\\{$name}")) { + return "\\{$name}"; + } +} diff --git a/src/parser.php b/src/parser.php deleted file mode 100644 index 122bb2b..0000000 --- a/src/parser.php +++ /dev/null @@ -1,390 +0,0 @@ - 0) { - if ($expressionLevel === 0) { - $expressionStarted = $cursor; - } - - $expressionLevel++; - } - - if ($code[$cursor] === "}" && $elementStarted === null && $nestedLevel > 0) { - $expressionLevel--; - - if ($expressionLevel === 0) { - $expressionEnded = $cursor; - } - } - - if ($expressionStarted !== null && $expressionEnded !== null) { - $distance = $expressionEnded - $expressionStarted; - - $carry += $cursor; - - $before = trim(substr($code, 0, $expressionStarted)); - $expression = trim(substr($code, $expressionStarted + 1, $distance - 1)); - $after = trim(substr($code, $expressionEnded + 1)); - - $tokens[] = $before; - $tokens[] = ["expression" => compile($expression), "started" => $carry]; - - $code = $after; - $length = strlen($code); - $cursor = 0; - - $expressionStarted = null; - $expressionEnded = null; - - continue; - } - - preg_match("#^#", substr($code, $cursor - 1, 2), $matchesEqualBefore); - preg_match("#^>=#", substr($code, $cursor, 2), $matchesEqualAfter); - - if ( - $code[$cursor] === ">" - && !$matchesEqualBefore && !$matchesEqualAfter - && $attributeLevel < 1 - && $elementStarted !== null - && $expressionStarted === null - ) { - $elementLevel--; - $elementEnded = $cursor; - } - - if ($elementStarted !== null && $elementEnded !== null) { - $distance = $elementEnded - $elementStarted; - - $carry += $cursor; - - $before = trim(substr($code, 0, $elementStarted)); - $tag = trim(substr($code, $elementStarted, $distance + 1)); - $after = trim(substr($code, $elementEnded + 1)); - - $token = ["tag" => $tag, "started" => $carry]; - - foreach ($attributes as $key => $value) { - $attributes[$key] = tokens($value); - } - - if (count($attributes)) { - $token["attributes"] = $attributes; - } - - if ($expressionStarted !== null) { - $tokens[] = ["expression" => $before, "started" => $expressionStarted]; - } else { - $tokens[] = $before; - } - - $tokens[] = $token; - - if (preg_match("#/>$#", $tag)) { - preg_match("#<([a-zA-Z]+)#", $tag, $matchesName); - - $name = $matchesName[1]; - $tokens[] = ["tag" => ""]; - } - - $attributes = []; - - $code = $after; - $length = strlen($code); - $cursor = 0; - - $elementStarted = null; - $elementEnded = null; - - continue; - } - - $cursor++; - } - - $tokens[] = trim($code); - - return $tokens; -} - -function nodes($tokens) { - $nodes = []; - $current = null; - - $cursor = 0; - $length = count($tokens); - - while ($cursor < $length) { - $token =& $tokens[$cursor]; - - if (!is_array($token)) { - $token = ["text" => $token]; - } - - if (isset($token["tag"]) && $token["tag"][1] !== "/") { - preg_match("#^<([a-zA-Z]+)#", $token["tag"], $matches); - - if ($current !== null) { - $token["parent"] =& $current; - $current["children"][] =& $token; - } else { - $token["parent"] = null; - $nodes[] =& $token; - } - - $current =& $token; - $current["name"] = $matches[1]; - $current["children"] = []; - - if (isset($current["attributes"])) { - foreach ($current["attributes"] as $key => $value) { - $current["attributes"][$key] = nodes($value); - } - - $current["attributes"] = array_map(function($item) { - - foreach ($item as $value) { - if (isset($value["tag"])) { - return $value; - } - } - - foreach ($item as $value) { - if (!empty($value["text"])) { - return $value; - } - } - - return null; - - }, $current["attributes"]); - } - } - - else if (isset($token["tag"]) && $token["tag"][1] === "/") { - preg_match("#^ $value) { - if (isset($value["tag"])) { - $attributes["attr_{$key}"] = parse([$value]); - } - else { - $attributes["attr_{$key}"] = $value["text"]; - } - } - } - - preg_match_all("#([a-zA-Z][a-zA-Z-_]+)={([^}]+)}#", $node["tag"], $dynamic); - - if (count($dynamic[0])) { - foreach($dynamic[1] as $key => $value) { - if (!isset($attributes["attr_{$key}"])) { - throw new Exception("attribute not defined"); - } - - $props["{$value}"] = $attributes["attr_{$key}"]; - } - } - - $children = []; - - foreach ($node["children"] as $child) { - if (isset($child["tag"])) { - $children[] = parse([$child]); - } - - else if (isset($child["expression"])) { - $children[] = $child["expression"]; - } - - else { - $children[] = "\"" . addslashes($child["text"]) . "\""; - } - } - - $props["children"] = $children; - - if (function_exists("\\Pre\\Phpx\\Renderer\\__" . $node["name"])) { - $code .= "\\Pre\\Phpx\\Renderer\\__" . $node["name"] . "([" . PHP_EOL; - } - - else { - $name = $node["name"]; - $code .= "(new {$name})->render([" . PHP_EOL; - } - - foreach ($props as $key => $value) { - if ($key === "children") { - $children = array_filter($children, function($child) { - return trim($child, "\"'"); - }); - - $children = array_map("trim", $children); - - $children = array_values($children); - - if (count($children) === 1) { - $code .= "\"children\" => " . $children[0] . "," . PHP_EOL; - } - - else { - $code .= "\"children\" => [" . PHP_EOL; - - foreach ($children as $child) { - $code .= "{$child}," . PHP_EOL; - } - - $code .= "]," . PHP_EOL; - } - - } - - else { - $code .= "\"{$key}\" => {$value}," . PHP_EOL; - } - } - - $code .= "])"; - } - } - - return $code; -} - -function compile($code) { - return parse(nodes(tokens($code))); -} diff --git a/src/renderers.php b/src/renderers.php deleted file mode 100644 index 664acd5..0000000 --- a/src/renderers.php +++ /dev/null @@ -1,1412 +0,0 @@ -"; - $code .= children($props); - - if (!$isSelfClosing) { - $code .= ""; - } - - return $code; -} - -function attribute($code, $props, $key, $alias = null) { - $value = $props[$key] ?? null; - - $use = $alias ?? $key; - - if ($value) { - $code .= " {$use}=\"{$value}\""; - } - - return $code; -} - -function className($props) { - $className = $props["className"] ?? null; - - if (is_callable($className)) { - $className = $className(); - } - - if ($className instanceof Collection) { - $className = $className->toArray(); - } - - if (is_array($className)) { - $combined = ""; - - foreach ($className as $key => $value) { - if (is_string($key)) { - $combined .= !!$value ? " {$key}" : ""; - } - - else { - $combined .= " {$value}"; - } - } - - $className = trim($combined); - } - - return $className; -} - -function style($props) { - $style = $props["style"] ?? null; - - if (is_callable($style)) { - $style = $style(); - } - - if ($style instanceof Collection) { - $style = $style->toArray(); - } - - if (is_array($style)) { - $styles = []; - - foreach ($style as $key => $value) { - $styles[] = "{$key}: {$value}"; - } - - $style = join("; ", $styles); - } - - return $style; -} - -function children($props) { - $children = []; - - if ($props["children"] instanceof Collection) { - $props["children"] = $props["children"]->toArray(); - } - - if (!is_array($props["children"])) { - $props["children"] = [$props["children"]]; - } - - foreach ($props["children"] as $child) { - $children[] = $child; - } - - return trim(join(" ", $children)); -} - -function __attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - foreach ($props as $key => $value) { - $prefix = strtolower(substr($key, 0, 5)); - - if ($prefix === "data-" || $prefix === "aria-") { - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, $key); - } - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onAbort"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onAutoComplete"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onAutoCompleteError"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onBlur"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onCancel"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onCanPlay"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onCanPlayThrough"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onChange"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onClick"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onClose"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onContextMenu"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onCueChange"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDblClick"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDrag"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDragEnd"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDragEnter"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDragExit"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDragLeave"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDragOver"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDragStart"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDrop"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onDurationChange"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onEmptied"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onEnded"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onError"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onFocus"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onInput"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onInvalid"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onKeyDown"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onKeyPress"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onKeyUp"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onLoad"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onLoadedData"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onLoadedMetaData"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onLoadStart"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMouseDown"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMouseEnter"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMouseLeave"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMouseMove"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMouseOut"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMouseOver"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMouseUp"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMouseWheel"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onPause"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onPlay"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onPlaying"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onProgress"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onRateChange"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onReset"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onResize"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onScroll"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onSeeked"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onSeeking"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onSelect"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onShow"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onSort"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onStalled"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onSubmit"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onSuspend"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onTimeUpdate"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onToggle"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onVolumeChange"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onWaiting"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "accessKey"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "contentEditable"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "contextMenu"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "dir"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "hidden"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "id"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "lang"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "tabIndex"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "title"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "translate"); - return $code; -} - -function __a($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("a", $props, "\\Pre\\Phpx\\Renderer\\__a__attributes"); -} - -function __a__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "download"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "href"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "hrefLang"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "rel"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "target"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - - return $code; -} - -function __abbr($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("abbr", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __address($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("address", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __area($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("area", $props, "\\Pre\\Phpx\\Renderer\\__area__attributes"); -} - -function __area__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "alt"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "coords"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "download"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "href"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "hrefLang"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "media"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "rel"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "shape"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "target"); - - return $code; -} - -function __article($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("article", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __aside($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("aside", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __audio($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("audio", $props, "\\Pre\\Phpx\\Renderer\\__audio__attributes"); -} - -function __audio__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoPlay"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoBuffer"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "buffered"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "controls"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "loop"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "muted"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "played"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "preload"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "volume"); - - return $code; -} - -function __b($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("b", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __base($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("base", $props, "\\Pre\\Phpx\\Renderer\\__base__attributes"); -} - -function __base__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "href"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "target"); - - return $code; -} - -function __bdi($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("bdi", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __bdo($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("bdo", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __blockquote($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("blockquote", $props, "\\Pre\\Phpx\\Renderer\\__blockquote__attributes"); -} - -function __blockquote__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "cite"); - - return $code; -} - -function __body($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("body", $props, "\\Pre\\Phpx\\Renderer\\__body__attributes"); -} - -function __body__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onAfterPrint"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onBeforePrint"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onBeforeUnload"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onHashChange"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onMessage"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onOffline"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onOnline"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onPopState"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onRedo"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onResize"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onStorage"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onUndo"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "onUnload"); - - return $code; -} - -function __br($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("br", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __button($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("button", $props, "\\Pre\\Phpx\\Renderer\\__button__attributes"); -} - -function __button__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoFocus"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "disabled"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "form"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formAction"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formEncType"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formMethod"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formNoValidate"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formTarget"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "value"); - - return $code; -} - -function __canvas($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("canvas", $props, "\\Pre\\Phpx\\Renderer\\__canvas__attributes"); -} - -function __canvas__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "height"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "width"); - - return $code; -} - -function __caption($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("caption", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __cite($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("cite", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __code($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("code", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __col($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("col", $props, "\\Pre\\Phpx\\Renderer\\__col__attributes"); -} - -function __col__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "span"); - - return $code; -} - -function __colgroup($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("colgroup", $props, "\\Pre\\Phpx\\Renderer\\__colgroup__attributes"); -} - -function __colgroup__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "span"); - - return $code; -} - -function __data($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("data", $props, "\\Pre\\Phpx\\Renderer\\__data__attributes"); -} - -function __data__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "value"); - - return $code; -} - -function __datalist($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("datalist", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __dd($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("dd", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __del($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("del", $props, "\\Pre\\Phpx\\Renderer\\__del__attributes"); -} - -function __del__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "cite"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "dateTime"); - - return $code; -} - -function __details($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("details", $props, "\\Pre\\Phpx\\Renderer\\__details__attributes"); -} - -function __details__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "open"); - - return $code; -} - -function __dfn($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("dfn", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __div($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("div", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __dl($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("dl", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __dt($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("dt", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __em($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("em", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __embed($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("embed", $props, "\\Pre\\Phpx\\Renderer\\__embed__attributes"); -} - -function __embed__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "height"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "width"); - - return $code; -} - -function __fieldset($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("fieldset", $props, "\\Pre\\Phpx\\Renderer\\__fieldset__attributes"); -} - -function __fieldset__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "disabled"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "form"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - - return $code; -} - -function __figcaption($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("figcaption", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __figure($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("figure", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __footer($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("footer", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __form($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("form", $props, "\\Pre\\Phpx\\Renderer\\__form__attributes"); -} - -function __form__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "acceptCharset", "accept-charset"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "action"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoComplete"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "encType"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "method"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "noValidate"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "target"); - - return $code; -} - -function __h1($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("h1", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __h2($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("h2", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __h3($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("h3", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __h4($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("h4", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __h5($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("h5", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __h6($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("h6", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __head($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("head", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __header($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("header", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __hr($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("hr", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __html($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("html", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __i($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("i", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __iframe($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("iframe", $props, "\\Pre\\Phpx\\Renderer\\__iframe__attributes"); -} - -function __iframe__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "allowFullscreen"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "allowPaymentRequest"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "frameBorder"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "height"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "longDesc"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "marginHeight"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "marginWidth"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "scrolling"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "sandbox"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "srcDoc"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "width"); - - return $code; -} - -function __img($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("img", $props, "\\Pre\\Phpx\\Renderer\\__img__attributes"); -} - -function __img__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "alt"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "crossOrigin"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "height"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "isMap"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "longDesc"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "sizes"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "srcSet"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "width"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "useMap"); - - return $code; -} - -function __input($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("input", $props, "\\Pre\\Phpx\\Renderer\\__input__attributes", true); -} - -function __input__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "accept"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "accessKey"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoComplete"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoFocus"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "capture"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "checked"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "disabled"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "form"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formAction"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formEncType"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formMethod"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formNoValidate"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "formTarget"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "height"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "inputMode"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "list"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "max"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "maxLength"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "min"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "minLength"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "multiple"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "pattern"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "placeholder"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "readOnly"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "required"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "selectionDirection"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "selectionEnd"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "selectionStart"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "size"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "spellCheck"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "step"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "useMap"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "value"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "width"); - - return $code; -} - -function __ins($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("ins", $props, "\\Pre\\Phpx\\Renderer\\__ins__attributes"); -} - -function __ins__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "cite"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "dateTime"); - - return $code; -} - -function __kbd($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("kbd", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __label($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("label", $props, "\\Pre\\Phpx\\Renderer\\__label__attributes"); -} - -function __label__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "for"); - - return $code; -} - -function __legend($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("legend", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __li($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("li", $props, "\\Pre\\Phpx\\Renderer\\__li__attributes"); -} - -function __li__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "value"); - - return $code; -} - -function __link($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("link", $props, "\\Pre\\Phpx\\Renderer\\__link__attributes"); -} - -function __link__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "as"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "crossOrigin"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "href"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "hrefLang"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "media"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "rel"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "sizes"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - - return $code; -} - -function __main($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("main", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __map($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("map", $props, "\\Pre\\Phpx\\Renderer\\__map__attributes"); -} - -function __map__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - - return $code; -} - -function __mark($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("mark", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __meta($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("meta", $props, "\\Pre\\Phpx\\Renderer\\__meta__attributes"); -} - -function __meta__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "charset"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "content"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "httpEquiv", "http-equiv"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - - return $code; -} - -function __meter($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("meter", $props, "\\Pre\\Phpx\\Renderer\\__meter__attributes"); -} - -function __meter__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "value"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "min"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "max"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "low"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "high"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "optimum"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "form"); - - return $code; -} - -function __nav($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("nav", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __noframes($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("noframes", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __noscript($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("noscript", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __object($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("object", $props, "\\Pre\\Phpx\\Renderer\\__object__attributes"); -} - -function __object__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "archive"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "border"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "classId"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "codeBase"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "codeType"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "data"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "declare"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "form"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "height"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "standby"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "typeMustMatch"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "useMap"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "width"); - - return $code; -} - -function __ol($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("ol", $props, "\\Pre\\Phpx\\Renderer\\__ol__attributes"); -} - -function __ol__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "reversed"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "start"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - - return $code; -} - -function __optgroup($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("optgroup", $props, "\\Pre\\Phpx\\Renderer\\__optgroup__attributes"); -} - -function __optgroup__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "disabled"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "label"); - - return $code; -} - -function __option($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("option", $props, "\\Pre\\Phpx\\Renderer\\__option__attributes"); -} - -function __option__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "disabled"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "label"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "selected"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "value"); - - return $code; -} - -function __output($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("output", $props, "\\Pre\\Phpx\\Renderer\\__output__attributes"); -} - -function __output__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "for"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "form"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - - return $code; -} - -function __p($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("p", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __param($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("param", $props, "\\Pre\\Phpx\\Renderer\\__param__attributes"); -} - -function __param__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "value"); - - return $code; -} - -function __pre($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("pre", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __progress($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("progress", $props, "\\Pre\\Phpx\\Renderer\\__progress__attributes"); -} - -function __progress__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "max"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "value"); - - return $code; -} - -function __q($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("q", $props, "\\Pre\\Phpx\\Renderer\\__q__attributes"); -} - -function __q__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "cite"); - - return $code; -} - -function __rp($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("rp", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __rt($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("rt", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __rtc($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("rtc", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __ruby($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("ruby", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __s($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("s", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __samp($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("samp", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __script($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("script", $props, "\\Pre\\Phpx\\Renderer\\__script__attributes"); -} - -function __script__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "async"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "crossOrigin"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "defer"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "integrity"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "text"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - - return $code; -} - -function __section($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("section", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __select($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("select", $props, "\\Pre\\Phpx\\Renderer\\__select__attributes"); -} - -function __select__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoFocus"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "disabled"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "form"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "multiple"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "required"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "size"); - - return $code; -} - -function __slot($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("slot", $props, "\\Pre\\Phpx\\Renderer\\__slot__attributes"); -} - -function __slot__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - - return $code; -} - -function __small($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("small", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __source($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("source", $props, "\\Pre\\Phpx\\Renderer\\__source__attributes"); -} - -function __source__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - - return $code; -} - -function __span($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("span", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __strong($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("strong", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __style($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("style", $props, "\\Pre\\Phpx\\Renderer\\__style__attributes"); -} - -function __style__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "type"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "media"); - - return $code; -} - -function __sub($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("sub", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __summary($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("summary", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __sup($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("sup", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __table($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("table", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __tbody($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("tbody", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __td($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("td", $props, "\\Pre\\Phpx\\Renderer\\__td__attributes"); -} - -function __td__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "colSpan"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "headers"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "rowSpan"); - - return $code; -} - -function __template($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("template", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __textarea($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("textarea", $props, "\\Pre\\Phpx\\Renderer\\__textarea__attributes"); -} - -function __textarea__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoComplete"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoFocus"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "cols"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "disabled"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "form"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "maxLength"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "minLength"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "name"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "placeholder"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "readOnly"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "required"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "rows"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "selectionDirection"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "selectionEnd"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "selectionStart"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "spellCheck"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "wrap"); - - return $code; -} - -function __tfoot($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("tfoot", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __th($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("th", $props, "\\Pre\\Phpx\\Renderer\\__th__attributes"); -} - -function __th__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "colSpan"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "headers"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "rowSpan"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "scope"); - - return $code; -} - -function __thead($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("thead", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __time($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("time", $props, "\\Pre\\Phpx\\Renderer\\__time__attributes"); -} - -function __time__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "dateTime"); - - return $code; -} - -function __title($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("title", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __tr($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("tr", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __track($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("track", $props, "\\Pre\\Phpx\\Renderer\\__track__attributes"); -} - -function __track__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "default"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "kind"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "label"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "srcLang"); - - return $code; -} - -function __u($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("u", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __ul($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("ul", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __var($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("var", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} - -function __video($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("video", $props, "\\Pre\\Phpx\\Renderer\\__video__attributes"); -} - -function __video__attributes($code, $props) { - if (count($props) < 1) { - return $code; - } - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTES"]($code, $props); - - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "autoPlay"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "buffered"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "controls"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "crossOrigin"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "height"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "loop"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "muted"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "played"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "preload"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "poster"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "src"); - $code = $GLOBALS["PRE_PHPX_MEMOIZED_ATTRIBUTE"]($code, $props, "width"); - - return $code; -} - -function __wbr($props) { - return $GLOBALS["PRE_PHPX_MEMOIZED_ELEMENT"]("wbr", $props, "\\Pre\\Phpx\\Renderer\\__attributes"); -} diff --git a/tests/CompileTest.php b/tests/CompileTest.php new file mode 100644 index 0000000..c163491 --- /dev/null +++ b/tests/CompileTest.php @@ -0,0 +1,27 @@ +assertEquals( + $this->fixtureCode("compile/can-compile", "php"), + \Pre\Phpx\compile($this->fixtureCode("compile/can-compile", "pre")) + ); + } + + public function test_supports_nested_component_names() + { + $this->assertEquals( + $this->fixtureCode("compile/supports-nested-component-names", "php"), + \Pre\Phpx\compile($this->fixtureCode("compile/supports-nested-component-names", "pre")) + ); + } +} diff --git a/tests/NodesTest.php b/tests/NodesTest.php new file mode 100644 index 0000000..4cc7e64 --- /dev/null +++ b/tests/NodesTest.php @@ -0,0 +1,40 @@ +assertEquals( + $this->fixtureData("nodes/can-arrange-nodes"), + $this->parser()->nodes($this->parser()->tokens($this->fixtureCode("nodes/can-arrange-nodes"))) + ); + } + + public function test_can_handle_nested_nodes() + { + $this->assertEquals( + $this->fixtureData("nodes/can-handle-nested-nodes"), + $this->parser()->nodes($this->parser()->tokens($this->fixtureCode("nodes/can-handle-nested-nodes"))) + ); + } + + /** + * @expectedException Exception + */ + public function test_can_detect_missing_opening_tag() + { + $this->parser()->nodes($this->parser()->tokens($this->fixtureCode("nodes/can-detect-missing-opening-tag"))); + } + + /** + * @expectedException Exception + */ + public function test_can_detect_different_opening_tag() + { + $this->parser()->nodes($this->parser()->tokens($this->fixtureCode("nodes/can-detect-different-opening-tag"))); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php new file mode 100644 index 0000000..d6c8860 --- /dev/null +++ b/tests/TestCase.php @@ -0,0 +1,21 @@ +assertEquals( + $this->fixtureData("tokens/can-handle-expressions"), + $this->parser()->tokens($this->fixtureCode("tokens/can-handle-expressions")) + ); + } + + public function test_can_ignore_markup_in_string() { + $this->assertEquals( + $this->fixtureData("tokens/can-ignore-markup-in-string"), + $this->parser()->tokens($this->fixtureCode("tokens/can-ignore-markup-in-string")) + ); + } + + public function test_can_handle_simple_props() { + $this->assertEquals( + $this->fixtureData("tokens/can-handle-simple-props"), + $this->parser()->tokens($this->fixtureCode("tokens/can-handle-simple-props")) + ); + } + + public function test_can_handle_complex_props() { + $this->assertEquals( + $this->fixtureData("tokens/can-handle-complex-props"), + $this->parser()->tokens($this->fixtureCode("tokens/can-handle-complex-props")) + ); + } + + public function test_can_handle_self_closing_tags() + { + $this->assertEquals( + $this->fixtureData("tokens/can-handle-self-closing-tags"), + $this->parser()->tokens($this->fixtureCode("tokens/can-handle-self-closing-tags")) + ); + } +} diff --git a/tests/fixtures/compile/can-compile.php b/tests/fixtures/compile/can-compile.php new file mode 100644 index 0000000..914d33c --- /dev/null +++ b/tests/fixtures/compile/can-compile.php @@ -0,0 +1,40 @@ + "outer" . cls("special"), + "render" => function ($error) { + return render("span", [ + "className" => "error", + "children" => $error, + ]); + }, + "children" => [ + render("span", [ + "className" => "icon", + ]), + "You forgot the", + $props->name, + "field", + ], + ]); +} + +function ErrorRenderer($props) +{ + return render("Error", [ + "children" => function ($error) { + return render("span", [ + "children" => $error, + ]); + }, + ]); +} + +function InputRenderer($props) +{ + return render("input", [ + "type" => $props->type, + ]); +} diff --git a/tests/fixtures/compile/can-compile.pre b/tests/fixtures/compile/can-compile.pre new file mode 100644 index 0000000..4dfb7ec --- /dev/null +++ b/tests/fixtures/compile/can-compile.pre @@ -0,0 +1,29 @@ +{$error}; + }} + > + + You forgot the {$props->name} field + + ); +} + +function ErrorRenderer($props) { + return ( + + {function($error) { + return {$error}; + }} + + ); +} + +function InputRenderer($props) { + return type} />; +} diff --git a/tests/fixtures/compile/supports-nested-component-names.php b/tests/fixtures/compile/supports-nested-component-names.php new file mode 100644 index 0000000..ef3afc5 --- /dev/null +++ b/tests/fixtures/compile/supports-nested-component-names.php @@ -0,0 +1,21 @@ + "hello world", + ]); + } +} + +namespace +{ + function render($name, $props = null) + { + print $name; + } + + print render("Example\\MyComponent", []); +} diff --git a/tests/fixtures/compile/supports-nested-component-names.pre b/tests/fixtures/compile/supports-nested-component-names.pre new file mode 100644 index 0000000..c9d5bef --- /dev/null +++ b/tests/fixtures/compile/supports-nested-component-names.pre @@ -0,0 +1,19 @@ +hello world; + } +} + +namespace +{ + function render($name, $props = null) + { + print $name; + } + + print ; +} diff --git a/tests/fixtures/nodes/can-arrange-nodes.php b/tests/fixtures/nodes/can-arrange-nodes.php new file mode 100644 index 0000000..d1de304 --- /dev/null +++ b/tests/fixtures/nodes/can-arrange-nodes.php @@ -0,0 +1,79 @@ + "literal", + "value" => trim(" +function Error(\$props) { + return ( + "), + ], + [ + "type" => "tag", + "value" => "
", + "started" => 61, + "attributes" => [ + [ + [ + "type" => "literal", + "value" => "\$error ⇒", + ], + [ + "type" => "tag", + "value" => "", + "attributes" => [ + [ + [ + "type" => "literal", + "value" => "\"error\"", + ], + ], + ], + "children" => [ + [ + "type" => "expression", + "value" => [ + [ + "type" => "literal", + "value" => "\$error", + ], + ], + "started" => 37, + ], + ], + "name" => "span", + "started" => 30, + ], + ], + ], + "name" => "div", + "children" => [ + [ + "type" => "literal", + "value" => "You forgot the", + "started" => 15, + ], + [ + "type" => "expression", + "value" => [ + [ + "type" => "literal", + "value" => "\$props->name", + ], + ], + "started" => 89, + ], + [ + "type" => "literal", + "value" => "field", + ], + ], + ], + [ + "type" => "literal", + "value" => trim(" + ); +} + "), + ], +]; diff --git a/tests/fixtures/nodes/can-arrange-nodes.txt b/tests/fixtures/nodes/can-arrange-nodes.txt new file mode 100644 index 0000000..f72c827 --- /dev/null +++ b/tests/fixtures/nodes/can-arrange-nodes.txt @@ -0,0 +1,7 @@ +function Error($props) { + return ( +
{$error}}> + You forgot the {$props->name} field +
+ ); +} diff --git a/tests/fixtures/nodes/can-detect-different-opening-tag.txt b/tests/fixtures/nodes/can-detect-different-opening-tag.txt new file mode 100644 index 0000000..7b8c380 --- /dev/null +++ b/tests/fixtures/nodes/can-detect-different-opening-tag.txt @@ -0,0 +1,7 @@ +function Malformed($props) { + return ( +
+ +
+ ); +} diff --git a/tests/fixtures/nodes/can-detect-missing-opening-tag.txt b/tests/fixtures/nodes/can-detect-missing-opening-tag.txt new file mode 100644 index 0000000..aae6d6f --- /dev/null +++ b/tests/fixtures/nodes/can-detect-missing-opening-tag.txt @@ -0,0 +1,3 @@ +function Malformed($props) { + return
; +} diff --git a/tests/fixtures/nodes/can-handle-nested-nodes.php b/tests/fixtures/nodes/can-handle-nested-nodes.php new file mode 100644 index 0000000..bc7955e --- /dev/null +++ b/tests/fixtures/nodes/can-handle-nested-nodes.php @@ -0,0 +1,80 @@ + "literal", + "value" => trim(" +function Label(\$props) { + return ( + "), + ], + [ + "type" => "tag", + "value" => "
", + "started" => 64, + "attributes" => [ + [ + [ + "type" => "literal", + "value" => "\"outer\"", + ], + ], + ], + "name" => "div", + "children" => [ + [ + "type" => "expression", + "value" => [ + [ + "type" => "literal", + "value" => "\$props->prefix", + ], + ], + "started" => 79, + ], + [ + "type" => "tag", + "value" => "
", + "started" => 97, + "attributes" => [ + [ + [ + "type" => "literal", + "value" => "\"inner\"", + ], + ] + ], + "name" => "div", + "children" => [ + [ + "type" => "expression", + "value" => [ + [ + "type" => "literal", + "value" => "\$props->text", + ], + ], + "started" => 110, + ], + ], + ], + [ + "type" => "expression", + "value" => [ + [ + "type" => "literal", + "value" => "\$props->suffix", + ], + ], + "started" => 130, + ], + ], + ], + [ + "type" => "literal", + "value" => trim(" + ); +} + "), + ], +]; diff --git a/tests/fixtures/nodes/can-handle-nested-nodes.txt b/tests/fixtures/nodes/can-handle-nested-nodes.txt new file mode 100644 index 0000000..9b1eafe --- /dev/null +++ b/tests/fixtures/nodes/can-handle-nested-nodes.txt @@ -0,0 +1,11 @@ +function Label($props) { + return ( +
+ {$props->prefix} +
+ {$props->text} +
+ {$props->suffix} +
+ ); +} diff --git a/tests/fixtures/tokens/can-handle-complex-props.php b/tests/fixtures/tokens/can-handle-complex-props.php new file mode 100644 index 0000000..dbaf46d --- /dev/null +++ b/tests/fixtures/tokens/can-handle-complex-props.php @@ -0,0 +1,60 @@ + "literal", + "value" => trim(" +function Hello(\$props) { + return + "), + ], + [ + "type" => "tag", + "value" => "
", + "started" => 54, + "attributes" => [ + [ + [ + "type" => "literal", + "value" => "\$error ⇒", + ], + [ + "type" => "tag", + "value" => "", + "started" => 16, + ], + [ + "type" => "expression", + "value" => [ + [ + "type" => "literal", + "value" => "\$error", + ], + ], + "started" => 23, + ], + [ + "type" => "tag", + "value" => "", + "started" => 29, + ], + ] + ], + ], + [ + "type" => "literal", + "value" => "You forgot a field", + ], + [ + "type" => "tag", + "value" => "
", + "started" => 77, + ], + [ + "type" => "literal", + "value" => trim(" + ; +} + "), + ], +]; diff --git a/tests/fixtures/tokens/can-handle-complex-props.txt b/tests/fixtures/tokens/can-handle-complex-props.txt new file mode 100644 index 0000000..4257b49 --- /dev/null +++ b/tests/fixtures/tokens/can-handle-complex-props.txt @@ -0,0 +1,3 @@ +function Hello($props) { + return
{$error}}>You forgot a field
; +} diff --git a/tests/fixtures/tokens/can-handle-expressions.php b/tests/fixtures/tokens/can-handle-expressions.php new file mode 100644 index 0000000..39dfc23 --- /dev/null +++ b/tests/fixtures/tokens/can-handle-expressions.php @@ -0,0 +1,43 @@ + "literal", + "value" => trim(" +function Hello(\$props) { + return + "), + ], + [ + "type" => "tag", + "value" => "
", + "started" => 40, + ], + [ + "type" => "literal", + "value" => "Hello", + "started" => 6, + ], + [ + "type" => "expression", + "value" => [ + [ + "type" => "literal", + "value" => "\$props->name", + ], + ], + "started" => 59, + ], + [ + "type" => "tag", + "value" => "
", + "started" => 64, + ], + [ + "type" => "literal", + "value" => trim(" + ; +} + "), + ], +]; diff --git a/tests/fixtures/tokens/can-handle-expressions.txt b/tests/fixtures/tokens/can-handle-expressions.txt new file mode 100644 index 0000000..b249b33 --- /dev/null +++ b/tests/fixtures/tokens/can-handle-expressions.txt @@ -0,0 +1,3 @@ +function Hello($props) { + return
Hello {$props->name}
; +} diff --git a/tests/fixtures/tokens/can-handle-self-closing-tags.php b/tests/fixtures/tokens/can-handle-self-closing-tags.php new file mode 100644 index 0000000..1ce0afe --- /dev/null +++ b/tests/fixtures/tokens/can-handle-self-closing-tags.php @@ -0,0 +1,40 @@ + "literal", + "value" => trim(" +function Hello(\$props) { + return + "), + ], + [ + "type" => "tag", + "value" => "
", + "started" => 52, + "attributes" => [ + [ + [ + "type" => "tag", + "value" => "", + "started" => 7, + ], + [ + "type" => "tag", + "value" => "", + ], + ], + ], + ], + [ + "type" => "tag", + "value" => "
", + ], + [ + "type" => "literal", + "value" => trim(" + ; +} + "), + ], +]; diff --git a/tests/fixtures/tokens/can-handle-self-closing-tags.txt b/tests/fixtures/tokens/can-handle-self-closing-tags.txt new file mode 100644 index 0000000..d9f7c0f --- /dev/null +++ b/tests/fixtures/tokens/can-handle-self-closing-tags.txt @@ -0,0 +1,3 @@ +function Hello($props) { + return
} />; +} diff --git a/tests/fixtures/tokens/can-handle-simple-props.php b/tests/fixtures/tokens/can-handle-simple-props.php new file mode 100644 index 0000000..52bdf79 --- /dev/null +++ b/tests/fixtures/tokens/can-handle-simple-props.php @@ -0,0 +1,40 @@ + "literal", + "value" => trim(" +function Hello(\$props) { + return + "), + ], + [ + "type" => "tag", + "value" => "
", + "started" => 54, + "attributes" => [ + [ + [ + "type" => "literal", + "value" => "\"error\"", + ], + ], + ], + ], + [ + "type" => "literal", + "value" => "You forgot a field", + ], + [ + "type" => "tag", + "value" => "
", + "started" => 77, + ], + [ + "type" => "literal", + "value" => trim(" + ; +} + "), + ], +]; diff --git a/tests/fixtures/tokens/can-handle-simple-props.txt b/tests/fixtures/tokens/can-handle-simple-props.txt new file mode 100644 index 0000000..606f734 --- /dev/null +++ b/tests/fixtures/tokens/can-handle-simple-props.txt @@ -0,0 +1,3 @@ +function Hello($props) { + return
You forgot a field
; +} diff --git a/tests/fixtures/tokens/can-ignore-markup-in-string.php b/tests/fixtures/tokens/can-ignore-markup-in-string.php new file mode 100644 index 0000000..87e07b1 --- /dev/null +++ b/tests/fixtures/tokens/can-ignore-markup-in-string.php @@ -0,0 +1,38 @@ + "literal", + "value" => trim(" +function Hello(\$props) { + return + "), + ], + [ + "type" => "tag", + "value" => "
", + "started" => 40, + ], + [ + "type" => "expression", + "value" => [ + [ + "type" => "literal", + "value" => "\"
this div should show
\"", + ], + ], + "started" => 74, + ], + [ + "type" => "tag", + "value" => "
", + "started" => 79, + ], + [ + "type" => "literal", + "value" => trim(" + ; +} + "), + ], +]; diff --git a/tests/fixtures/tokens/can-ignore-markup-in-string.txt b/tests/fixtures/tokens/can-ignore-markup-in-string.txt new file mode 100644 index 0000000..5627db5 --- /dev/null +++ b/tests/fixtures/tokens/can-ignore-markup-in-string.txt @@ -0,0 +1,3 @@ +function Hello($props) { + return
{"
this div should show
"}
; +}