From 94658add52b3c056687ed00f9c6c2a79468b2abf Mon Sep 17 00:00:00 2001 From: Greg Bowler Date: Sun, 4 Sep 2016 22:47:25 +0100 Subject: [PATCH] reset repo for v3 development --- .coveralls.yml | 3 - .gitignore | 10 +- .travis.yml | 18 - License => LICENCE | 0 NOTICE | 6 +- ReadMe.md => README.md | 26 +- bin/create | 45 - bin/gt-create | 5 + bin/gt-deploy | 6 + bin/gt-install | 7 + bin/gt-release | 5 + bin/gt-serve | 7 + bin/gt-test | 9 + bin/install | 126 - bin/serve | 87 - bin/test | 85 - circle.yml | 3 +- composer.json | 30 +- composer.lock | 2311 ----------------- default.ini | 30 - src/Api/Api.php | 85 - src/Api/Component.php | 71 - src/Api/Endpoint.php | 174 -- src/Api/InvalidLogicTypeException.php | 11 - src/Api/InvalidScriptTypeException.php | 11 - src/Api/Logic.php | 17 - src/Api/LogicNotFoundException.php | 11 - src/Api/Payload.php | 15 - src/Cli/Gatekeeper.php | 43 - src/Cli/Gateway.php | 80 - src/Cli/InvalidContextException.php | 15 - src/Cli/InvalidTestRunnerTypeException.php | 10 - src/Cli/Process.php | 65 - src/Cli/ProcessFailedException.php | 9 - src/Cli/Server.php | 67 - src/Cli/TestRunner.php | 161 -- src/ClientSide/Compiler.php | 61 - src/ClientSide/CompilerParseException.php | 11 - src/ClientSide/FileOrganiser.php | 314 --- src/ClientSide/Manifest.php | 27 - src/ClientSide/Minifier.php | 28 - src/ClientSide/PageManifest.php | 186 -- src/ClientSide/PathDetails.php | 199 -- src/Core/Config.php | 67 - src/Core/ConfigObj.php | 31 - src/Core/DirectoryRecursor.php | 131 - src/Core/Exception/GtException.php | 14 - src/Core/Exception/InvalidAccessException.php | 13 - .../InvalidArgumentTypeException.php | 11 - .../Exception/NotImplementedException.php | 11 - .../RequiredAppResourceNotFoundException.php | 11 - .../Exception/UndefinedVariableException.php | 11 - src/Core/Logger.php | 41 - src/Core/Obj.php | 53 - src/Core/Path.php | 213 -- src/Core/Start.php | 147 -- src/Data/Data.php | 35 - src/Data/DataSourceNotFoundException.php | 11 - src/Data/InvalidFilterKeyException.php | 11 - src/Data/Source.php | 45 - src/Data/Source/Csv.php | 31 - src/Data/Source/Csv/CsvSource.php | 48 - src/Data/Source/Csv/CsvStore.php | 30 - src/Data/Source/Sql.php | 0 src/Data/Store.php | 18 - src/Data/Store/Csv.php | 12 - src/Dispatcher/ApiDispatcher.php | 50 - src/Dispatcher/Dispatcher.php | 315 --- src/Dispatcher/DispatcherFactory.php | 56 - src/Dispatcher/PageDispatcher.php | 259 -- src/Dom/Document.php | 335 --- src/Dom/InvalidNodePropertyException.php | 11 - src/Dom/InvalidNodeTypeException.php | 11 - src/Dom/Node.php | 556 ---- src/Dom/NodeList.php | 132 - src/Dom/NodeMethodNotDefinedException.php | 11 - src/Dom/TokenList.php | 153 -- src/Logic/ApiLogic.php | 11 - src/Logic/Logic.php | 56 - src/Logic/LogicFactory.php | 123 - src/Logic/PageLogic.php | 39 - src/Page/Logic.php | 17 - src/Page/SourceNotValidException.php | 11 - src/Page/TemplateFactory.php | 78 - src/Page/Transformer.php | 100 - src/Request/HeaderList.php | 135 - src/Request/InvalidRequestTypeException.php | 10 - src/Request/Request.php | 70 - src/Request/Standardiser.php | 179 -- src/Response/Headers.php | 128 - src/Response/HeadersAlreadySentException.php | 13 - src/Response/NotFoundException.php | 17 - src/Response/PageResponse.php | 12 - src/Response/Redirect.php | 55 - src/Response/Response.php | 46 - src/Response/ResponseCode.php | 172 -- src/Response/ResponseContent.php | 42 - src/Session/Session.php | 177 -- src/Session/SessionStoreNotFoundException.php | 11 - src/Session/Store.php | 34 - src/StructuredData/Component.php | 14 - src/StructuredData/Container.php | 25 - 102 files changed, 64 insertions(+), 8885 deletions(-) delete mode 100644 .coveralls.yml delete mode 100644 .travis.yml rename License => LICENCE (100%) rename ReadMe.md => README.md (88%) delete mode 100755 bin/create create mode 100755 bin/gt-create create mode 100644 bin/gt-deploy create mode 100755 bin/gt-install create mode 100644 bin/gt-release create mode 100755 bin/gt-serve create mode 100755 bin/gt-test delete mode 100755 bin/install delete mode 100755 bin/serve delete mode 100755 bin/test delete mode 100644 composer.lock delete mode 100644 default.ini delete mode 100644 src/Api/Api.php delete mode 100644 src/Api/Component.php delete mode 100644 src/Api/Endpoint.php delete mode 100644 src/Api/InvalidLogicTypeException.php delete mode 100644 src/Api/InvalidScriptTypeException.php delete mode 100644 src/Api/Logic.php delete mode 100644 src/Api/LogicNotFoundException.php delete mode 100644 src/Api/Payload.php delete mode 100644 src/Cli/Gatekeeper.php delete mode 100644 src/Cli/Gateway.php delete mode 100644 src/Cli/InvalidContextException.php delete mode 100644 src/Cli/InvalidTestRunnerTypeException.php delete mode 100644 src/Cli/Process.php delete mode 100644 src/Cli/ProcessFailedException.php delete mode 100644 src/Cli/Server.php delete mode 100644 src/Cli/TestRunner.php delete mode 100644 src/ClientSide/Compiler.php delete mode 100644 src/ClientSide/CompilerParseException.php delete mode 100644 src/ClientSide/FileOrganiser.php delete mode 100644 src/ClientSide/Manifest.php delete mode 100644 src/ClientSide/Minifier.php delete mode 100644 src/ClientSide/PageManifest.php delete mode 100644 src/ClientSide/PathDetails.php delete mode 100644 src/Core/Config.php delete mode 100644 src/Core/ConfigObj.php delete mode 100644 src/Core/DirectoryRecursor.php delete mode 100644 src/Core/Exception/GtException.php delete mode 100644 src/Core/Exception/InvalidAccessException.php delete mode 100644 src/Core/Exception/InvalidArgumentTypeException.php delete mode 100644 src/Core/Exception/NotImplementedException.php delete mode 100644 src/Core/Exception/RequiredAppResourceNotFoundException.php delete mode 100644 src/Core/Exception/UndefinedVariableException.php delete mode 100644 src/Core/Logger.php delete mode 100644 src/Core/Obj.php delete mode 100644 src/Core/Path.php delete mode 100644 src/Core/Start.php delete mode 100644 src/Data/Data.php delete mode 100644 src/Data/DataSourceNotFoundException.php delete mode 100644 src/Data/InvalidFilterKeyException.php delete mode 100644 src/Data/Source.php delete mode 100644 src/Data/Source/Csv.php delete mode 100644 src/Data/Source/Csv/CsvSource.php delete mode 100644 src/Data/Source/Csv/CsvStore.php delete mode 100644 src/Data/Source/Sql.php delete mode 100644 src/Data/Store.php delete mode 100644 src/Data/Store/Csv.php delete mode 100644 src/Dispatcher/ApiDispatcher.php delete mode 100644 src/Dispatcher/Dispatcher.php delete mode 100644 src/Dispatcher/DispatcherFactory.php delete mode 100644 src/Dispatcher/PageDispatcher.php delete mode 100644 src/Dom/Document.php delete mode 100644 src/Dom/InvalidNodePropertyException.php delete mode 100644 src/Dom/InvalidNodeTypeException.php delete mode 100644 src/Dom/Node.php delete mode 100644 src/Dom/NodeList.php delete mode 100644 src/Dom/NodeMethodNotDefinedException.php delete mode 100644 src/Dom/TokenList.php delete mode 100644 src/Logic/ApiLogic.php delete mode 100644 src/Logic/Logic.php delete mode 100644 src/Logic/LogicFactory.php delete mode 100644 src/Logic/PageLogic.php delete mode 100644 src/Page/Logic.php delete mode 100644 src/Page/SourceNotValidException.php delete mode 100644 src/Page/TemplateFactory.php delete mode 100644 src/Page/Transformer.php delete mode 100644 src/Request/HeaderList.php delete mode 100644 src/Request/InvalidRequestTypeException.php delete mode 100644 src/Request/Request.php delete mode 100644 src/Request/Standardiser.php delete mode 100644 src/Response/Headers.php delete mode 100644 src/Response/HeadersAlreadySentException.php delete mode 100644 src/Response/NotFoundException.php delete mode 100644 src/Response/PageResponse.php delete mode 100644 src/Response/Redirect.php delete mode 100644 src/Response/Response.php delete mode 100644 src/Response/ResponseCode.php delete mode 100644 src/Response/ResponseContent.php delete mode 100644 src/Session/Session.php delete mode 100644 src/Session/SessionStoreNotFoundException.php delete mode 100644 src/Session/Store.php delete mode 100644 src/StructuredData/Component.php delete mode 100644 src/StructuredData/Container.php diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index acc2e826..00000000 --- a/.coveralls.yml +++ /dev/null @@ -1,3 +0,0 @@ -service_name: travis-ci -coverage_clover: "test/Unit/phpunit.output.clover.xml" -json_path: "coveralls-upload.json" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 07a036be..035a8bd0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,3 @@ -*.sublime-project -*.sublime-workspace -composer.phar -vendor/* -test/Unit/_Report/* -test/Unit/phpunit.output* -/.project +/*.sublime-* +/composer.phar +/vendor \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d67c2c52..00000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: php -php: - - 5.6 - - 5.5 - - 5.4 -install: "./bin/install" - -after_script: - - php ~/.gt/PHP.Gt/vendor/bin/coveralls - -script: ~/.gt/PHP.Gt/test/run - -notifications: - email: - recipients: - - mailbot@brightflair.com - on_success: always - on_failure: always \ No newline at end of file diff --git a/License b/LICENCE similarity index 100% rename from License rename to LICENCE diff --git a/NOTICE b/NOTICE index f8c34df6..5247f8da 100644 --- a/NOTICE +++ b/NOTICE @@ -3,7 +3,7 @@ PHP.Gt is created and maintained by Bright Flair Ltd (https://brightflair.com). The software is covered by the [MIT license](http://choosealicense.com/licenses/mit/), which in summary means: -+ Software containing PHP.Gt may be used commercially. ++ Software containing PHP.Gt software may be used commercially. + PHP.Gt may be redistributed (with proper attribution). + PHP.Gt can be used for any purpose whatsoever. + Modification of original source is allowed (with proper attribution). @@ -11,8 +11,4 @@ which in summary means: + Original license and copyright notice must be clearly visible in derived projects. + Any use of PHP.Gt requires proper attribution and comes without warranty. -Applications that are built on top of PHP.Gt, are not permitted to use the PHP.Gt name. To -indicate that they are using PHP.Gt, they are permitted but not required to use the .Gt -suffix after the application's own name. - For more information about the PHP.Gt project, visit the website: https://www.php.gt diff --git a/ReadMe.md b/README.md similarity index 88% rename from ReadMe.md rename to README.md index 1eab20a9..a64bf046 100644 --- a/ReadMe.md +++ b/README.md @@ -26,14 +26,14 @@ PHP frameworks offer many features, but often come with steep learning curves or PHP.Gt Website - + PHP.Gt Roadmap -Current project status -====================== +Current project status. +======================= -View the detailed [project roadmap on Trello](https://trello.com/b/zbfqGWbH/php-gt-public-roadmap) to see what's coming up, and what's made its way into recent releases. +View the detailed [project roadmap on Trello](https://php.gt/trello) to see what's coming up, and what's made its way into recent releases. The most important changes are: @@ -41,8 +41,8 @@ The most important changes are: + Gaining full PHP 7 support. + Full code coverage. -Features at a glance --------------------- +Features at a glance. +--------------------- + Pages made dynamic via server-side DOM Document access. + HTML templating. @@ -54,25 +54,25 @@ Features at a glance + Preconfigured PHPUnit and Behat test environment. + Workflow tools to quickly create, integrate and deploy projects. -Essential concepts ------------------- +Essential concepts. +------------------- -### Static first +### Static first. To lower the barrier of entry to web development, the technique of developing a static prototype first is promoted, dropping in logic when and where necessary to turn prototypes into fully functional production code with as few steps as possible. -### Build using tech you already know +### Build using tech you already know. The main idea is to provide a platform where you can get as much done, using standard tech you've already learnt. Technologies that make up the [world wide web](https://en.wikipedia.org/wiki/World_Wide_Web), such as HTML and HTTP, are respected and enhanced by bringing useful tools and techniques to you, the developer. -### Drop in tools without any fuss +### Drop in tools without any fuss. There are a lot of useful tools included as standard, such as [SCSS parsing](https://github.com/phpgt/webengine/wiki/Client-side-files), [HTML templating](https://github.com/phpgt/webengine/wiki/Templating) and [CSRF handling](https://github.com/phpgt/webengine/wiki/CSRF), but the highly modularised architecture keeps compatibility high. Packages from [Packagist](https://packagist.org) can be installed and loaded with zero configuration. -### Develop locally or virtually +### Develop locally or virtually. Preconfigured scripts are available to automatically set up local servers or virtualisation environments to get you going as quickly as possible, without having to change existing computer configuration. -### Community of blueprints +### Community of blueprints. To get projects going with full momentum, blueprint projects are available to base your projects off. Blueprints come with just enough level of design and functionality to get a prototype out the door as quickly as possible, without prescribing anything. diff --git a/bin/create b/bin/create deleted file mode 100755 index 891d465e..00000000 --- a/bin/create +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env php -getArgument("approot"); - // mkdir($projectName); - exec("git clone https://github.com/BrightFlair/blueprint-empty " - . $projectName); - chdir($projectName); - exec("rm -rf .git"); - passthru("~/.gt/composer.phar update"); - $pwd = getcwd(); - - // Create new project with PHP.Gt in composer.json - // Install via composer. - - echo "\nNew project $projectName created in $pwd\n\n"; - exit(0); -} -catch(Exception $e) { - echo "\ncreate shell script usage:\n"; - echo $definition->getSynopsis(); - echo "\n\n"; - echo strip_tags($definition->asText()); - echo "\n"; - exit(1); -} diff --git a/bin/gt-create b/bin/gt-create new file mode 100755 index 00000000..b5ede09c --- /dev/null +++ b/bin/gt-create @@ -0,0 +1,5 @@ +#!/usr/bin/env php +isDot()) { - continue; - } - - $filename = $item->getFilename(); - $pathname = $item->getPathname(); - $linkname = "$gtBinDir/gt-$filename"; - - if(file_exists($linkname)) { - unlink($linkname); - } - - symlink($pathname, $linkname); -} - -$bashLoadScript = "$HOME/.bashrc"; -$bashExisting = ""; -if(file_exists($bashLoadScript)) { - $bashExisting = file_get_contents($bashLoadScript); -} -if(!strstr($bashExisting, "#gt")) { - // TODO: Remove existing gt snippet rather than ignoring completely. - // Add gtBinDir to path. - $bash = << $cwd, - "port" => 8080, - "xdebug" => "none", -]; - -$definition = new InputDefinition([ - new InputArgument("approot", InputArgument::OPTIONAL), - new InputOption("approot", "a", InputOption::VALUE_OPTIONAL, - "Application root directory", $defaults["approot"]), - new InputOption("port", "p", InputOption::VALUE_OPTIONAL, - "Port to bind webserver to", $defaults["port"]), - new InputOption("xdebug", "x", InputOption::VALUE_OPTIONAL, - "IDEKey to set XDebug to", $defaults["xdebug"]), -]); - -try { - $input = new ArgvInput($argv, $definition); - $approot = $input->getOption("approot"); - $overrideApproot = $input->getArgument("approot"); - if(!is_null($overrideApproot)) { - $approot = "$approot/$overrideApproot"; - } - - $xdebug = $input->getOption("xdebug"); - ini_set("xdebug.idekey", $xdebug); - - new Server($input); - exit(0); -} -catch(Exception $e) { - echo "\nserver shell script usage:\n"; - echo $definition->getSynopsis(); - echo "\n\n"; - echo strip_tags($definition->asText()); - echo "\n"; - exit(1); -} diff --git a/bin/test b/bin/test deleted file mode 100755 index 4f7837bc..00000000 --- a/bin/test +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env php - $cwd, - "type" => "all", -]; - -$definition = new InputDefinition([ - new InputArgument("approot", InputArgument::OPTIONAL), - new InputOption("approot", "a", InputOption::VALUE_OPTIONAL, - "Application root directory", $defaults["approot"]), - - new InputArgument("type", InputArgument::OPTIONAL), - new InputOption("type", "t", InputOption::VALUE_OPTIONAL, - "Type of test to run", $defaults["type"]), -]); - -try { - $input = new ArgvInput($argv, $definition); - $approot = $input->getOption("approot"); - $type = $input->getOption("type"); - - new TestRunner($approot, $type); - exit(0); -} -catch(Exception $e) { - if($e instanceof \Gt\Cli\InvalidTestRunnerTypeException) { - echo "\nINVALID TYPE: " . $e->getMessage() . "\n"; - } - echo "\nstest shell script usage:\n"; - echo $definition->getSynopsis(); - echo "\n\n"; - echo strip_tags($definition->asText()); - echo "\n"; - exit(1); -} diff --git a/circle.yml b/circle.yml index 6c465817..6cd13842 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,7 @@ machine: php: version: 7.0.7 + test: override: - - ./test/run \ No newline at end of file + - /bin/test \ No newline at end of file diff --git a/composer.json b/composer.json index acf80a91..827dbade 100644 --- a/composer.json +++ b/composer.json @@ -16,42 +16,24 @@ }, "bin": [ - "bin/serve", - "bin/test" + "bin/gt-create", + "bin/gt-serve", + "bin/gt-test", + "bin/gt-deploy", + "bin/gt-release" ], "require": { - "symfony/css-selector": "2.3.28", - "symfony/console": "2.5.*", - "leafo/scssphp": "0.3.*", - "katzgrau/klogger": "1.0.*", - "matthiasmullie/minify": "1.3.*", - "michelf/php-markdown": "1.4.1", - "g105b/phpcsv": "1.*", - "satooshi/php-coveralls": "0.6.*", - - "phpunit/phpunit": "4.1.*", - - "behat/behat": "2.*@stable", - "behat/mink": "@stable", - "behat/mink-extension": "@stable", - "behat/mink-goutte-driver": "@stable", - "fabpot/goutte": "1.*@stable" }, "keywords": [ "php", "phpgt", + "php.gt", "gt", - "web", "application", "framework", - "dom", "webservice", "service", - "sass", - "database", - "sql", - "mysql" ] } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index f97730c7..00000000 --- a/composer.lock +++ /dev/null @@ -1,2311 +0,0 @@ -{ - "_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", - "This file is @generated automatically" - ], - "hash": "35ab21a8da6eb8c704bfc9866cad08ba", - "content-hash": "b9129c8a163420f8a68ea49b5252b63f", - "packages": [ - { - "name": "behat/behat", - "version": "v2.5.5", - "source": { - "type": "git", - "url": "https://github.com/Behat/Behat.git", - "reference": "c1e48826b84669c97a1efa78459aedfdcdcf2120" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Behat/zipball/c1e48826b84669c97a1efa78459aedfdcdcf2120", - "reference": "c1e48826b84669c97a1efa78459aedfdcdcf2120", - "shasum": "" - }, - "require": { - "behat/gherkin": "~2.3.0", - "php": ">=5.3.1", - "symfony/config": "~2.3", - "symfony/console": "~2.0", - "symfony/dependency-injection": "~2.0", - "symfony/event-dispatcher": "~2.0", - "symfony/finder": "~2.0", - "symfony/translation": "~2.3", - "symfony/yaml": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~3.7.19" - }, - "suggest": { - "behat/mink-extension": "for integration with Mink testing framework", - "behat/symfony2-extension": "for integration with Symfony2 web framework", - "behat/yii-extension": "for integration with Yii web framework" - }, - "bin": [ - "bin/behat" - ], - "type": "library", - "autoload": { - "psr-0": { - "Behat\\Behat": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Scenario-oriented BDD framework for PHP 5.3", - "homepage": "http://behat.org/", - "keywords": [ - "BDD", - "Behat", - "Symfony2" - ], - "time": "2015-06-01 09:37:55" - }, - { - "name": "behat/gherkin", - "version": "v2.3.5", - "source": { - "type": "git", - "url": "https://github.com/Behat/Gherkin.git", - "reference": "2b33963da5525400573560c173ab5c9c057e1852" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Gherkin/zipball/2b33963da5525400573560c173ab5c9c057e1852", - "reference": "2b33963da5525400573560c173ab5c9c057e1852", - "shasum": "" - }, - "require": { - "php": ">=5.3.1", - "symfony/finder": "~2.0" - }, - "require-dev": { - "symfony/config": "~2.0", - "symfony/translation": "~2.0", - "symfony/yaml": "~2.0" - }, - "suggest": { - "symfony/config": "If you want to use Config component to manage resources", - "symfony/translation": "If you want to use Symfony2 translations adapter", - "symfony/yaml": "If you want to parse features, represented in YAML files" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "2.2-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Gherkin": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Gherkin DSL parser for PHP 5.3", - "homepage": "http://behat.org/", - "keywords": [ - "BDD", - "Behat", - "DSL", - "Symfony2", - "parser" - ], - "time": "2013-10-15 11:22:17" - }, - { - "name": "behat/mink", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/minkphp/Mink.git", - "reference": "6c129030ec2cc029905cf969a56ca8f087b2dfdf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/minkphp/Mink/zipball/6c129030ec2cc029905cf969a56ca8f087b2dfdf", - "reference": "6c129030ec2cc029905cf969a56ca8f087b2dfdf", - "shasum": "" - }, - "require": { - "php": ">=5.3.1", - "symfony/css-selector": "~2.1" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "suggest": { - "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", - "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", - "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", - "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-4": { - "Behat\\Mink\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Browser controller/emulator abstraction for PHP", - "homepage": "http://mink.behat.org/", - "keywords": [ - "browser", - "testing", - "web" - ], - "time": "2015-09-20 20:24:03" - }, - { - "name": "behat/mink-browserkit-driver", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/minkphp/MinkBrowserKitDriver.git", - "reference": "da47df1593dac132f04d24e7277ef40d33d9f201" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/da47df1593dac132f04d24e7277ef40d33d9f201", - "reference": "da47df1593dac132f04d24e7277ef40d33d9f201", - "shasum": "" - }, - "require": { - "behat/mink": "~1.7@dev", - "php": ">=5.3.6", - "symfony/browser-kit": "~2.3", - "symfony/dom-crawler": "~2.3" - }, - "require-dev": { - "silex/silex": "~1.2", - "symfony/phpunit-bridge": "~2.7" - }, - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Behat\\Mink\\Driver\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Symfony2 BrowserKit driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "Mink", - "Symfony2", - "browser", - "testing" - ], - "time": "2015-09-21 20:56:13" - }, - { - "name": "behat/mink-extension", - "version": "v1.3.3", - "source": { - "type": "git", - "url": "https://github.com/Behat/MinkExtension.git", - "reference": "b885b9407cba50a954f72c69ed1b2f8d3bc694f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/b885b9407cba50a954f72c69ed1b2f8d3bc694f8", - "reference": "b885b9407cba50a954f72c69ed1b2f8d3bc694f8", - "shasum": "" - }, - "require": { - "behat/behat": "~2.5.0", - "behat/mink": "~1.5", - "php": ">=5.3.2", - "symfony/config": "~2.2" - }, - "require-dev": { - "behat/mink-goutte-driver": "~1.0", - "fabpot/goutte": "~1.0" - }, - "type": "behat-extension", - "autoload": { - "psr-0": { - "Behat\\MinkExtension": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Mink extension for Behat", - "homepage": "http://mink.behat.org", - "keywords": [ - "browser", - "gui", - "test", - "web" - ], - "time": "2014-05-15 19:27:39" - }, - { - "name": "behat/mink-goutte-driver", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/minkphp/MinkGoutteDriver.git", - "reference": "c8e254f127d6f2242b994afd4339fb62d471df3f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkGoutteDriver/zipball/c8e254f127d6f2242b994afd4339fb62d471df3f", - "reference": "c8e254f127d6f2242b994afd4339fb62d471df3f", - "shasum": "" - }, - "require": { - "behat/mink": "~1.6@dev", - "behat/mink-browserkit-driver": "~1.2@dev", - "fabpot/goutte": "~1.0.4|~2.0|~3.1", - "php": ">=5.3.1" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Behat\\Mink\\Driver\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Goutte driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "browser", - "goutte", - "headless", - "testing" - ], - "time": "2015-09-21 21:31:11" - }, - { - "name": "fabpot/goutte", - "version": "v1.0.7", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/Goutte.git", - "reference": "794b196e76bdd37b5155cdecbad311f0a3b07625" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/Goutte/zipball/794b196e76bdd37b5155cdecbad311f0a3b07625", - "reference": "794b196e76bdd37b5155cdecbad311f0a3b07625", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "guzzle/http": "~3.1", - "php": ">=5.3.0", - "symfony/browser-kit": "~2.1", - "symfony/css-selector": "~2.1", - "symfony/dom-crawler": "~2.1", - "symfony/finder": "~2.1", - "symfony/process": "~2.1" - }, - "require-dev": { - "guzzle/plugin-history": "~3.1", - "guzzle/plugin-mock": "~3.1" - }, - "type": "application", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Goutte": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "A simple PHP Web Scraper", - "homepage": "https://github.com/fabpot/Goutte", - "keywords": [ - "scraper" - ], - "time": "2014-10-09 15:52:51" - }, - { - "name": "g105b/phpcsv", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/g105b/phpcsv.git", - "reference": "790227e3f4d89f3bf8e84384a5a341922103eb68" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/g105b/phpcsv/zipball/790227e3f4d89f3bf8e84384a5a341922103eb68", - "reference": "790227e3f4d89f3bf8e84384a5a341922103eb68", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.5.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "g105b\\phpcsv\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Wraps SplFileObject's CSV capabilities with a more human approach", - "keywords": [ - "csv", - "database", - "export", - "filter", - "import", - "iterate", - "read", - "write" - ], - "time": "2015-05-12 08:48:59" - }, - { - "name": "guzzle/guzzle", - "version": "v3.9.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle3.git", - "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", - "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.3.3", - "symfony/event-dispatcher": "~2.1" - }, - "replace": { - "guzzle/batch": "self.version", - "guzzle/cache": "self.version", - "guzzle/common": "self.version", - "guzzle/http": "self.version", - "guzzle/inflection": "self.version", - "guzzle/iterator": "self.version", - "guzzle/log": "self.version", - "guzzle/parser": "self.version", - "guzzle/plugin": "self.version", - "guzzle/plugin-async": "self.version", - "guzzle/plugin-backoff": "self.version", - "guzzle/plugin-cache": "self.version", - "guzzle/plugin-cookie": "self.version", - "guzzle/plugin-curlauth": "self.version", - "guzzle/plugin-error-response": "self.version", - "guzzle/plugin-history": "self.version", - "guzzle/plugin-log": "self.version", - "guzzle/plugin-md5": "self.version", - "guzzle/plugin-mock": "self.version", - "guzzle/plugin-oauth": "self.version", - "guzzle/service": "self.version", - "guzzle/stream": "self.version" - }, - "require-dev": { - "doctrine/cache": "~1.3", - "monolog/monolog": "~1.0", - "phpunit/phpunit": "3.7.*", - "psr/log": "~1.0", - "symfony/class-loader": "~2.1", - "zendframework/zend-cache": "2.*,<2.3", - "zendframework/zend-log": "2.*,<2.3" - }, - "suggest": { - "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.9-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle": "src/", - "Guzzle\\Tests": "tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Guzzle Community", - "homepage": "https://github.com/guzzle/guzzle/contributors" - } - ], - "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2015-03-18 18:23:50" - }, - { - "name": "katzgrau/klogger", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/katzgrau/klogger.git", - "reference": "46cdd92a9b4a8443120cc955bf831450cb274813" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/katzgrau/klogger/zipball/46cdd92a9b4a8443120cc955bf831450cb274813", - "reference": "46cdd92a9b4a8443120cc955bf831450cb274813", - "shasum": "" - }, - "require": { - "php": ">=5.3", - "psr/log": "1.0.0" - }, - "require-dev": { - "phpunit/phpunit": "4.0.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "Katzgrau\\KLogger\\": "src/" - }, - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dan Horrigan", - "email": "dan@dhorrigan.com", - "homepage": "http://dhorrigan.com", - "role": "Lead Developer" - }, - { - "name": "Kenny Katzgrau", - "email": "katzgrau@gmail.com" - } - ], - "description": "A Simple Logging Class", - "keywords": [ - "logging" - ], - "time": "2014-03-20 02:36:36" - }, - { - "name": "leafo/scssphp", - "version": "v0.3.1", - "source": { - "type": "git", - "url": "https://github.com/leafo/scssphp.git", - "reference": "2977aa444415787e931c048989b8c9195fd5b344" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/leafo/scssphp/zipball/2977aa444415787e931c048989b8c9195fd5b344", - "reference": "2977aa444415787e931c048989b8c9195fd5b344", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "kherge/box": "~2.5", - "phpunit/phpunit": "~3.7", - "squizlabs/php_codesniffer": "~2.3" - }, - "bin": [ - "bin/pscss" - ], - "type": "library", - "autoload": { - "classmap": [ - "classmap.php" - ], - "psr-4": { - "Leafo\\ScssPhp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Leaf Corcoran", - "email": "leafot@gmail.com", - "homepage": "http://leafo.net" - } - ], - "description": "scssphp is a compiler for SCSS written in PHP.", - "homepage": "http://leafo.github.io/scssphp/", - "keywords": [ - "css", - "less", - "sass", - "scss", - "stylesheet" - ], - "time": "2015-09-12 01:42:27" - }, - { - "name": "matthiasmullie/minify", - "version": "1.3.28", - "source": { - "type": "git", - "url": "https://github.com/matthiasmullie/minify.git", - "reference": "2cee2544198d97bca4ba094bc2df27d6458da1af" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/2cee2544198d97bca4ba094bc2df27d6458da1af", - "reference": "2cee2544198d97bca4ba094bc2df27d6458da1af", - "shasum": "" - }, - "require": { - "ext-pcre": "*", - "matthiasmullie/path-converter": "~1.0", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.3.*", - "satooshi/php-coveralls": "dev-master", - "scrapbook/psr-cache": "~0.2" - }, - "bin": [ - "bin/minifycss", - "bin/minifyjs" - ], - "type": "library", - "autoload": { - "psr-4": { - "MatthiasMullie\\Minify\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matthias Mullie", - "email": "minify@mullie.eu", - "homepage": "http://www.mullie.eu", - "role": "Developer" - } - ], - "description": "CSS & JS minifier", - "homepage": "http://www.minifier.org", - "keywords": [ - "JS", - "css", - "javascript", - "minifier", - "minify" - ], - "time": "2015-08-20 14:49:37" - }, - { - "name": "matthiasmullie/path-converter", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/matthiasmullie/path-converter.git", - "reference": "b1e31c51e8c207ad6114f5b4ac4e652bc936c380" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/b1e31c51e8c207ad6114f5b4ac4e652bc936c380", - "reference": "b1e31c51e8c207ad6114f5b4ac4e652bc936c380", - "shasum": "" - }, - "require": { - "ext-pcre": "*", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.3.*", - "satooshi/php-coveralls": "dev-master" - }, - "type": "library", - "autoload": { - "psr-4": { - "MatthiasMullie\\PathConverter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matthias Mullie", - "email": "pathconverter@mullie.eu", - "homepage": "http://www.mullie.eu", - "role": "Developer" - } - ], - "description": "Relative path converter", - "homepage": "http://github.com/matthiasmullie/path-converter", - "keywords": [ - "converter", - "path", - "paths", - "relative" - ], - "time": "2015-06-01 15:20:30" - }, - { - "name": "michelf/php-markdown", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/michelf/php-markdown.git", - "reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/de9a19c7bf352d41cc99ed86c3c0ef17e87394b6", - "reference": "de9a19c7bf352d41cc99ed86c3c0ef17e87394b6", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-lib": "1.4.x-dev" - } - }, - "autoload": { - "psr-0": { - "Michelf": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Michel Fortin", - "email": "michel.fortin@michelf.ca", - "homepage": "http://michelf.ca/", - "role": "Developer" - }, - { - "name": "John Gruber", - "homepage": "http://daringfireball.net/" - } - ], - "description": "PHP Markdown", - "homepage": "http://michelf.ca/projects/php-markdown/", - "keywords": [ - "markdown" - ], - "time": "2014-05-05 02:43:50" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", - "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.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": "2015-09-14 06:51:16" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.3.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "File/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "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": "2013-10-10 15:34:57" - }, - { - "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": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21 13:50:34" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2015-06-21 08:01:12" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "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": "2015-09-15 10:49:45" - }, - { - "name": "phpunit/phpunit", - "version": "4.1.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "241116219bb7e3b8111a36ffd8f37546888738d6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/241116219bb7e3b8111a36ffd8f37546888738d6", - "reference": "241116219bb7e3b8111a36ffd8f37546888738d6", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpunit/php-code-coverage": "~2.0", - "phpunit/php-file-iterator": "~1.3.1", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "2.1.5", - "sebastian/comparator": "~1.0", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.0", - "sebastian/exporter": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "", - "../../symfony/yaml/" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "http://www.phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2014-08-17 08:07:02" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.1.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "7878b9c41edb3afab92b85edf5f0981014a2713a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/7878b9c41edb3afab92b85edf5f0981014a2713a", - "reference": "7878b9c41edb3afab92b85edf5f0981014a2713a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.1" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2014-06-12 07:22:15" - }, - { - "name": "psr/log", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", - "shasum": "" - }, - "type": "library", - "autoload": { - "psr-0": { - "Psr\\Log\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2012-12-21 11:40:51" - }, - { - "name": "satooshi/php-coveralls", - "version": "v0.6.1", - "source": { - "type": "git", - "url": "https://github.com/satooshi/php-coveralls.git", - "reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/dd0df95bd37a7cf5c5c50304dfe260ffe4b50760", - "reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-simplexml": "*", - "guzzle/guzzle": ">=3.0", - "php": ">=5.3", - "psr/log": "1.0.0", - "symfony/config": ">=2.0", - "symfony/console": ">=2.0", - "symfony/stopwatch": ">=2.2", - "symfony/yaml": ">=2.0" - }, - "require-dev": { - "apigen/apigen": "2.8.*@stable", - "pdepend/pdepend": "dev-master", - "phpmd/phpmd": "dev-master", - "phpunit/php-invoker": ">=1.1.0,<1.2.0", - "phpunit/phpunit": "3.7.*@stable", - "sebastian/finder-facade": "dev-master", - "sebastian/phpcpd": "1.4.*@stable", - "squizlabs/php_codesniffer": "1.4.*@stable", - "theseer/fdomdocument": "dev-master" - }, - "bin": [ - "composer/bin/coveralls" - ], - "type": "library", - "autoload": { - "psr-0": { - "Contrib\\Component": "src/", - "Contrib\\Bundle": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kitamura Satoshi", - "email": "with.no.parachute@gmail.com", - "homepage": "https://www.facebook.com/satooshi.jp" - } - ], - "description": "PHP client library for Coveralls API", - "homepage": "https://github.com/satooshi/php-coveralls", - "keywords": [ - "ci", - "coverage", - "github", - "test" - ], - "time": "2013-05-04 08:07:33" - }, - { - "name": "sebastian/comparator", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "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" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2015-07-26 15:48:44" - }, - { - "name": "sebastian/diff", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2015-02-22 15:13:53" - }, - { - "name": "sebastian/environment", - "version": "1.3.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2015-08-03 06:14:51" - }, - { - "name": "sebastian/exporter", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "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": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2015-06-21 07:55:53" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "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": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-06-21 08:04:50" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "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 helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" - }, - { - "name": "symfony/browser-kit", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/browser-kit.git", - "reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/277a2457776d4cc25706fbdd9d1e4ab2dac884e4", - "reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/dom-crawler": "~2.0,>=2.0.5" - }, - "require-dev": { - "symfony/css-selector": "~2.0,>=2.0.5", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.0,>=2.0.5" - }, - "suggest": { - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\BrowserKit\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony BrowserKit Component", - "homepage": "https://symfony.com", - "time": "2015-09-06 08:36:38" - }, - { - "name": "symfony/config", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/9698fdf0a750d6887d5e7729d5cf099765b20e61", - "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2015-09-21 15:02:29" - }, - { - "name": "symfony/console", - "version": "v2.5.12", - "target-dir": "Symfony/Component/Console", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "a43e750b4c74f3bdfca77c79c343033d35a6cd6e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a43e750b4c74f3bdfca77c79c343033d35a6cd6e", - "reference": "a43e750b4c74f3bdfca77c79c343033d35a6cd6e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2015-02-08 07:07:45" - }, - { - "name": "symfony/css-selector", - "version": "v2.3.28", - "target-dir": "Symfony/Component/CssSelector", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "7deb1f67f7776866f85df1124360acb5b3134122" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/7deb1f67f7776866f85df1124360acb5b3134122", - "reference": "7deb1f67f7776866f85df1124360acb5b3134122", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\CssSelector\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2015-05-01 14:06:45" - }, - { - "name": "symfony/dependency-injection", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "422c3819b110f610d79c6f1dc38af23787dc790e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/422c3819b110f610d79c6f1dc38af23787dc790e", - "reference": "422c3819b110f610d79c6f1dc38af23787dc790e", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "conflict": { - "symfony/expression-language": "<2.6" - }, - "require-dev": { - "symfony/config": "~2.2", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.1" - }, - "suggest": { - "symfony/config": "", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2015-09-15 08:30:42" - }, - { - "name": "symfony/dom-crawler", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/dom-crawler.git", - "reference": "2e185ca136399f902b948694987e62c80099c052" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2e185ca136399f902b948694987e62c80099c052", - "reference": "2e185ca136399f902b948694987e62c80099c052", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/css-selector": "~2.3", - "symfony/phpunit-bridge": "~2.7" - }, - "suggest": { - "symfony/css-selector": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DomCrawler\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DomCrawler Component", - "homepage": "https://symfony.com", - "time": "2015-09-20 21:13:58" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", - "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/stopwatch": "~2.3" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2015-09-22 13:49:29" - }, - { - "name": "symfony/filesystem", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab", - "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2015-09-09 17:42:36" - }, - { - "name": "symfony/finder", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "8262ab605973afbb3ef74b945daabf086f58366f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/8262ab605973afbb3ef74b945daabf086f58366f", - "reference": "8262ab605973afbb3ef74b945daabf086f58366f", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2015-09-19 19:59:23" - }, - { - "name": "symfony/process", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "b27c8e317922cd3cdd3600850273cf6b82b2e8e9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b27c8e317922cd3cdd3600850273cf6b82b2e8e9", - "reference": "b27c8e317922cd3cdd3600850273cf6b82b2e8e9", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2015-09-19 19:59:23" - }, - { - "name": "symfony/stopwatch", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "08dd97b3f22ab9ee658cd16e6758f8c3c404336e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/08dd97b3f22ab9ee658cd16e6758f8c3c404336e", - "reference": "08dd97b3f22ab9ee658cd16e6758f8c3c404336e", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2015-09-22 13:49:29" - }, - { - "name": "symfony/translation", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "485877661835e188cd78345c6d4eef1290d17571" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/485877661835e188cd78345c6d4eef1290d17571", - "reference": "485877661835e188cd78345c6d4eef1290d17571", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.7", - "symfony/intl": "~2.4", - "symfony/phpunit-bridge": "~2.7", - "symfony/yaml": "~2.2" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2015-09-06 08:36:38" - }, - { - "name": "symfony/yaml", - "version": "v2.7.5", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770", - "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2015-09-14 14:14:09" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": { - "behat/behat": 0, - "behat/mink": 0, - "behat/mink-extension": 0, - "behat/mink-goutte-driver": 0, - "fabpot/goutte": 0 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/default.ini b/default.ini deleted file mode 100644 index 84812747..00000000 --- a/default.ini +++ /dev/null @@ -1,30 +0,0 @@ -[app] -namespace = App -production = false -encoding = "UTF-8" - -[session] -case_sensitive = false -separator = "." -base_namespace = false - -[request] -api_default_type = "json" -force_extension = false -pageview_trailing_directory_slash = false -index_filename = "index" -index_force = false - -[response] -client_minified = false -dev_client_asset_timeout = 600 -template_element_attribute = "data-template" - -[api] -api_directory = "api" -default_version = 1 -version_prefix = "v" -version_suffix = "" -response_type = "json" - -[data] diff --git a/src/Api/Api.php b/src/Api/Api.php deleted file mode 100644 index 7588e79a..00000000 --- a/src/Api/Api.php +++ /dev/null @@ -1,85 +0,0 @@ -config = $config; - $this->responseContent = $responseContent; - $this->session = $session; - $this->version = $this->getVersionName($config->default_version); -} - -/** - * - */ -public function __get($name) { - $name = strtolower($name); - - if(array_key_exists($name, $this->componentArray)) { - return $this->componentArray[$name]; - } - - $component = new Component($name, $this); - $this->componentArray[$name] = $component; - - return $this->componentArray[$name]; -} - -/** - * @param int $version The numerical version of the current API to use - * - * @return string The version name set according to provided version number - */ -public function setVersion($version) { - if(!is_int($version)) { - throw new \Gt\Core\InvalidArgumentException($version); - } - - return $this->version = $this->getVersionName($version); -} - -/** - * - */ -public function getVersion() { - return $this->version; -} - - -/** - * @param int $version The numerical version of the current API - * - * @return string The version name according to the provided number - */ -private function getVersionName($version) { - return $this->config->version_prefix - . $version - . $this->config->version_suffix; -} - -private function getBaseDirectory() { - $path = Path::get(Path::API) . "/" . $this->version; - $path = Path::fixCase($path); - return $path; -} - -}# \ No newline at end of file diff --git a/src/Api/Component.php b/src/Api/Component.php deleted file mode 100644 index 999b78a0..00000000 --- a/src/Api/Component.php +++ /dev/null @@ -1,71 +0,0 @@ -name = $name; - - $this->api = $api; - $this->parent = $parent; - $this->version = $this->api->getVersion(); -} - -public function __get($name) { - return new Component($name, $this->api, $this); -} - -public function __call($name, $args) { - $path = $this->getPath(); - $subPath = $this->getSubPath($name); - - $params = []; - if(!empty($args)) { - $params = $args[0]; - } - - $endpoint = new Endpoint($path, $subPath, $params, $this->api); - return $endpoint->execute(); -} - -private function getPath() { - $path = Path::get(Path::API); - $path .= "/$this->version"; - return $path; -} - -private function getSubPath($end = "") { - $path = ""; - - $reference = $this; - do { - $path = $reference->getName() . "/$path"; - - $reference = $reference->getParent(); - } while(!is_null($reference)); - - return $path . $end; -} - -public function getParent() { - return $this->parent; -} - -public function getName() { - return $this->name; -} - -}# \ No newline at end of file diff --git a/src/Api/Endpoint.php b/src/Api/Endpoint.php deleted file mode 100644 index 4981bfcf..00000000 --- a/src/Api/Endpoint.php +++ /dev/null @@ -1,174 +0,0 @@ -path = $path; - $this->subPath = $subPath; - $this->params = $params; - $this->api = $api; - - $this->scriptPath = $this->getScriptPath(); - $this->loadScript(); -} - -/** - * $this->path and $this->subPath are used to build a full-path-on-disk, but - * at this point we do not know if the basename of the path is a file within a - * directory, or a method within a class. - * - * If the endpoint is completed with a method in a script, the method will be - * included in the return value. Alternatively, if the script is an ApiLogic - * class, the go() method will be called on the class, otherwise if the script - * is SQL it will be processed automatically as defined in the config. - * - * @return string The absolute path to the script file used in this endpoint, - * with file extension and optional method name. If a method name is required, - * the method will be placed after two colons (i.e. /path/to/file.php::myMethod) - */ -private function getScriptPath() { - $method = ""; - - $fullPath = $this->path . "/" . $this->subPath; - $fullPath = Path::fixCase($fullPath); - - // $actionName is the name of the API action being done. This may be the - // name of a script, or the name of a method within a Logic class. - $actionName = basename($fullPath); - $ext = ""; - $containerPath = dirname($fullPath); - - // $containerPath may be a directory containing the $actionName script, or - // a Logic class containing the $actionName as a method. - if(is_dir($containerPath)) { - foreach (new \DirectoryIterator($containerPath) as $fileInfo) { - if($fileInfo->isDot()) { - continue; - } - - $pathInfo = pathinfo($fileInfo->getPathname()); - - if($pathInfo["filename"] === $actionName) { - $ext = $pathInfo["extension"]; - // TODO: Flag that the action is a script file. - break; - } - } - } - else { - // TODO: Handle Logic class with $actionName method. - // $method = "somethingHere"; - } - - $return = "$fullPath.$ext"; - - if(!empty($method)) { - $return .= "::$method"; - } - - return $return; -} - -private function loadScript() { - $pathInfo = pathinfo(strtok($this->scriptPath, ":")); - $this->scriptMethod = strtok(":"); - - - switch ($pathInfo["extension"]) { - case "php": - $this->scriptType = self::SCRIPT_TYPE_LOGIC; - // With no method passed in, the path must be to an API Logic class - // with a go() method. - if(empty($this->scriptMethod)) { - $this->scriptMethod = "go"; - } - - // Check class exists within autoloader (no need to load it yet). - $namespace = Path::getNamespace($this->scriptPath); - if(!class_exists($namespace, true)) { - throw new LogicNotFoundException($namespace); - } - - $this->scriptNamespace = $namespace; - $this->script = new $namespace( - $this->api, - $this->api->responseContent, - $this->api->session, - $this->api->data - ); - - if(!$this->script instanceof Logic) { - throw new InvalidLogicTypeException(gettype($this->script)); - } - - break; - - case "sql": - $this->scriptType = self::SCRIPT_TYPE_SQL; - throw new \Gt\Core\Exception\NotImplementedException(); - break; - - default: - throw new InvalidScriptTypeException($pathInfo["extension"]); - break; - } -} - -/** - * Executes the script(s) associated with this Endpoint, similarly to how the - * ApiDispatcher works. - * - * If the script is an SQL file, it will create a new Database object as a DAL, - * otherwise the ApiLogic will be interfaced directly. - * - * TODO: Execute _common ApiLogic files! - */ -public function execute() { - $returnValue = null; - - switch($this->scriptType) { - case self::SCRIPT_TYPE_LOGIC: - $method = $this->scriptMethod; - $this->script->setParams($this->params); - $returnValue = $this->script->$method(); - // TODO: Execute _common ApiLogic files! - break; - - case self::SCRIPT_TYPE_SQL: - break; - } - - return $returnValue; -} - -}# \ No newline at end of file diff --git a/src/Api/InvalidLogicTypeException.php b/src/Api/InvalidLogicTypeException.php deleted file mode 100644 index 564abf09..00000000 --- a/src/Api/InvalidLogicTypeException.php +++ /dev/null @@ -1,11 +0,0 @@ -file($filePath); - } - - Headers::add("Content-type", $mime); - Headers::send(new ResponseCode); - return readfile($filePath); -} - -}# diff --git a/src/Cli/InvalidContextException.php b/src/Cli/InvalidContextException.php deleted file mode 100644 index a5ec239d..00000000 --- a/src/Cli/InvalidContextException.php +++ /dev/null @@ -1,15 +0,0 @@ -message = "Script can not be invoked in context '$context'"; -} - -}# \ No newline at end of file diff --git a/src/Cli/InvalidTestRunnerTypeException.php b/src/Cli/InvalidTestRunnerTypeException.php deleted file mode 100644 index 04be1eda..00000000 --- a/src/Cli/InvalidTestRunnerTypeException.php +++ /dev/null @@ -1,10 +0,0 @@ -processString = $processName; - - foreach ($processArgs as $key => $value) { - $this->processString .= " "; - if(!empty($key)) { - $this->processString .= "-$key="; - } - $this->processString .= $value; - } -} - -public function __destruct() { - if(is_resource($this->fp)) { - pclose($this->fp); - } -} - -/** - * Spawns a new process and writes the process's output to STDOUT. - * - * @param bool $dummyRun Defaults to false. Set to true to skip opening of the - * new process and instead just return the process string - * - * @return string The exact string executed on the system - */ -public function run($dummyRun = false) { - if(!$dummyRun) { - $this->fp = popen( - $this->processString - // Redirect STDOUT to this process's STDIN. - . " 1>&0", - "r" - ); - - // Pass back all output from newly-spawned process. - while(false !== ($s = fread($this->fp, 1024)) ) { - fwrite(STDOUT, $s); - } - } - - return $this->processString; -} - -}# \ No newline at end of file diff --git a/src/Cli/ProcessFailedException.php b/src/Cli/ProcessFailedException.php deleted file mode 100644 index 8200e7b5..00000000 --- a/src/Cli/ProcessFailedException.php +++ /dev/null @@ -1,9 +0,0 @@ - "text/css", - "js" => "application/javascript", - "txt" => "text/plain", - "woff" => "application/font-woff", - "woff2" => "application/font-woff2", - "webm" => "application/octet-stream", -]; - -/** - * Sets the gtroot (allowing Gatekeeper to be found), and sets approot and port - * with values from the ArgvInput object, then creates and runs the php - * inbuilt server in a new Process. - * - * @param ArgvInput $arguments The arguments passed to the server shell script - * or default values if none are provided. - */ -public function __construct($arguments, $dummyRun = false) { - $this->gtroot = dirname(__DIR__); - $this->approot = $arguments->getOption("approot"); - $this->port = $arguments->getOption("port"); - - $overrideApproot = $arguments->getArgument("approot"); - if(!is_null($overrideApproot)) { - $this->approot = $overrideApproot; - } - - $wwwDir = "{$this->approot}/www"; - if(!is_dir($wwwDir)) { - mkdir($wwwDir, 0775, true); - } - - $this->process = new Process( - "php", [ - "S" => "0.0.0.0:{$this->port}", - "t" => $wwwDir, - "{$this->gtroot}/Cli/Gatekeeper.php", - ]); - - $this->processOutput = $this->process->run($dummyRun); -} - -}# \ No newline at end of file diff --git a/src/Cli/TestRunner.php b/src/Cli/TestRunner.php deleted file mode 100644 index 95ac4e23..00000000 --- a/src/Cli/TestRunner.php +++ /dev/null @@ -1,161 +0,0 @@ - ["pipe", "r"], - 1 => ["pipe", "r"], - 2 => ["pipe", "r"], -]; - -public function __construct($approot, $type) { - $type = strtolower("TYPE_" . $type); - - $this->approot = $approot; - $this->type = $type; - - $unitResult = 0; - $acceptanceResult = 0; - - switch ($type) { - case self::TYPE_ALL: - $unitResult = $this->testUnit(); - $acceptanceResult = $this->testAcceptance(); - break; - - case self::TYPE_UNIT: - $unitResult = $this->testUnit(); - break; - - case self::TYPE_ACCEPTANCE: - $acceptanceResult = $this->testAcceptance(); - break; - - default: - throw new InvalidTestRunnerTypeException($type); - break; - } - - if($this->countAcceptance > 0) { - echo "\nAcceptance tests completed."; - } - else { - echo "\nNo acceptance tests have been run."; - } - if($this->countUnit > 0) { - echo "\nUnit tests completed."; - } - else { - echo "\nNo unit tests have been run."; - } - - echo "\n"; - - $errorLevel = $unitResult | $acceptanceResult; - - if($errorLevel == 0) { - if($this->countUnit + $this->countAcceptance === 0) { - echo "\n - NO TESTS : No tests have been detected."; - } - else { - echo "\n ✓ SUCCESS : All tests passing."; - } - } - else { - echo "\n ✗ FAILURE : "; - - if($errorLevel & self::ERRORLEVEL_UNIT - && $errorLevel & self::ERRORLEVEL_ACCEPTANCE) { - echo "Both unit and acceptance"; - - } - else if($errorLevel & self::ERRORLEVEL_UNIT) { - echo "Acceptance tests passed, but unit"; - } - else if($errorLevel & self::ERRORLEVEL_ACCEPTANCE) { - echo "Unit tests passed, but acceptance"; - } - - echo " tests failed."; - } - - echo "\n\n"; - exit($errorLevel); -} - -/** - * - */ -private function testUnit() { - -} - -/** - * - */ -private function testAcceptance() { - $result = 0; - $rememberCwd = getcwd(); - - $testPath = Path::fixCase(getcwd() . "/test/Acceptance"); - - if(!is_dir($testPath)) { - return 0; - } - - $serverCommand = "./vendor/bin/serve"; - $server = proc_open($serverCommand, $this->descriptorSpec, $pipes); - - $testExec = realpath("./vendor/bin/behat"); - chdir($testPath); - passthru($testExec, $result); - - // Inbuilt server spawns child processes that need killing. - $status = proc_get_status($server); - $pid = $status["pid"]; - $pidArray = []; - - while(!empty($pid)) { - $pidArray []= $pid; - $pid = exec("pgrep -P $pid"); - } - - proc_terminate($server); - proc_close($server); - foreach ($pidArray as $p) { - posix_kill($p, SIGKILL); - } - - if($result === 0) { - $this->countAcceptance++; - } - else { - $result = self::ERRORLEVEL_ACCEPTANCE; - } - - // Reset the cwd. - chdir($rememberCwd); - return $result; -} - -}# diff --git a/src/ClientSide/Compiler.php b/src/ClientSide/Compiler.php deleted file mode 100644 index 6ceff9ae..00000000 --- a/src/ClientSide/Compiler.php +++ /dev/null @@ -1,61 +0,0 @@ -setImportPaths($importPaths); - - // Add magic variable $appRoot. - $content = "\$APPROOT: \"" . Path::get(Path::ROOT) - . "\";" - . "\n\n" - . $content; - - try { - $content = $scss->compile($content); - } - catch(\Exception $e) { - $msg = $e->getMessage(); - throw new CompilerParseException("SCSS $msg"); - } - break; - - default: - break; - } - - return $content; -} - -}# diff --git a/src/ClientSide/CompilerParseException.php b/src/ClientSide/CompilerParseException.php deleted file mode 100644 index 0e709ab9..00000000 --- a/src/ClientSide/CompilerParseException.php +++ /dev/null @@ -1,11 +0,0 @@ -response = $response; - $this->manifest = $manifest; - - $wwwDir = Path::get(Path::WWW); - $this->emptyHash = str_pad("", 32, "0"); - - $assetPath = Path::get(Path::ASSET); - $assetDirName = substr($assetPath, strrpos($assetPath, "/") + 1); - - $this->assetWwwDir = "$wwwDir/$assetDirName"; - $this->staticFingerprintFile = $wwwDir . "/static-fingerprint"; -} - -/** - * @param PathDetails|array $pathDetails Representation of client-side paths - * - * @return bool True if organiser has copied any files, false if no files have - * been copied - */ -public function organise($pathDetails = []) { - $copyCount = 0; - $staticValid = true; - - // Performing the 10 steps as described here: - // http://php.gt/docs/static-file-fingerprinting - if(!file_exists($this->staticFingerprintFile)) { - $staticValid = false; - } - - if(!$this->response->production) { - if(!$this->checkStaticValid()) { - $staticValid = false; - } - } - - if(!$staticValid) { - $this->purgeStaticWwwFiles(); - $copyCount += $this->copyAsset(); - $this->createStaticFingerprint(); - } - - if(!$this->manifest->checkValid()) { - $callback = null; - if($this->response->getConfigOption("client_minified")) { - // Minify everything in www - $callback = [new Minifier(), "minify"]; - } - - // Do copying of files... - $copyCount += $this->copyCompile($pathDetails, $callback); - } - - return !!($copyCount); -} - -/** - * Recurses over the source directories containing static files, providing an - * MD5 hash of the contents and writes it to a special file inside the - * public web root. - */ -public function createStaticFingerprint() { - $staticSrcFingerprint = $this->recursiveFingerprint([ - Path::get(Path::ASSET), - Path::get(Path::SCRIPT), - Path::get(Path::STYLE), - ]); - - $this->writeStaticFingerprint($staticSrcFingerprint); -} - -/** - * Removes any static files found in the www directory and removes the static - * file fingerprint. - */ -public function purgeStaticWwwFiles() { - $assetPath = Path::get(Path::ASSET); - $scriptPath = Path::get(Path::SCRIPT); - $stylePath = Path::get(Path::STYLE); - - $assetDirName = substr($assetPath, strrpos($assetPath, "/") + 1); - $scriptDirName = substr($scriptPath, strrpos($scriptPath, "/") + 1); - $styleDirName = substr($stylePath, strrpos($stylePath, "/") + 1); - - if(file_exists($this->staticFingerprintFile)) { - unlink($this->staticFingerprintFile); - } - - // Remove the Asset directory, and all directories that start with the - // script & style directory name followed by a dash. (Script and Style - // directories in the WWW directory have their fingerprint appended). - if(!is_dir(Path::get(Path::WWW))) { - return; - } - - foreach(new \DirectoryIterator(Path::get(Path::WWW)) as $item) { - $filename = $item->getFilename(); - - if($filename === $assetDirName - || strpos($filename, $scriptDirName . "-") === 0 - || strpos($filename, $styleDirName . "-") === 0) { - DirectoryRecursor::purge($item->getPathname()); - } - } -} - -/** - * Performs the copying from source directories to the www directory, compiling - * files as necessary. For example, source LESS files need to be compiled to - * public CSS files in this process. - * - * @param PathDetails|array $pathDetails - * @param callable|null $callback The callable to pass output through before - * writing to disk - * - * @return int Number of files copied - */ -public function copyCompile($pathDetails, $callback = null) { - $copyCount = 0; - - foreach ($pathDetails as $pathDetail) { - if(!is_dir(dirname($pathDetail["destination"]))) { - mkdir(dirname($pathDetail["destination"]), 0775, true); - } - - $output = Compiler::parse($pathDetail["source"]); - if(!is_null($callback)) { - $output = call_user_func_array($callback, [$output]); - } - - file_put_contents( - $pathDetail["destination"], - $output - ); - ++$copyCount; - } - - return $copyCount; -} - -/** - * Fingerprints the source Asset, Script and Style directory contents and - * compares to the fingerprint cache in the www directory. - * - * @return bool True if the www static directory contents are valid, - * false if they are not (or if they do not exist) - */ -public function checkStaticValid() { - $assetSrcDir = Path::get(Path::ASSET); - $scriptSrcDir = Path::get(Path::SCRIPT); - $styleSrcDir = Path::get(Path::STYLE); - - if(!is_dir($assetSrcDir) - && !is_dir($scriptSrcDir) - && !is_dir($styleSrcDir)) { - return true; - } - - if(!file_exists($this->staticFingerprintFile)) { - return false; - } - - // Recursive fingerprint whole source directory. - $staticWwwFingerprint = file_get_contents($this->staticFingerprintFile); - - $staticSrcFingerprint = $this->recursiveFingerprint([ - $assetSrcDir, - $scriptSrcDir, - $styleSrcDir, - ]); - - return ($staticWwwFingerprint === $staticSrcFingerprint); -} - -/** - * Copies the source asset directory to the www directory and stores a - * fingerprint of the source directory in a separate public file, for use in - * checkAssetValid(). - * - * @return int Number of files copied - */ -public function copyAsset() { - $copyCount = 0; - $assetSrcDir = Path::get(Path::ASSET); - - if(!is_dir($assetSrcDir)) { - return $copyCount; - } - - $copyCount = 0; - - $hash = $this->recursiveFingerprint($assetSrcDir); - DirectoryRecursor::walk( - $assetSrcDir, - [$this, "copyAssetCallback"], - $copyCount - ); - - $this->writeStaticFingerprint($hash); - - return $copyCount; -} - -/** - * - */ -public function copyAssetCallback($file, $iterator, &$out) { - if($file->isDir()) { - return; - } - - $source = $file->getPathname(); - $dest = $this->assetWwwDir . "/" . $iterator->getSubPathname(); - - if(!is_dir(dirname($dest))) { - mkdir(dirname($dest), 0775, true); - } - - if(copy($source, $dest)) { - $out++; - } -} - -private function writeStaticFingerprint($fingerprint) { - if(!is_dir(dirname($this->staticFingerprintFile))) { - mkdir(dirname($this->staticFingerprintFile), 0775, true); - } - file_put_contents($this->staticFingerprintFile, $fingerprint); -} - -/** - * Recursively iterate over all files within given directories and build up a - * hash of their contents and file names. - * - * @param string|array $dir Directory to iterate, or an array of directories - * - * @return string 32 character hash of directory's contents, or 32 zeros - * indicating an empty or non-existant directory - */ -private function recursiveFingerprint($dir) { - if(!is_array($dir)) { - $dir = [$dir]; - } - - // Return a special zeroed hash for when there are no source directories. - $noSourceDirectories = true; - foreach ($dir as $d) { - if(is_dir($d)) { - $noSourceDirectories = false; - } - } - if($noSourceDirectories) { - return $this->emptyHash; - } - - $hashArray = []; - - foreach ($dir as $d) { - if(!is_dir($d)) { - continue; - } - - $hash = DirectoryRecursor::hash($d); - if($hash === md5("")) { - $hash = ""; - } - - $hashArray []= $hash; - } - - $hash = implode("", $hashArray); - if(strlen($hash) === 0) { - return $this->emptyHash; - } - - return md5($hash); -} - -public function getStaticFingerprintFile() { - return $this->staticFingerprintFile; -} - -}# \ No newline at end of file diff --git a/src/ClientSide/Manifest.php b/src/ClientSide/Manifest.php deleted file mode 100644 index 30545711..00000000 --- a/src/ClientSide/Manifest.php +++ /dev/null @@ -1,27 +0,0 @@ - "src", - "LINK" => "href", -]; - -public static $xpathQuery = - "./script[@src] | ./link[@rel = 'stylesheet' and (@href)]"; - -/** - * - */ -public function __construct(Node $domHead, $request, $response) { - $this->domHead = $domHead; - $this->request = $request; - $this->response = $response; - - $this->pathDetails = $this->generatePathDetails(); - $this->fingerprint = $this->calculateFingerprint($this->pathDetails); - $this->pathDetails->setFingerprint($this->fingerprint); - - $meta = $this->domHead->ownerDocument->createElement("meta", [ - "name" => "fingerprint", - "content" => $this->fingerprint, - ]); - $this->domHead->appendChild($meta); -} - -/** - * Constructs a new PathDetails object from elements matching the manifest's - * CSS query selector - * - * @return PathDetails A PathDetails object describing current dom head's - * source paths and representing destination paths - */ -public function generatePathDetails() { - $this->nodeList = $this->domHead->xpath(self::$xpathQuery); - - // Do not add nodes that reference the asset directory. - foreach ($this->nodeList->nodeArray as $i => $node) { - $source = $node->getAttribute( - $this->sourceAttribute[$node->tagName]); - $source = strtolower($source); - if(strpos($source, "/asset") === 0) { - unset($this->nodeList->nodeArray[$i]); - } - } - $this->nodeList->nodeArray = array_values($this->nodeList->nodeArray); - - $pathDetails = new PathDetails($this->nodeList); - return $pathDetails; -} - -/** - * Creates an MD5 hash representing the combined content and filenames of all - * client side resorces represented in the dom head. - * - * @param PathDetails $pathDetails Representation of client-side files contained - * within current dom head ready to fingerprint - * - * @return string MD5 hash representation of current dom head - */ -public function calculateFingerprint($pathDetails) { - // The source fingerprint is a concatenation of all files' MD5s, which - // in turn will be hashed to create an output MD5. - $fingerprintSource = ""; - - foreach ($pathDetails as $pathDetail) { - $node = $pathDetail["node"]; - $nodeSourceAttriute = null; - - foreach ($this->sourceAttributeArray as $sourceAttributeValue) { - if($node->hasAttribute($sourceAttributeValue)) { - $nodeSourceAttriute = $sourceAttributeValue; - } - } - - $sourcePathUri = $node->getAttribute($nodeSourceAttriute); - - // Do not add external files to the fingerprint: - if(strstr($sourcePathUri, "//")) { - continue; - } - // Do not add relative files to the fingerprint: - else if(strpos($sourcePathUri, "/") > 0) { - continue; - } - - $sourcePathAbsolute = - Path::get(Path::SRC) - . $sourcePathUri; - $sourcePathAbsolute = Path::fixCase($sourcePathAbsolute); - - $fingerprintSource .= md5_file($sourcePathAbsolute); - } - - if(empty($fingerprintSource)) { - // Make it obvious if there is an empty dom head - // (it's hard to remember the md5 of an empty string). - return str_repeat("0", 32); - } - - return md5($fingerprintSource); -} - -/** - * @param string $fingerprintToCheck Pass a fingerprint to check the current - * DOMHead against. If null is given, checks the www path for public directory - * presence. - * - * @return bool True if the files listed within the dom head are valid (having - * the same filename and content), False if ANY of the files are invalid - */ -public function checkValid($fingerprintToCheck = null) { - if(!is_null($fingerprintToCheck)) { - return $this->calculateFingerprint($this->generatePathDetails()) - === $fingerprintToCheck; - } - - $valid = false; - - $wwwPath = Path::get(Path::WWW); - if(is_dir($wwwPath)) { - foreach (new \DirectoryIterator($wwwPath) as $fileInfo) { - if($fileInfo->isDot()) { - continue; - } - - $fileName = $fileInfo->getFilename(); - - if(strpos(strtolower($fileName), "asset") === 0) { - continue; - } - - // Manifest-specific files are coppied into their own www - // subdirectory with the fingerprint in the directory name. The - // fileName ends in the manifest's fingerprint. - if(substr($fileName, -strlen($this->fingerprint)) - === $this->fingerprint) { - $valid = true; - } - } - } - - return $valid; -} - -/** - * Expands the DOM head to use fingerprinted and possibly compiled paths. - */ -public function expand() { - foreach ($this->nodeList as $node) { - $pathDetail = $this->pathDetails->getDetailForNode($node); - $sourceAttribute = $this->sourceAttribute[$node->tagName]; - $node->setAttribute($sourceAttribute, $pathDetail["public"]); - } -} - -}# \ No newline at end of file diff --git a/src/ClientSide/PathDetails.php b/src/ClientSide/PathDetails.php deleted file mode 100644 index 9b46d504..00000000 --- a/src/ClientSide/PathDetails.php +++ /dev/null @@ -1,199 +0,0 @@ - "src", - "LINK" => "href", -]; - -private $extensionMap = [ - "scss" => "css", - "less" => "css", - "ts" => "js", - "coffee" => "js", -]; - -/** - * @param NodeList|array $domNodeList List of elements to represent - */ -public function __construct($nodeList = []) { - $this->nodeList = $nodeList; -} - -/** - * - */ -public function setFingerprint($fingerprint) { - $this->fingerprint = $fingerprint; -} - -/** - * Get the Path Detail array for an individual node in the nodeList represented - * by this object. - * - * @param Node $sourceNode Reference to a node within the current nodeList - * - * @return array The Path Detail array, or null if requested Node does not - * exist in the current NodeList - */ -public function getDetailForNode(Node $sourceNode) { - $detail = null; - - foreach ($this->nodeList as $i => $node) { - if($node === $sourceNode) { - $detail = $this->buildDetail($i); - break; - } - } - - return $detail; -} - -/** - * Returns an associative array with four keys: "source", "destination", - * "public" and "node". - * The source key is an absolute file path to the source file on disk - * represented by the Node in the PathDetails object. - * The destination key is an absolute file path to the public file on disk. - * The public key is the absolute URI as seen by the browser. - * The node key is the underlying Dom Node represented by this object. - * - * @param int $index Numerical index for which Node in the NodeList to - * represent - * - * @return array Associative array with two keys: source, destination - */ -private function buildDetail($index) { - $node = $this->nodeList[$index]; - $source = $this->getSource($node); - $destination = $this->getDestination($source); - $public = $this->getPublic($destination); - - return [ - "source" => $source, - "destination" => $destination, - "public" => $public, - "node" => $node, - ]; -} - -/** - * Expands a Node's public-facing URI and returns the absolute disk path of - * the file. - * - * @param Node $node The target Node - * - * @return string Absolute file path of source file - */ -private function getSource(Node $node) { - $srcPath = Path::get(Path::SRC); - $publicPath = $node->getAttribute($this->sourceAttribute[$node->tagName]); - $sourcePath = Path::fixCase($srcPath . $publicPath); - return $sourcePath; -} - -/** - * Returns the absolute destination public file path from the corresponding - * source file path, rewriting the extension if the public file is compiled. - * If the fingerprint has not been set for the PathDetails, a placeholder will - * be present in the returned path: {FINGERPRINT} - * - * @param string $source Absolute file path to source - * - * @return string Absolute file path to destination - */ -private function getDestination($source) { - $relativePath = substr($source, strlen(Path::get(Path::SRC))); - $relativePath = Path::fixCase($relativePath); - // Inject the fingerprint placeholder in place (before second slash). - $relativePathFingerprint = substr_replace( - $relativePath, - "-" . $this->fingerprint, - strpos($relativePath, "/", 1), - 0 - ); - $destinationPath = Path::get(Path::WWW); - $destinationPath = Path::fixCase($destinationPath); - $destinationPath .= $relativePathFingerprint; - - $destinationPath = $this->fixExtension($destinationPath); - - return $destinationPath; -} - -/** - * Replace the path extension with the corresponding extension in the - * $extensionMap array, if one exists. - * - * @param string $path Input path - * - * @return string Path with corrected extension - */ -private function fixExtension($path) { - $extension = pathinfo($path, PATHINFO_EXTENSION); - $extension = strtolower($extension); - - if(!array_key_exists($extension, $this->extensionMap)) { - return $path; - } - - $path = substr($path, 0, strrpos($path, ".") + 1); - $path .= $this->extensionMap[$extension]; - - return $path; -} - -/** - * Returns the public (client-side) path from an absolute file path in the www - * directory. - * - * @param string $path Absolute path to file within www directory - * - * @return string Absolute URI for use on the client-side - */ -private function getPublic($path) { - $publicPath = $path; - - if(strpos($publicPath, Path::get(Path::WWW)) === 0) { - $publicPath = substr($publicPath, strlen(Path::get(Path::WWW))); - } - - return $publicPath; -} - -// Iterator //////////////////////////////////////////////////////////////////// -public function current() { - return $this->buildDetail($this->key()); -} -public function key() { - return $this->iteratorIndex; -} -public function next() { - ++$this->iteratorIndex; -} -public function rewind() { - $this->iteratorIndex = 0; -} -public function valid() { - return isset($this->nodeList[$this->iteratorIndex]); -} - -}# \ No newline at end of file diff --git a/src/Core/Config.php b/src/Core/Config.php deleted file mode 100644 index e459e0e2..00000000 --- a/src/Core/Config.php +++ /dev/null @@ -1,67 +0,0 @@ -configArray = array_replace_recursive( - $defaultConfigArray, - $config - ); - - // Ensure lowercase configuration keys: - foreach ($this->configArray as $key => $config) { - $lcKey = strtolower($key); - $this->configArray[$lcKey] = array_merge( - $config, $this->configArray[$lcKey]); - if($lcKey !== $key) { - unset($this->configArray[$key]); - } - } -} - -public function offsetExists($offset) { - return isset($this->configArray[$offset]); -} - -public function offsetGet($offset) { - $obj = new ConfigObj(); - $obj->setName($offset); - - if(isset($this->configArray[$offset])) { - foreach ($this->configArray[$offset] as $key => $value) { - $obj->$key = $value; - } - } - - return $obj; -} - -public function offsetSet($offset, $value) {} -public function offsetUnset($offset) {} - -}# \ No newline at end of file diff --git a/src/Core/ConfigObj.php b/src/Core/ConfigObj.php deleted file mode 100644 index f70ead5d..00000000 --- a/src/Core/ConfigObj.php +++ /dev/null @@ -1,31 +0,0 @@ -name = strtolower($name); -} - -public function getName() { - return $this->name; -} - -}# \ No newline at end of file diff --git a/src/Core/DirectoryRecursor.php b/src/Core/DirectoryRecursor.php deleted file mode 100644 index 47c00d70..00000000 --- a/src/Core/DirectoryRecursor.php +++ /dev/null @@ -1,131 +0,0 @@ -isDir()) { - return null; - } - - $path = $file->getPathname(); - return md5($path) . md5_file($path); -} - -/** - * Removes a directory and all its contents. - * - * @param string $path Absolute file path to purge. If the provided path is to - * a directory, it will be recursively purged - * - * @return int Number of files and directories removed - */ -public static function purge($path) { - $count = 0; - - self::walk($path, "self::purgeFile", $count, - RecursiveIteratorIterator::CHILD_FIRST); - rmdir($path); - - return $count; -} - -/** - * Removes the provided file or directory, returning the number of successful - * operations (for use in other functions to count total operations). - * - * @param \SplFileInfo $file Iterator's current item - * - * @return int Number of successful operations - */ -public static function purgeFile($file) { - $pathname = $file->getPathname(); - - if($file->isDir()) { - rmdir($pathname); - return 1; - } - else { - unlink($pathname); - return 1; - } - - return 0; -} - -}# \ No newline at end of file diff --git a/src/Core/Exception/GtException.php b/src/Core/Exception/GtException.php deleted file mode 100644 index dda37b10..00000000 --- a/src/Core/Exception/GtException.php +++ /dev/null @@ -1,14 +0,0 @@ - $value) { - $this->$key = $value; - } - - $this->autoNestProperties = $autoNestProperties; - $this->autoCallMethods = $autoCallMethods; -} - -/** - * @param string $name Property name - * - * @return mixed Value of given property name - */ -public function __get($name) { - if($this->autoNestProperties) { - $this->$name = new Obj(); - return $this->$name; - } -} - -public function __call($name, $args) { - if($this->autoCallMethods) { - return new Obj([], $this->autoNestProperties, true); - } -} - -}# \ No newline at end of file diff --git a/src/Core/Path.php b/src/Core/Path.php deleted file mode 100644 index 96ca05d3..00000000 --- a/src/Core/Path.php +++ /dev/null @@ -1,213 +0,0 @@ -getName(); - self::$configArray[$configName] = $config; -} - -/** - * Returns the absolute path on disk to the requested path constant, while - * fixing the path's case, so your application does not need to know if the - * developer is using lower case, upper case, camel case, etc. - * - * @param string $name One of this class's constants. - * - * @return string The absolute path on disk. - */ -public static function get($name) { - switch($name) { - case self::DATA: - $p = self::get(self::ROOT) . "/data"; - break; - - case self::PAGE: - $p = self::get(self::SRC) . "/Page"; - break; - - case self::ROOT: - if(empty($_SERVER["DOCUMENT_ROOT"])) { - $p = getcwd(); - } - else { - $p = dirname($_SERVER["DOCUMENT_ROOT"]); - } - break; - - case self::SCRIPT: - $p = self::get(self::SRC) . "/Script"; - break; - - case self::API: - $apiName = self::$configArray["api"]->api_directory; - $p = self::get(self::SRC) . "/$apiName"; - break; - - case self::APILOGIC: - $p = self::get(self::API) . "/Logic"; - break; - - case self::APITOOL: - $p = self::get(self::API) . "/Tool"; - break; - - case self::APIVIEW: - $p = self::get(self::API) . "/View"; - break; - - case self::SRC: - $p = self::get(self::ROOT) . "/src"; - break; - - case self::STYLE: - $p = self::get(self::SRC) . "/Style"; - break; - - case self::ASSET: - $p = self::get(self::SRC) . "/Asset"; - break; - - case self::WWW: - $p = self::get(self::ROOT) . "/www"; - break; - - case self::GTROOT: - $p = realpath(__DIR__ . "/../../"); - break; - - default: - throw new \UnexpectedValueException("Invalid path: $name"); - } - - return self::fixCase($p); -} - -/** - * Takes an absolute path and checks the case for each directory in the tree, - * correcting it according to what is actually stored on disk. - * - * @param string $path Original path - * @param boolean|string $stripPrefix Defaults to false. Set to non-false string - * to treat the returned path as a uri, removing the provided urlPath prefix - * automatically in order to use as an absolute URI. - * @param boolean|string $stripSuffix Defaults to false. Set to non-false string - * to automatically remove the provided string ending. - * - * @return string Correctly-cased path. Returns in URI style if $stripPrefix - * is set to a non-null string. - */ -public static function fixCase($path, -$stripPrefix = false, $stripSuffix = false) { - $pathArray = explode("/", $path); - - $currentPath = ""; - foreach ($pathArray as $i => $p) { - if(!file_exists($currentPath . "/" . $p)) { - if(!is_dir($currentPath)) { - continue; - } - - foreach (new \DirectoryIterator($currentPath) as $fileInfo) { - if($fileInfo->isDot()) { - continue; - } - - $fileName = $fileInfo->getFilename(); - - if(strcasecmp($fileName, $p) === 0) { - $pathArray[$i] = $fileName; - } - else if(strcasecmp($fileName, $p . ".html") === 0) { - $pathArray[$i] = $fileName; - } - } - } - $currentPath .= $pathArray[$i] . "/"; - } - - $result = implode("/", $pathArray); - - if(is_string($stripPrefix)) { - if(strpos($result, $stripPrefix) === 0) { - $result = substr($result, strlen($stripPrefix) ); - } - } - if(is_string($stripSuffix)) { - if(substr($result, -strlen($stripSuffix)) === $stripSuffix) { - $result = substr($result, 0, -strlen($stripSuffix)); - } - } - - return $result; -} - -/** - * From a given PHP script, return the correct fully qualified namespace from - * its location on disc, according to PSR-4. - * - * @param string $path Absolute path to PHP script - * - * @return string|bool A string containing the fully qualified namespace, or - * false if file cannot be found - */ -public static function getNamespace($path) { - $path = self::fixCase($path); - - if(!file_exists($path)) { - return false; - } - - $src = self::get(self::SRC); - if(strpos($path, $src) !== 0) { - return false; - } - - $subPath = substr($path, strlen($src)); - $pathInfo = pathinfo($subPath); - - if(!empty($pathInfo["dirname"]) - && !empty($pathInfo["filename"])) { - $path = $pathInfo["dirname"]; - $path .= "/" . $pathInfo["filename"]; - - return "\\" . APP_NAMESPACE . str_replace("/", "\\", $path); - } - - return false; -} - -}# \ No newline at end of file diff --git a/src/Core/Start.php b/src/Core/Start.php deleted file mode 100644 index d1f53463..00000000 --- a/src/Core/Start.php +++ /dev/null @@ -1,147 +0,0 @@ -setPathConfig($config); - - $appNamespace = $config["app"]->namespace; - if(empty($appNamespace)) { - throw new \Gt\Core\Exception\RequiredAppResourceNotFoundException( - "No App namespace defined. Are you sure you have a config.ini?"); - } - - define("APP_NAMESPACE", $appNamespace); - - $this->addAppAutoloader(APP_NAMESPACE); - - $production = $config["app"]->production; - $this->setupEnvironment($config); - - $standardiser = new Standardiser(); - $uriFixed = $standardiser->fixUri($uri, $config["request"]); - $this->redirect($uri, $uriFixed, $production); - - $request = new Request ($uri, $config["request"]); - $response = new Response($config["response"], $production); - - $sessionNs = $config["app"]->namespace; - if($config["session"]->base_namespace != false) { - $sessionNs = $config["session"]->base_namespace; - } - $session = new Session($config["session"], $sessionNs); - $api = new Api($config["api"], $response->content, $session); - $data = new Data($config["data"]); - - $dispatcher = DispatcherFactory::createDispatcher( - $appNamespace, - $request, - $response, - $api, - $session, - $data - ); - - // Dispatcher::process returns null on a successful call, only returning - // a string when a redirect is required. - $this->redirect($uri, $dispatcher->process(), $production); -} - -/** - * Adds the application's class path to Composer's autoloader. - * - * @param string $appNamespace Base namespace containing all application logic - */ -private function addAppAutoloader($appNamespace) { - $autoloadPath = realpath(Path::get(Path::GTROOT) . "/../../autoload.php"); - if(false === $autoloadPath) { - $autoloadPath = realpath(Path::get(Path::GTROOT) - . "/vendor/autoload.php"); - } - $loader = require $autoloadPath; - - $classDir = Path::fixCase(implode("/", [ - Path::get(Path::SRC), - "Class", - ])); - - if(is_dir($classDir)) { - $loader->addPsr4($appNamespace . "\\", $classDir); - } - - $loader->addPsr4($appNamespace . "\\", Path::get(Path::SRC)); -} - -/** - * @param string $uri1 Originally requested URI - * @param string $uri2 Fixed or changed URI - * - * @return Redirect|null Object representing the redirection, or null if either - * uri is provided as null - */ -private function redirect($uri1, $uri2, $production) { - if(is_null($uri1) || is_null($uri2)) { - return null; - } - - if(strcmp($uri1, $uri2) !== 0) { - // Only perform permanent redirects on production applications. - $code = 302; - if($production) { - $code = 301; - } - - return new Redirect($uri2, $code); - } -} - -/** - * Passes the Path class the required configuration objects. - * - * @param Config $config The Config object - not all ConfigObj objects contained - * are required by path; only pass the required objects. - */ -public function setPathConfig($config) { - Path::setConfig($config["api"]); -} - -/** - * Simple bootstrapping function to set PHP environment according to - * configuration options. - * - * @param Config $config This application's Configuration object - */ -private function setupEnvironment($config) { - ini_set("default_charset", $config["app"]->encoding); - mb_internal_encoding($config["app"]->encoding); -} - -}# \ No newline at end of file diff --git a/src/Data/Data.php b/src/Data/Data.php deleted file mode 100644 index af50d32a..00000000 --- a/src/Data/Data.php +++ /dev/null @@ -1,35 +0,0 @@ -sourcePath = $absoluteSourcePath; -} - -/** - * - */ -public abstract function getStore($storeName); - -/** - * - */ -public function getTable($tableName) { - return $this->getStore($tableName); -} - -}# \ No newline at end of file diff --git a/src/Data/Source/Csv.php b/src/Data/Source/Csv.php deleted file mode 100644 index d26f2b4b..00000000 --- a/src/Data/Source/Csv.php +++ /dev/null @@ -1,31 +0,0 @@ -sourcePath, - "$storeName.csv", - ]); - - if(!isset($this->storePool[$storeName])) { - $this->storePool[$storeName] = new Store($storePath); - } - - return $this->storePool[$storeName]; -} - -}# \ No newline at end of file diff --git a/src/Data/Source/Csv/CsvSource.php b/src/Data/Source/Csv/CsvSource.php deleted file mode 100644 index b319f5fe..00000000 --- a/src/Data/Source/Csv/CsvSource.php +++ /dev/null @@ -1,48 +0,0 @@ -path = $path; -} - -/** - * Gets a Data Store for a CSV file within the currently represented directory. - * - * @param string $name Name of Data Store within current source - * - * @return \Gt\Data\Store - */ -public function getStore($name) { - $storePath = Path::fixCase(implode("/", [ - $this->path, - $name, - ])); - - if(!is_dir($storePath)) { - mkdir($storePath, 0775, true); - } - - return new CsvStore($storePath); -} - -}# \ No newline at end of file diff --git a/src/Data/Source/Csv/CsvStore.php b/src/Data/Source/Csv/CsvStore.php deleted file mode 100644 index 64a4bb89..00000000 --- a/src/Data/Source/Csv/CsvStore.php +++ /dev/null @@ -1,30 +0,0 @@ -csv = new \Gt\ThirdParty\Csv($this->connection); -} - -public function getBy($key, $value) { -} - -public function getAllBy($key, $value) { -} - -public function getAll($fieldArray = []) { -} - -}# \ No newline at end of file diff --git a/src/Data/Source/Sql.php b/src/Data/Source/Sql.php deleted file mode 100644 index e69de29b..00000000 diff --git a/src/Data/Store.php b/src/Data/Store.php deleted file mode 100644 index 6b99d40b..00000000 --- a/src/Data/Store.php +++ /dev/null @@ -1,18 +0,0 @@ -appNamespace = $appNamespace; - $this->request = $request; - $this->response = $response; - $this->api = $api; - $this->session = $session; - $this->data = $data; -} - -/** - * Returns the upper-most directory available to the type of dispatcher used, - * for instance src/Page or src/Api. - * - * @return string Absolute path of directory - */ -abstract public function getBasePath(); - -/** - * From the provided URI, return the correct path where the source content is - * located. - * @param string $uri The requested uri - * @param string $fixedUri (Pass-by-reference) URI representing - * the requested file on disk, after being fixed for spelling and or case. - * - * @return string The absolute path on disk to the source content file - */ -abstract public function getPath($uri, &$fixedUri); - -/** - * From given file path, return the serialised content. This will either be a - * raw file representation, or a concatenation or compilation of pre-processed - * file types (for example, returning the HTML source for a Markdown file). - * Headers' and footers' source will be attached accordingly if available. - * - * @param string $path The absolute path on disk to the requested source - * directory - * @param string $filename The requested base filename, with extension - * - * @return mixed The full, raw source after loading and any optional processing, - * including header and footer data - */ -abstract public function loadSource($path, $filename); - -/** - * From given file path, return the serialised content of an error page for the - * provided response code. - * - * @param string $path The abolute path on disk to the requested source - * directory - * @param string $filename The requested base filename, with extension - * - * @return mixel The full, raw source of the error response - */ -abstract public function loadError($path, $filename, $responseCode); - -/** - * Creates a suitable ResponseContent object for the type of dispatcher. - * For a PageDispatcher, the ResponseContent will be a Gt\Response\Dom\Document. - * @param mixed $content The serialized content to represent - * - * @return ResponseContent The object to serialise as part of the HTTP response - */ -abstract public function createResponseContent($content, $config); - -/** - * Performs the dispatch cycle. - */ -public function process() { - // Create and assign the Response content. This object may represent a - // DOMDocument or ApiObject, depending on request type. - // Get the directory path representing the request. - $source = ""; - $fullUri = ""; - $responseCode = $this->response->code; - $dynamicFilePath = $this->getDynamicFilePath($this->request->uri); - $isDynamic = false; - - try { - $path = $this->getPath($this->request->uri, $fixedUri); - if($this->request->forceExtension) { - if(strrpos($fixedUri, ".html") - !== strlen($fixedUri) - strlen(".html")) { - $fixedUri .= ".html"; - } - } - else { - if(strrpos($fixedUri, ".html") - === strlen($fixedUri) - strlen(".html")) { - $fixedUri = substr($fixedUri, 0, -strlen(".html")); - } - } - if(strcmp($this->request->uri, $fixedUri) !== 0) { - // Returning early will cause Start to create a Redirect object. - return $fixedUri; - } - - // Get the requested filename, or index filename if none set. - $filename = $this->getFilename( - $this->request->uri, - $this->request->indexFilename, - $fullUri - ); - - // Load the source view from the path on disk and requested filename. - $source = $this->loadSource($path, $filename); - } - catch(NotFoundException $e) { - // Handle 404 error here. - $path = $this->getPath($this->request->uri, $fixedUri, false); - $filename = $this->getFilename( - $this->request->uri, - $this->request->indexFilename, - $fullUri - ); - - if(is_null($dynamicFilePath)) { - $responseCode->set(404); - $source = $this->loadError($path, $filename, $responseCode->get()); - } - else { - $isDynamic = true; - $dynamicPathInfo = new \SplFileInfo($dynamicFilePath); - $dynamicPath = $dynamicPathInfo->getPath(); - $dynamicFilename = $dynamicPathInfo->getFilename(); - - $source = $this->loadSource($dynamicPath, $dynamicFilename); - } - } - - // Instantiate the response content object, for manipulation in Code. - $content = $this->createResponseContent($source, $this->response->config); - $this->setContentUri($this->request->uri, $content); - $this->cleanBuffer(); - - // Only execute Logic if the response is a success. - if($responseCode->getType() === ResponseCode::TYPE_SUCCESS) { - // Construct and assign Logic object, which is a collection of - // Logic class instantiations in order of execution. - $logicList = LogicFactory::create( - $this->appNamespace, - $fullUri, - $this->api, - $content, - $this->session, - $this->data - ); - - // Call the correct methods on each Logic object: - foreach ($logicList as $logicObj) { - $logicObj->isDynamic = $isDynamic; - if(method_exists($logicObj, "before")) { - $logicObj->before(); - } - $logicObj->go(); - - $data = array_merge($_GET, $_POST); - if(!empty($data["do"])) { - $action = $data["do"]; - unset($data["do"]); - $doMethodUnderscore = "do_$action"; - $doMethodCamel = "do" . ucfirst($action); - - if(method_exists($logicObj, $doMethodUnderscore)) { - $logicObj->$doMethodUnderscore($data); - } - else if(method_exists($logicObj, $doMethodCamel)) { - $logicObj->$doMethodCamel($data); - } - } - - if(method_exists($logicObj, "after")) { - $logicObj->after(); - } - } - foreach (array_reverse($logicList) as $logicObj) { - if(!method_exists($logicObj, "endGo")) { - continue; - } - - $logicObj->endGo(); - } - } - - $manifest = $content->createManifest($this->request, $this->response); - $fileOrganiser = new FileOrganiser($this->response, $manifest); - $fileOrganiser->organise($manifest->pathDetails); - $manifest->expand(); - - $content->flush(); -} - -/** - * Gets the name of the requested file in the current directory path, or returns - * the default index filename if the directory is requested. - * - * @param string $uri The requested URI - * @param string $indexFilename The default index filename, taken from - * application configuration - * @param string $fullUri Passed by reference. The full URI, including the - * implied index filename - * - * @return string The filename according the the URI. This may be identical to - * the requested filename, or may be replaced by the default index filename - */ -public function getFilename($uri, $indexFilename, &$fullUri = null) { - $filename = basename($uri); - $fullUri = $uri; - - if(empty($filename)) { - $filename = $indexFilename; - $fullUri = implode("/", [$uri, $indexFilename]); - } - - $pagePath = Path::get(Path::PAGE) . $uri; - if(is_dir($pagePath)) { - $filename = $indexFilename; - $fullUri = implode("/", [$uri, $indexFilename]); - } - - return $filename; -} - -/** - * Looks up the tree for a _dynamic page with a valid file extension. - * - * @param string $requestDir Requested URI - * - * @return null|string Absolute path to the _dynamic file on disk, or null if - * none found - */ -public function getDynamicFilePath($uri) { - // Base path is the path to the first child directory of $requestDir - // within the src path (typically, Page or Api). - $src = Path::get(Path::SRC); - $basePath = $this->getBasePath(); - $requestDir = Path::fixCase($basePath . $uri); - $basePath = substr( - $requestDir, - 0, - strpos($requestDir, "/", strlen($src) + 1) - ); - - // Look up the tree until basepath is met. - $searchDirectory = $requestDir; - do { - if(is_dir($searchDirectory)) { - foreach(new \DirectoryIterator($searchDirectory) as $file) { - if($file->isDot() - || $file->isDir()) { - continue; - } - - $ext = $file->getExtension(); - if(!in_array($ext, $this::$validExtensions)) { - continue; - } - - $filename = $file->getFilename(); - $info = $file->getPathInfo(); - $filenameNoExt = pathinfo($filename, PATHINFO_FILENAME); - if($filenameNoExt === "_dynamic") { - return "$searchDirectory/$filename"; - } - } - } - - $searchDirectory = substr( - $searchDirectory, - 0, - strrpos($searchDirectory, "/") - ); - - } while($searchDirectory !== dirname($basePath)); - - return null; -} - -public function cleanBuffer() { - // TODO: What is the need for this function? - // ob_start(); - // ob_clean(); -} - -}# diff --git a/src/Dispatcher/DispatcherFactory.php b/src/Dispatcher/DispatcherFactory.php deleted file mode 100644 index 06ac383d..00000000 --- a/src/Dispatcher/DispatcherFactory.php +++ /dev/null @@ -1,56 +0,0 @@ -getType(); - - switch($type) { - case Request::TYPE_API: - $className .= "ApiDispatcher"; - break; - - case Request::TYPE_PAGE: - $className .= "PageDispatcher"; - break; - - default: - throw new \Gt\Core\Exception\InvalidAccessException(); - } - - return new $className( - $appNamespace, - $request, - $response, - $api, - $session, - $data - ); -} - -}# \ No newline at end of file diff --git a/src/Dispatcher/PageDispatcher.php b/src/Dispatcher/PageDispatcher.php deleted file mode 100644 index f486b67d..00000000 --- a/src/Dispatcher/PageDispatcher.php +++ /dev/null @@ -1,259 +0,0 @@ -getBasePath(); - $pageDir = Path::fixCase($basePath . $uri); - $fixedUri = Path::fixCase($basePath . $uri, $basePath); - - if(!is_dir($pageDir)) { - $pageDir_container = dirname($pageDir); - - if(is_dir($pageDir_container)) { - if(!file_exists($basePath . $fixedUri)) { - if(!$throw) { - return $uri; - } - - throw new NotFoundException($fixedUri); - } - } - else { - if(!$throw) { - return $uri; - } - - throw new NotFoundException( - $fixedUri - ); - } - - $pageDir = $pageDir_container; - } - - return rtrim($pageDir, "/"); -} - -/** - * From given file path, return the serialised content. This will either be a - * raw file representation, or a concatenation or compilation of pre-processed - * file types (for example, returning the HTML source for a Markdown file). - * Headers' and footers' source will be attached accordingly if available. - * - * @param string $path The absolute path on disk to the requested source - * directory - * @param string $filename The requested base filename, with extension - * - * @return mixed The full, raw source after loading and any optional processing, - * including header and footer data - */ -public function loadSource($path, $filename) { - $source = ""; - $headerSource = ""; - $footerSource = ""; - $pathFileBase = pathinfo($filename, PATHINFO_FILENAME); - - // Look for a header and footer view file up the tree. - $headerFooterPathTop = Path::get(Path::PAGE); - $headerFooterPath = $path; - - do { - if(is_dir($headerFooterPath)) { - foreach (new \DirectoryIterator($headerFooterPath) as $fileInfo) { - if($fileInfo->isDot()) { - continue; - } - - $headerFooterFilename = $fileInfo->getFilename(); - if($headerFooterFilename[0] !== "_") { - continue; - } - - $fileBase = strtok($headerFooterFilename, "."); - $specialName = substr(strtolower($fileBase), 1); - $fullPath = implode("/", [ - $headerFooterPath, - $headerFooterFilename - ]); - - switch($specialName) { - case "header": - $this->readSourceContent($fullPath, $headerSource, true); - break; - - case "footer": - $this->readSourceContent($fullPath, $footerSource, true); - break; - } - } - } - - // Go up a directory... - $headerFooterPath = substr( - $headerFooterPath, - 0, - strrpos($headerFooterPath, "/") - ); - // ... until we are above the Page View directory. - } while (strstr($headerFooterPath, $headerFooterPathTop)); - - foreach (new \DirectoryIterator($path) as $fileInfo) { - if($fileInfo->isDot()) { - continue; - } - - $pageFilename = $fileInfo->getFilename(); - $fileBase = strtok($pageFilename, "."); - $extension = $fileInfo->getExtension(); - if(!in_array(strtolower($extension), self::$validExtensions)) { - // Only include the current file's source if its extension is - // within the validExtensions array. - continue; - } - - if(strcasecmp($fileBase, $pathFileBase) === 0) { - $fullPath = implode("/", [$path, $pageFilename]); - $this->readSourceContent($fullPath, $source); - } - } - - return implode("\n", [ - $headerSource, - $source, - $footerSource, - ]); - - throw new NotFoundException(implode("/", [$path, $filename])); -} - -/** - * From given file path, return the serialised content of an error page for the - * provided response code. - * - * @param string $path The abolute path on disk to the requested source - * directory - * @param string $filename The requested base filename, with extension - * - * @return mixel The full, raw source of the error response - */ -public function loadError($path, $filename, $responseCode) { - // TODO: Handle error pages properly! - return "ERROR $responseCode"; -} - -/** - * If $out variable is empty, reads the source file provided, transforming - * where necessary, providing $out with the HTML source. - * - * @param string $fullPath Absolute path to source file on disk - * @param string &$out Reference to variable to write HTML source to - * @param boolean $replaceOut When true, $out's contents will be replaced. When - * false, if $out has contents already it will be ignored - */ -private function readSourceContent($fullPath, &$out, $replaceOut = false) { - if($replaceOut - && !empty($out)) { - return; - } - - $source = file_get_contents($fullPath); - $extension = pathinfo($fullPath, PATHINFO_EXTENSION); - if(strpos($extension, "htm") !== 0) { - $source = Transformer::toHtml($source, $extension); - } - - $out = $source; -} - -/** - * - */ -public function createResponseContent($html, $config) { - if(!is_string($html)) { - throw new \Gt\Core\Exception\InvalidArgumentTypeException( - gettype($html) . " is not a string"); - } - - $domDocument = new \Gt\Dom\Document($html, $config); - - return $domDocument; -} - -/** - * - */ -public function setContentUri($uri, ResponseContent $content) { - if(strrpos($uri, "/") === strlen($uri) - 1) { - $uri .= "index"; - } - - $body = $content->querySelector("body"); - $uri = trim($uri, "/"); - $classArray = []; - - foreach(explode("/", $uri) as $uriPart) { - $newClass = ""; - - foreach($classArray as $c) { - if(strlen($newClass) > 0) { - $newClass .= "_"; - } - $newClass .= $c; - } - - if(strlen($newClass) > 0) { - $newClass .= "_"; - } - - $classArray []= $newClass . $uriPart; - } - - foreach($classArray as $c) { - $body->classList->add("dir--" . $c); - } - - $uri = str_replace("/", "_", $uri); - $body->id = "uri--" . $uri; - -} - -}# diff --git a/src/Dom/Document.php b/src/Dom/Document.php deleted file mode 100644 index b9545e39..00000000 --- a/src/Dom/Document.php +++ /dev/null @@ -1,335 +0,0 @@ - and ) - * and provides functionality which is global to the document (such as - * creating new elements in the document). - * - * This class is an extension to the native DOMDocument present in PHP, aiming - * to provide a DOM-level-4-capable interface by defining missing methods and - * properties. - * - * PHP.Gt (http://php.gt) - * @copyright Copyright Ⓒ 2015 Bright Flair Ltd. (http://brightflair.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - */ -namespace Gt\Dom; - -use \Gt\Request\Request; -use \Gt\Response\Response; -use \Gt\Response\ResponseContent; -use \Gt\ClientSide\PageManifest; - -/** - * Note: The Document interface also inherits properties and methods from the - * Node interface. - * - * @property-read string $actualEncoding -* @property NodeList $anchors - * @property Node $body - * @property-read DOMConfiguration $config - * @property-read DOMConfiguration $config - * @property Document $document - * @property DOMDocument $documentElement - * @property string $documentURI - * @property string $encoding -* @property Node $firstChild - * @property bool $formatOutput -* @property NodeList $forms - * @property Node $head -* @property NodeList $images - * @property-read DOMImplementation $implementation -* @property NodeList $links - * @property bool $preserveWhiteSpace - * @property bool $recover -* @property string $referrer - * @property bool $resolveExternals - * @property bool $standalone - * @property bool $strictErrorChecking - * @property bool $substituteEntities -* @property string textContent -* @property string $title - * @property bool $validateOnParse - * @property string $value - * @property string $version - * @property-read string $xmlEncoding - * @property bool $xmlStandalone - * @property string $xmlVersion - * - * @method Node adoptNode(Node $externalNode) - * @method Node appendChild(Node $newNode) - * @method Node cloneNode(bool $deep) - * @method DOMAttr createAttribute(string $name) - * @method DOMCDATASection createCDATASection(string $data) - * @method DOMComment createComment(string $data) - * @method DOMDocumentFragment createDocumentFragment() - * @method Node createElement(string $tagName [, array $attributeArray, string $nodeValue]) - * @method DOMEntityReference createEntityReference(string $name) - * @method DOMProcessingInstruction createProcessingInstruction(string $target [, string $data]) - * @method DOMText createTextNode(string $content) - * @method Node getElementById(string $ID) -* @method NodeList getElementsByClassName(string $name) -* @method NodeList getElementsByName(string $name) - * @method NodeList getElementsByTagName(string $name) - * @method int getLineNo() - * @method string getNodePath() - * @method bool hasAttributes() - * @method bool hasChildNodes() - * @method Node insertBefore(Node $newNode, Node $refNode) - * @method Node importNode(Node $importedNode [, bool $deep]) - * @method bool isDefaultNamespace(string $namespaceURI) - * @method bool isSameNode(Node $node) - * @method bool isSupported(string $feature, string $version) - * @method string lookupNamespaceURI(string $prefix) - * @method string lookupPrefix($namespaceURI) - * @method void normalize() - * @method void normalizeDocument() - * @method Node querySelector($selector) - * @method NodeList querySelectorAll($selector) - * @method Node removeChild(Node $oldNode) - * @method Node replaceChild(Node $newNode, Node $oldNode) - * @method bool validate() - */ -class Document extends ResponseContent { - -const DEFAULT_HTML = ""; -public $contentType = "text/html"; -public $domDocument; -public $node; -public $nodeMap = []; - -public $head; -public $body; - -/** - * Passing in the HTML to parse as an optional first parameter automatically - * calls the load function with provided HTML content. - * - * @param string|DOMDocument $source Raw HTML string, or existing native - * DOMDocument to represent - * @param ConfigObj $config Response configuration object - */ -public function __construct($source = null, $config = null) { - if($source instanceof \DOMDocument) { - $this->domDocument = $source; - } - else { - $this->domDocument = new \DOMDocument("1.0", "utf-8"); - - if(!is_null($source)) { - if(empty($source)) { - $source = self::DEFAULT_HTML; - } - $this->load($source); - } - } - - $this->config = $config; - - if(!isset($this->node)) { - $this->node = new Node($this, $this->domDocument); - } - - // Store a self-reference in the native DOMDocument, for access within the - // Node class. - $this->domDocument->document = $this; - $uuid = uniqid("nodeMap-", true); - $this->domDocument->uuid = $uuid; - $this->domDocument->encoding = "utf-8"; - - // Find and reference the DOCTYPE element: - foreach ($this->childNodes as $rootChild) { - if($rootChild->nodeType === XML_DOCUMENT_TYPE_NODE) { - $rootChild->description = "DOCTYPE NODE"; - } - } - - $htmlNodeList = $this->getElementsByTagName("html"); - if(count($htmlNodeList) === 0) { - $htmlNode = $this->document->createElement("html"); - $this->document->appendChild($htmlNode); - } - else { - $htmlNode = $htmlNodeList[0]; - } - $htmlNode = Node::wrapNative($htmlNode); - - // Check the head and body tags exist in the document, no matter what. - $requiredRootTagArray = ["head", "body"]; - foreach ($requiredRootTagArray as $tag) { - $nodeList = $this->domDocument->getElementsByTagName($tag); - if($nodeList->length > 0) { - $this->$tag = Node::wrapNative($nodeList->item(0)); - } - else { - $this->$tag = $this->createElement($tag); - $htmlNode->insertBefore( - $this->$tag, $htmlNode->firstChild); - } - } - - $this->tidy(); -} - -public function createElement($node, -$attributeArray = [], $nodeValue = null) { - return new Node($this, $node, $attributeArray, $nodeValue); -} - -/** - * - */ -public function createManifest($request, $response) { - $domHead = $this->querySelector("head"); - return new PageManifest($domHead, $request, $response); -} - -/** - * Get reference to the Node object representing the provided DOMNode. Use this - * instead of constructing a new Node each time you want access to the node to - * avoid unnecessary memory usage. - * - * @param DOMNode|Node $domNode The provided DOMNode (or Node object) to obtain - * a reference to - * - * @return Node A Node object representing the provided DOMNode. The object may - * have already existed, or may have been constructed here for the first time - */ -public function getNode($domNode) { - if($domNode instanceof Node) { - $domNode = $domNode->domNode; - } - else if(!$domNode instanceof \DOMNode) { - throw new InvalidNodeTypeException(); - } - - $node = null; - - // If the DOMNode has been used before, it will have a UUID property - // attached, but there still may not be a Node object stored in the nodeMap, - // so another check is required. - if(!empty($domNode->uuid)) { - if(isset($this->nodeMap[$domNode->uuid])) { - $node = $this->nodeMap[$domNode->uuid]; - } - } - - // Only construct a new Node object if there isn't one referencing the - // provided DOMNode. - if(is_null($node)) { - if($domNode instanceof \DOMDocument) { - $node = $domNode->document; - } - else { - $node = new Node($this, $domNode); - } - } - - return $node; -} - -/** - * Allows unserialization of one or more HTML files. - * @param string|array $content A string of raw-HTML, or an array of strings - * containing raw-HTML to concatenate and unserialize. - */ -public function load($content = null) { - $string = ""; - - if(is_null($content)) { - $content = self::DEFAULT_HTML; - } - - if(!is_array($content)) { - $content = [$content]; - } - - foreach ($content as $c) { - $string .= $c . PHP_EOL; - } - - libxml_use_internal_errors(true); - - $this->domDocument->loadHTML(mb_convert_encoding( - $string, "HTML-ENTITIES", "UTF-8") - ); -} - -/** - * Tidies up elements within the body and puts them in the head. - * For example, meta tags and title tags should be put into the head, but may - * be useful to declare them in the body. - */ -public function tidy() { - $tagArray = [ - "meta" => "name", - "link" => "rel", - "title" => null, - ]; - - foreach ($tagArray as $tag => $attr) { - $selector = $tag; - $insertBeforeNode = null; - if(!is_null($attr)) { - $selector .= "[$attr]"; - } - - // Skip if no body assigned. - if(!$this->body instanceof Node) { - continue; - } - - foreach($this->body->querySelectorAll($selector) as $element) { - // Remove existing nodes that have the same value for - // their given attribute. - // Skip if there is no head assigned. - if(!$this->head instanceof Node) { - continue; - } - foreach($this->head->querySelectorAll($selector) as $headElement) { - if($headElement->getAttribute($attr) - !== $element->getAttribute($attr)) { - continue; - } - - $insertBeforeNode = $headElement->nextSibling; - $headElement->remove(); - } - - $this->head->insertBefore($element, $insertBeforeNode); - } - } -} - -/** - * - */ -public function __toString() { - return $this->domDocument->saveHTML(); -} - -/** - * - */ -public function __call($name, $args) { - // TODO: Throw exception on appendChild related stuff. - // See what JavaScript does: document.appendChild(something) - // "HierarchyRequestError: Failed to execute 'appendChild' on 'Node': Nodes - // of type 'DIV' may not be inserted inside nodes of type '#document'." - $result = call_user_func_array([$this->node, $name], $args); - return $result; -} - -public function __get($name) { - if(property_exists($this->domDocument, $name)) { - $value = Node::wrapNative($this->domDocument->$name); - } - else { - throw new InvalidNodePropertyException($name); - } - - return $value; -} - -}# diff --git a/src/Dom/InvalidNodePropertyException.php b/src/Dom/InvalidNodePropertyException.php deleted file mode 100644 index 41ea9078..00000000 --- a/src/Dom/InvalidNodePropertyException.php +++ /dev/null @@ -1,11 +0,0 @@ - ".", -]; - -/** - * - */ -public function __construct($document, $node, -array $attributeArray = array(), $nodeValue = null) { - if($node instanceof Node) { - $this->domNode = $node->domNode; - } - else if($node instanceof \DOMNode) { - $this->domNode = $node; - } - else if(is_string($node)) { - $domDocument = $document->domDocument; - $this->domNode = $domDocument->createElement($node); - } - else { - throw new \Gt\Core\Exception\InvalidArgumentTypeException(); - } - - foreach ($attributeArray as $key => $value) { - $this->setAttribute($key, $value); - } - - if($this->domNode instanceof \DOMElement) { - // Fix case, according to W3 spec - // http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-745549614 - $this->tagName = strtoupper($this->domNode->tagName); - - // Add classList property (only for Elements) - $this->classList = new TokenList($this, "class"); - } - - if(!is_null($nodeValue)) { - $this->value = $nodeValue; - } - - // Attach a UUID to the underlying DOMNode and store a reference in the - // Document::nodeMap. This allows for accessing already-constructed Node - // objects through Document::getNode(), rather than constructing again. - if(!property_exists($this->domNode, "uuid")) { - $uuid = uniqid("nodeMap-", true); - $this->domNode->uuid = $uuid; - $this->domNode->ownerDocument->document->nodeMap[$uuid] = $this; - } -} - -/** - * - */ -public function __get($name) { - switch($name) { - case "id": - case "ID": - $value = $this->getAttribute("id"); - break; - - case "className": - $value = $this->getAttribute("class"); - break; - - case "value": - $value = $this->getValue(); - break; - - case "innerHTML": - case "innerHtml": - case "html": - case "HTML": - $innerHTML = ""; - $children = $this->childNodes; - - foreach ($children as $child) { - $innerHTML .= $child->ownerDocument->saveHTML($child); - } - - return html_entity_decode($innerHTML); - break; - - case "textContent": - $textContent = $this->domNode->textContent; - $textContent = mb_convert_encoding( - $textContent, - "HTML-ENTITIES", - "UTF-8" - ); -// foreach(self::$textReplacementArray as $search => $replace) { -// $textContent = str_replace($search, $replace, $textContent); -// } - - return html_entity_decode($textContent, ENT_HTML5); - break; - - case "previousElementSibling": - $sibling = $this; - - while(!is_null($sibling) - && !$sibling->domNode instanceof \DOMElement) { - $sibling = $sibling->previousSibling; - } - - return $sibling; - break; - - case "nextElementSibling": - $sibling = $this; - - while(!is_null($sibling) - && !$sibling->domNode instanceof \DOMElement) { - $sibling = $sibling->nextSibling; - } - - return $sibling; - break; - - default: - if(property_exists($this->domNode, $name)) { - $value = $this->domNode->$name; - $value = self::wrapNative($value); - } - else { - if($this->hasAttribute($name)) { - $value = $this->getAttribute($name); - } - else { - $value = null; - } - } - break; - } - - return $value; -} - -/** - * - */ -public function __set($name, $value) { - switch($name) { - case "id": - case "ID": - $this->setAttribute("id", $value); - break; - - case "className": - $this->setAttribute("class", $value); - break; - - case "description": - $this->description = $value; - break; - - case "textContent": - case "innerText": - case "text": - $value = htmlentities($value, ENT_HTML5); - $this->domNode->nodeValue = $value; - break; - - case "innerHTML": - case "innerHtml": - case "html": - case "HTML": - $value = mb_convert_encoding($value, "html-entities", "utf-8"); - - // If plain text string is provided, skip generating new Document. - if($value === strip_tags($value)) { - $this->textContent = $value; - break; - } - - // Remove all content from current node first. - $this->textContent = ""; - - $tempDoc = new Document($value); - foreach($tempDoc->body->childNodes as $child) { - $importedChild = $this->ownerDocument->importNode($child, true); - $this->appendChild($importedChild); - } - - break; - - case "value": - $this->setValue($value); - break; - - case "templateName": - case "templateParentNode": - case "templatePreviousSibling": - case "templateNextSibling": - $this->domNode->$name = $value; - break; - - default: - $this->setAttribute($name, $value); - } -} - -/** - * - */ -public function __call($name, $args) { - if(method_exists($this->domNode, $name)) { - // Convert each argument to native DOMDocument implementation where - // possible. - foreach ($args as $i => $arg) { - if($arg instanceof Document) { - $args[$i] = $arg->domDocument; - } - else if($arg instanceof Node) { - $args[$i] = $arg->domNode; - } - } - - $value = call_user_func_array([$this->domNode, $name], $args); - - // Attempt to never pass back a native DOMNode, wrapping it in - // a Node class instead. - $value = self::wrapNative($value); - return $value; - } - - if($name === "insertTemplate" - && !empty($this->domNode->templateName)) { - $this->templateParentNode->insertBefore( - $this, - $this->templateNextSibling - ); - return; - } - - throw new NodeMethodNotDefinedException($name); -} - -/** - * Removes the node from the tree it belongs to. - */ -public function remove() { - return $this->parentNode->removeChild($this); -} - -/** - * Gets the node value according to the node type. Typical block element' - * value represents its textContent, however certain elements can have a value - * attribute (such as input elements). - * - * @return string The node value as a string - */ -private function getValue() { - $value = null; - - switch($this->tagName) { - // The following tags can accept a value attribute: - // developer.mozilla.org/en-US/docs/Web/HTML/Attributes - case "BUTTON": - case "INPUT": - case "COMMAND": - case "EMBED": - case "OBJECT": - case "SCRIPT": - case "SOURCE": - case "STYLE": - case "MENU": - case "OPTION": - $value = $this->getAttribute("value"); - if(empty($value)) { - $value = $this->textContent; - } - break; - - // Loop through a select's option elements and set the 'selected' attribute - // on the option whose own value matches the current $value. - // dev.w3.org/html5/spec-preview/common-microsyntaxes#boolean-attributes - case "SELECT": - $optionList = $this->querySelectorAll("option"); - for($i = 0, $len = count($optionList); $i < $len; $i++) { - if($optionList[$i]->hasAttribute("selected")) { - $value = $optionList[$i]->getAttribute("value"); - } - } - break; - - default: - $value = $this->domNode->nodeValue; - break; - } - - return $value; -} - -/** - * Sets the node value according to the node type. Typical block elements' - * value represents its textContent, however certain elements have a value - * attribute (such as input elements), some elements can accept objects as - * values (such as date elements accepting DateTime objects), and some elements - * have children that need modifying due to element value (such as select - * elements' options being selected). - * - * @param string|object $value The value to set - */ -private function setValue($value) { - if($value instanceof \DateTime) { - // w3.org/TR/html-markup/input.datetime.html#input.datetime.attrs.value - $value = $value->format(\DateTime::RFC3339); - } - - switch($this->tagName) { - // The following tags can accept a value attribute: - // developer.mozilla.org/en-US/docs/Web/HTML/Attributes - case "BUTTON": - case "INPUT": - case "COMMAND": - case "EMBED": - case "OBJECT": - case "SCRIPT": - case "SOURCE": - case "STYLE": - case "MENU": - case "OPTION": - $this->setAttribute("value", $value); - break; - - // Loop through a select's option elements and set the 'selected' attribute - // on the option whose own value matches the current $value. - // dev.w3.org/html5/spec-preview/common-microsyntaxes#boolean-attributes - case "SELECT": - $optionList = $this->querySelectorAll("option"); - for($i = 0, $len = count($optionList); $i < $len; $i++) { - if($optionList[$i]->value == $value) { - $optionList[$i]->setAttribute("selected", ""); - } - } - break; - - default: - $value = htmlentities($value); - $this->domNode->nodeValue = $value; - break; - } -} - -/** - * Attempt to never pass back a native DOMNode, wrapping it in the appropriate - * Gt\Dom extension class. - * - * @param DOMDocument|DOMNode|DOMNodeList $node Native object to wrap in - * extension class - * - * @return Document|Node|NodeList Instance of Gt\Dom extension class - */ -public static function wrapNative($node) { - if($node instanceof \DOMDocument) { - $node = $node->document->getNode($node); - } - else if($node instanceof \DOMNode) { - $node = $node->ownerDocument->document->getNode($node); - } - else if($node instanceof \DOMNodeList) { - $node = new NodeList($node); - } - - return $node; -} - -/** - * Returns the first element within the document (using depth-first - * pre-order traversal of the document's nodes) that matches the specified - * group of selectors. - * - * @param string $query A string containing one or more CSS selectors, - * separated by commas - * - * @return Node|null Returns null if no matches are found; otherwise, it - * returns the first matching element. - */ -public function querySelector($query) { - $nodeList = $this->css($query, $this); - if(count($nodeList) > 0) { - // TODO: Might be possible to speed this up? - return $nodeList[0]; - } - - return null; -} - -/** - * Returns a list of the elements within the document (using depth-first - * pre-order traversal of the document's nodes) that match the specified - * group of selectors. - * - * @param string $query A string containing one or more CSS selectors, - * separated by commas - * - * @return NodeList A NodeList with 0 or more matching elements - */ -public function querySelectorAll($query) { - return $this->css($query, $this); -} - -/** - * - */ -public function css($query, $context = null) { - $context = $this->checkContext($context); - // Second parameter of toXPath is optional query prefix. - $xpath = CssSelector::toXPath($query, ".//"); - $domNodeList = $this->xpath($xpath, $context); - return new NodeList($domNodeList); -} - -/** - * - */ -public function xpath($query, $context = null) { - if(is_null($context)) { - $context = $this; - } - $context = $this->checkContext($context); - - $domDocument = $this->ownerDocument; - if(is_null($domDocument)) { - $domDocument = $this->domNode; - - if(isset($domDocument->ownerDocument)) { - $domDocument = $domDocument->ownerDocument; - } - } - - if($domDocument instanceof Document) { - $domDocument = $domDocument->domDocument; - } - - $xpath = new \DOMXPath($domDocument); - $domNodeList = $xpath->query($query, $context); - - return new NodeList($domNodeList); -} - -/** - * Ensures the provided context is of a native DOMDocument type rather than - * an enhanced object, so it can be used with native DOMDocument methods. - * - * @param Node|\DOMNode|null $context The current context. If null is provided, - * this current Node's DOMNode is used. - * - * @return \DOMNode The contextual DOMNode - */ -public function checkContext($context) { - if(is_null($context)) { - if($this->getNodePath() === "/") { - // This is a document. - $context = $this->document->documentElement; - } - else { - $context = $this->domNode; - } - } - - if($context instanceof Document) { - $context = $context->documentElement; - } - - if($context instanceof Node) { - $context = $context->domNode; - } - else if(!$context instanceof \DOMNode) { - throw new InvalidNodeTypeException(gettype($context)); - } - - return $context; -} - -/** - * Returns NodeList containing all child elements which have all of the given - * class names. When called on the document object, the complete document is - * searched, including the root node. You may also call getElementsByClassName - * on any element; it will return only elements which are descendants of the - * specified root element with the given class names. - * - * @param string $classNames Space-separated class list to search against - * - * @return NodeList NodeList containing all matching child elements - */ -public function getElementsByClassName($classNames) { - $query = str_replace(" ", ".", $classNames); - $query = "." . $query; - - return $this->querySelectorAll($query); -} - -}# diff --git a/src/Dom/NodeList.php b/src/Dom/NodeList.php deleted file mode 100644 index 6519a599..00000000 --- a/src/Dom/NodeList.php +++ /dev/null @@ -1,132 +0,0 @@ -childNodes and the querySelectorAll method. - * - * This class is an extension to the native DOMNodeList present in PHP, aiming - * to provide a DOM-level-4-capable interface by defining missing methods and - * properties. - * - * PHP.Gt (http://php.gt) - * @copyright Copyright Ⓒ 2015 Bright Flair Ltd. (http://brightflair.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - */ -namespace Gt\Dom; - -/** - * //property name - * - * @method Node item(int $index) - */ -class NodeList implements \Countable, \Iterator, \ArrayAccess { - -private $iteratorIndex = 0; -public $nodeArray; - -public function __construct($domNodeList) { - $this->nodeArray = []; - - if($domNodeList instanceof NodeList - || $domNodeList instanceof \DOMNodeList - || is_array($domNodeList)) { - foreach($domNodeList as $domNode) { - // Get reference to current DOMNode's owner document, as this may - // be different from node to node. - if($domNode instanceof Node) { - // Ensure we are working with a native DOMNode. - $domNode = $domNode->domNode; - } - - $domDocument = $domNode->ownerDocument; - - // Call getNode to get reference to a Node object representing the - // given DOMNode, then push it into the nodeArray. - $node = $domDocument->document->getNode($domNode); - $this->nodeArray []= $node; - } - } - else { - throw new InvalidNodeTypeException(gettype($domNodeList)); - } -} - -// Countable ------------------------------------------------------------------- -/** - * Count the number of Node elements stored within this NodeList's $nodeArray. - * - * @return integer Number of elements contained by this NodeList - */ -public function count() { - return count($this->nodeArray); -} - -// Iterator -------------------------------------------------------------------- -/** - * - */ -public function rewind() { - $this->iteratorIndex = 0; -} - -/** - * - */ -public function valid() { - return isset($this->nodeArray[$this->iteratorIndex]); -} - -/** - * - */ -public function current() { - return $this->nodeArray[$this->iteratorIndex]; -} - -/** - * - */ -public function key() { - return $this->iteratorIndex; -} - -/** - * - */ -public function next() { - ++$this->iteratorIndex; -} - -// ArrayAccess ----------------------------------------------------------------- - -/** - * - */ -public function offsetExists($offset) { - return isset($this->nodeArray[$offset]); -} - -/** - * - */ -public function offsetGet($offset) { - return $this->nodeArray[$offset]; -} - -/** - * - */ -public function offsetSet($offset, $value) { - if(!$value instanceof Node) { - throw new InvalidNodeTypeException(gettype($value)); - } - $this->nodeArray[$offset] = $value; -} - -/** - * - */ -public function offsetUnset($offset) { - unset($this->nodeArray[$offset]); -} - -}# \ No newline at end of file diff --git a/src/Dom/NodeMethodNotDefinedException.php b/src/Dom/NodeMethodNotDefinedException.php deleted file mode 100644 index 3311ba54..00000000 --- a/src/Dom/NodeMethodNotDefinedException.php +++ /dev/null @@ -1,11 +0,0 @@ -node = $node; - $this->attributeName = $attributeName; - $this->separator = $separator; - $this->refreshAttribute(); -} - -/** - * Returns an item in the list by its index (or null if the number is - * greater than or equal to the length of the list) - * - * @param int $index Zero-based index of token in list - * - * @return string|null If set, the string token at the supplied index. If there - * is no token at that index, returns null - */ -public function item($index) { - $this->rebuildAttribute(); - - if(isset($list[$index])) { - return $list[$index]; - } - - return null; -} - -/** - * Returns true if the underlying string contains token, otherwise false. - * - * @param string $token The token to search for - * - * @return bool true if the underlying string contains token, otherwise false - */ -public function contains($token) { - $this->rebuildAttribute(); - - return in_array($token, $this->list); -} - -/** - * Adds token to the underlying string. If token is already part of the - * underlying string, ignore. - * - * @param string $token The token to add - * - * @return string The added token - */ -public function add($token) { - $this->rebuildAttribute(); - - if(!$this->contains($token)) { - $this->list []= $token; - } - - $this->rebuildAttribute(); - return $token; -} - -/** - * Removes token from the underlying string. If token is not part of the - * underlying string, ignore. - * - * @param string $token The token to remove - * - * @return string The removed token - */ -public function remove($token) { - $this->rebuildAttribute(); - - if($this->contains($token)) { - $index = array_search($token, $this->list); - unset($this->list[$index]); - $this->list = array_values($this->list); - } - - $this->rebuildAttribute(); - return $token; -} - -/** - * Removes token from string and returns false. If token doesn't exist it's - * added and the function returns true. - * - * @param string $token The token to toggle - * - * @return book True if the token is added, false if the token is removed - */ -public function toggle($token) { - $this->rebuildAttribute(); - - if($this->contains($token)) { - $this->remove($token); - return false; - } - else { - $this->add($token); - return true; - } -} - -/** - * From the node's actual attribute value, refresh the underlying properties. - * - * @return void - */ -private function refreshAttribute() { - $attributeValue = ""; - if($this->node->hasAttribute($this->attributeName)) { - $attributeValue = $this->node->getAttribute($this->attributeName); - } - - $this->list = explode($this->separator, $attributeValue); - $this->attributeValue = $attributeValue; -} - -/** - * From the underlying list in its given state, rebuild the attribute - * it represents by removing, then re-adding each token separately. - * - * @return void - */ -private function rebuildAttribute() { - $currentAttributeValue = $this->node->getAttribute($this->attributeName); - if($this->attributeValue !== $currentAttributeValue) { - $this->refreshAttribute(); - } - - $this->node->removeAttribute($this->attributeName); - $attributeValue = implode($this->separator, $this->list); - - $this->node->setAttribute($this->attributeName, $attributeValue); -} - -}# \ No newline at end of file diff --git a/src/Logic/ApiLogic.php b/src/Logic/ApiLogic.php deleted file mode 100644 index e54765cd..00000000 --- a/src/Logic/ApiLogic.php +++ /dev/null @@ -1,11 +0,0 @@ -api = $api; - $this->content = $content; - $this->session = $session; - $this->data = $data; -} - -/** - * Called to execute user code before page renders. - * - * @return void - */ -abstract public function go(); - -/** - * Sets the parameters on this Logic object, a protected array accessible - * internally by all Logic objects. - * - * @param array|mixed $params An array of parameters, or a single value to - * push onto the existing params - * - * @return array Newly-set parameters array - */ -public function setParams($params) { - if(is_array($params)) { - foreach ($params as $i => $value) { - $this->params[$i] = $value; - } - } - else { - $this->params []= $params; - } - - return $this->params; -} - -}# \ No newline at end of file diff --git a/src/Logic/LogicFactory.php b/src/Logic/LogicFactory.php deleted file mode 100644 index dc688621..00000000 --- a/src/Logic/LogicFactory.php +++ /dev/null @@ -1,123 +0,0 @@ - $path) { - $pageLogicPathArray[$i] = Path::fixCase($path); - } - - return $pageLogicPathArray; -} - -/** - * Return an array of Logic class names, in correct execution order, - * to hand to the Dispatcher where their go methods will be called at the - * correct time. Each element in the array is fully qualified with the - * namespace it is contained within. - * - * @param string $appNamespace Base namespace containing all application logic - * @param array $logicPathArray Array of absolute file paths to all Logic - * classes on disk - * - * @return array Array of instantiated Logic objects - */ -public static function getLogicClassNameArray($appNamespace, $logicPathArray) { - $classNameArray = []; - $srcPath = Path::get(Path::SRC); - - foreach ($logicPathArray as $logicPath) { - // Begin creating a string containing the fully-qualified class name. - $namespaceStr = substr($logicPath, strlen($srcPath) + 1); - $namespaceStr = strtok($namespaceStr, "."); - $namespaceStr = str_replace("-", "_", $namespaceStr); - // Explode the string into an array .. - $namespaceArray = explode("/", $namespaceStr); - // .. and add the App's namespace to the beginning of the array. - array_unshift($namespaceArray, $appNamespace); - - // Implode the array with backslashes to create a FQ class name: - $classNameArray []= implode("\\", $namespaceArray); - } - - return $classNameArray; -} - -}# diff --git a/src/Logic/PageLogic.php b/src/Logic/PageLogic.php deleted file mode 100644 index d8814469..00000000 --- a/src/Logic/PageLogic.php +++ /dev/null @@ -1,39 +0,0 @@ -document = $content; - $this->dom = $this->document; - - $this->template = TemplateFactory::init($content); -} - -}# \ No newline at end of file diff --git a/src/Page/Logic.php b/src/Page/Logic.php deleted file mode 100644 index 013f286e..00000000 --- a/src/Page/Logic.php +++ /dev/null @@ -1,17 +0,0 @@ - [], - "nextSibling" => [], - "previousSibling" => [], -]; -private $document; - -private static $singleton; - -public static function init($document) { - if(empty(self::$singleton)) { - self::$singleton = new TemplateFactory($document); - } - - return self::$singleton; -} - -/** - * @param The dom document to scrape template elements from - */ -public function __construct($document) { - $this->document = $document; - $templateAttribute = $document->config->template_element_attribute; - $elementList = $document->xpath(".//*[@$templateAttribute]"); - - foreach ($elementList as $element) { - $name = $element->getAttribute($templateAttribute); - $this->elementArray[$name] = $element; - - $this->templateNodeMap["parent"][$name] = $element->parentNode; - $this->templateNodeMap["nextSibling"][$name] = $element->nextSibling; - $this->templateNodeMap["previousSibling"][$name] = - $element->previousSibling; - - $element->remove(); - } -} - -/** - * Gets a templated element by name, or null if no template is found by the - * provided name. - * - * @param string $name Name of the template - either the `data-template` - * attribute value, the `id` of the `