diff --git a/.gitignore b/.gitignore index 353a9e2..b8e1e3c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ cache/stats.txt settings/settings.yaml plugins/admin plugins/demo +plugins/disqus plugins/version tests zips diff --git a/cache/lastCache.txt b/cache/lastCache.txt index 444d237..f3e6806 100644 --- a/cache/lastCache.txt +++ b/cache/lastCache.txt @@ -1 +1 @@ -1519575954 \ No newline at end of file +1519593451 \ No newline at end of file diff --git a/composer.json b/composer.json index 008b968..0b833cd 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ }, "autoload": { "psr-4": { - "Typemill\\": "system", - "Plugins\\": "plugins" + "Typemill\\": "system/", + "Plugins\\": "plugins/" } } } \ No newline at end of file diff --git a/composer.lock b/composer.lock index b9ec5ec..c60051a 100644 --- a/composer.lock +++ b/composer.lock @@ -182,21 +182,24 @@ }, { "name": "nikic/fast-route", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/nikic/FastRoute.git", - "reference": "b5f95749071c82a8e0f58586987627054400cdf6" + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6", - "reference": "b5f95749071c82a8e0f58586987627054400cdf6", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", "shasum": "" }, "require": { "php": ">=5.4.0" }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, "type": "library", "autoload": { "psr-4": { @@ -221,7 +224,7 @@ "router", "routing" ], - "time": "2017-01-19T11:35:12+00:00" + "time": "2018-02-13T20:26:39+00:00" }, { "name": "paragonie/random_compat", @@ -822,12 +825,12 @@ "source": { "type": "git", "url": "https://github.com/vlucas/valitron.git", - "reference": "1712b04f16db5f243ddfa5ce26a9b51eb1948a36" + "reference": "4b32e6067a7f611113161b2c6f8258d85c16d0e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/valitron/zipball/1712b04f16db5f243ddfa5ce26a9b51eb1948a36", - "reference": "1712b04f16db5f243ddfa5ce26a9b51eb1948a36", + "url": "https://api.github.com/repos/vlucas/valitron/zipball/4b32e6067a7f611113161b2c6f8258d85c16d0e2", + "reference": "4b32e6067a7f611113161b2c6f8258d85c16d0e2", "shasum": "" }, "require": { @@ -844,7 +847,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause" ], "authors": [ { @@ -860,7 +863,7 @@ "validation", "validator" ], - "time": "2017-12-20T08:03:40+00:00" + "time": "2018-02-10T22:02:11+00:00" } ], "packages-dev": [], diff --git a/content/5_info/01-release-notes.md b/content/5_info/01-release-notes.md index b50acf1..ea445e9 100644 --- a/content/5_info/01-release-notes.md +++ b/content/5_info/01-release-notes.md @@ -2,6 +2,17 @@ This is the version history with some release notes. +## Version 1.1.1 (25.02.2018) + +* Added new plugin "analytics" for integration of Matomo/Piwik and Google Analytics. +* Theme "TYPEMILL": Design refresh. +* Theme "TYPEMILL": Added cannonical url. +* Theme "TYPEMILL": Added meta tags for social sharing including image reference. +* Increased length of meta-description for google. +* Fixed error with field builder (getAttributeValues). +* Fixed error with static functions in settings (added declaration as static). +* Added documentation for plugin developers. + ## Version 1.1.0 (05.02.2018) Version 1.1.0 introduces plugins to typemill. And because of the GDPR, the first plugin is an implementation of the famous cookieconsent. So heads up, you can publish GDPR-compliant websites with typemill now! diff --git a/index.php b/index.php index 3137695..b35a424 100644 --- a/index.php +++ b/index.php @@ -4,6 +4,4 @@ require __DIR__ . '/system/vendor/autoload.php'; require __DIR__ . '/system/system.php'; -$app->run(); - -?> \ No newline at end of file +$app->run(); \ No newline at end of file diff --git a/media/decouple.jpg b/media/decouple.jpg deleted file mode 100644 index 1aea4cd..0000000 Binary files a/media/decouple.jpg and /dev/null differ diff --git a/system/Controllers/PageController.php b/system/Controllers/PageController.php index 316e01b..5898a1d 100644 --- a/system/Controllers/PageController.php +++ b/system/Controllers/PageController.php @@ -11,7 +11,7 @@ use Typemill\Models\VersionCheck; use Typemill\Models\Helpers; use Typemill\Events\OnPagetreeLoaded; use Typemill\Events\OnBreadcrumbLoaded; -use Typemill\Events\OnItemloaded; +use Typemill\Events\OnItemLoaded; use Typemill\Events\OnMarkdownLoaded; use Typemill\Events\OnContentArrayLoaded; use Typemill\Events\OnHtmlLoaded; diff --git a/system/settings.php b/system/settings.php index 8f33472..cfebb92 100644 --- a/system/settings.php +++ b/system/settings.php @@ -39,7 +39,7 @@ class Settings 'settingsPath' => $rootPath . 'settings', 'authorPath' => __DIR__ . DIRECTORY_SEPARATOR . 'author' . DIRECTORY_SEPARATOR, 'contentFolder' => 'content', - 'version' => '1.1.0', + 'version' => '1.1.1', 'setup' => true ]; } diff --git a/system/system.php b/system/system.php index ac30c10..13c3cd0 100644 --- a/system/system.php +++ b/system/system.php @@ -19,7 +19,7 @@ $dispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher(); * LOAD SETTINGS * ************************/ -$settings = Typemill\settings::loadSettings(); +$settings = Typemill\Settings::loadSettings(); /************************ * INITIATE SLIM * @@ -188,5 +188,5 @@ $app->add($container->get('csrf')); * ADD ROUTES * ************************/ -require __DIR__ . '/Routes/api.php'; -require __DIR__ . '/Routes/web.php'; \ No newline at end of file +require __DIR__ . '/Routes/Api.php'; +require __DIR__ . '/Routes/Web.php'; \ No newline at end of file diff --git a/system/vendor/composer/installed.json b/system/vendor/composer/installed.json index 3247bee..1b05691 100644 --- a/system/vendor/composer/installed.json +++ b/system/vendor/composer/installed.json @@ -369,54 +369,6 @@ "urlify" ] }, - { - "name": "vlucas/valitron", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/vlucas/valitron.git", - "reference": "1712b04f16db5f243ddfa5ce26a9b51eb1948a36" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/valitron/zipball/1712b04f16db5f243ddfa5ce26a9b51eb1948a36", - "reference": "1712b04f16db5f243ddfa5ce26a9b51eb1948a36", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.8.35" - }, - "time": "2017-12-20T08:03:40+00:00", - "type": "library", - "installation-source": "source", - "autoload": { - "psr-0": { - "Valitron": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "authors": [ - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "http://www.vancelucas.com" - } - ], - "description": "Simple, elegant, stand-alone validation library with NO dependencies", - "homepage": "http://github.com/vlucas/valitron", - "keywords": [ - "valid", - "validation", - "validator" - ] - }, { "name": "psr/container", "version": "1.0.0", @@ -501,51 +453,6 @@ "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop" }, - { - "name": "nikic/fast-route", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/nikic/FastRoute.git", - "reference": "b5f95749071c82a8e0f58586987627054400cdf6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6", - "reference": "b5f95749071c82a8e0f58586987627054400cdf6", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "time": "2017-01-19T11:35:12+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "FastRoute\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov", - "email": "nikic@php.net" - } - ], - "description": "Fast request router for PHP", - "keywords": [ - "router", - "routing" - ] - }, { "name": "pimple/pimple", "version": "v3.2.3", @@ -888,5 +795,101 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com" + }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "version_normalized": "1.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "time": "2018-02-13T20:26:39+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ] + }, + { + "name": "vlucas/valitron", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://github.com/vlucas/valitron.git", + "reference": "4b32e6067a7f611113161b2c6f8258d85c16d0e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/valitron/zipball/4b32e6067a7f611113161b2c6f8258d85c16d0e2", + "reference": "4b32e6067a7f611113161b2c6f8258d85c16d0e2", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.35" + }, + "time": "2018-02-10T22:02:11+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Valitron": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "http://www.vancelucas.com" + } + ], + "description": "Simple, elegant, stand-alone validation library with NO dependencies", + "homepage": "http://github.com/vlucas/valitron", + "keywords": [ + "valid", + "validation", + "validator" + ] } ] diff --git a/system/vendor/nikic/fast-route/.travis.yml b/system/vendor/nikic/fast-route/.travis.yml index e16ed63..10f8381 100644 --- a/system/vendor/nikic/fast-route/.travis.yml +++ b/system/vendor/nikic/fast-route/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: php php: @@ -5,8 +6,15 @@ php: - 5.5 - 5.6 - 7.0 + - 7.1 + - 7.2 - hhvm -matrix: - allow_failures: - - php: 7.0 +script: + - ./vendor/bin/phpunit + +before_install: + - travis_retry composer self-update + +install: + - composer install diff --git a/system/vendor/nikic/fast-route/FastRoute.hhi b/system/vendor/nikic/fast-route/FastRoute.hhi index c34bb8e..8d50738 100644 --- a/system/vendor/nikic/fast-route/FastRoute.hhi +++ b/system/vendor/nikic/fast-route/FastRoute.hhi @@ -34,21 +34,21 @@ namespace FastRoute { function simpleDispatcher( (function(RouteCollector): void) $routeDefinitionCallback, shape( - 'routeParser' => ?classname, - 'dataGenerator' => ?classname, - 'dispatcher' => ?classname, - 'routeCollector' => ?classname, + ?'routeParser' => classname, + ?'dataGenerator' => classname, + ?'dispatcher' => classname, + ?'routeCollector' => classname, ) $options = shape()): Dispatcher; function cachedDispatcher( (function(RouteCollector): void) $routeDefinitionCallback, shape( - 'routeParser' => ?classname, - 'dataGenerator' => ?classname, - 'dispatcher' => ?classname, - 'routeCollector' => ?classname, - 'cacheDisabled' => ?bool, - 'cacheFile' => ?string, + ?'routeParser' => classname, + ?'dataGenerator' => classname, + ?'dispatcher' => classname, + ?'routeCollector' => classname, + ?'cacheDisabled' => bool, + ?'cacheFile' => string, ) $options = shape()): Dispatcher; } diff --git a/system/vendor/nikic/fast-route/composer.json b/system/vendor/nikic/fast-route/composer.json index 62aad22..fb446a2 100644 --- a/system/vendor/nikic/fast-route/composer.json +++ b/system/vendor/nikic/fast-route/composer.json @@ -9,13 +9,16 @@ "email": "nikic@php.net" } ], - "require": { - "php": ">=5.4.0" - }, "autoload": { "psr-4": { "FastRoute\\": "src/" }, "files": ["src/functions.php"] + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" } } diff --git a/system/vendor/nikic/fast-route/psalm.xml b/system/vendor/nikic/fast-route/psalm.xml new file mode 100644 index 0000000..0dca5d7 --- /dev/null +++ b/system/vendor/nikic/fast-route/psalm.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/system/vendor/nikic/fast-route/src/BadRouteException.php b/system/vendor/nikic/fast-route/src/BadRouteException.php index 7e38479..62262ec 100644 --- a/system/vendor/nikic/fast-route/src/BadRouteException.php +++ b/system/vendor/nikic/fast-route/src/BadRouteException.php @@ -2,5 +2,6 @@ namespace FastRoute; -class BadRouteException extends \LogicException { +class BadRouteException extends \LogicException +{ } diff --git a/system/vendor/nikic/fast-route/src/DataGenerator.php b/system/vendor/nikic/fast-route/src/DataGenerator.php index 16053db..af577cd 100644 --- a/system/vendor/nikic/fast-route/src/DataGenerator.php +++ b/system/vendor/nikic/fast-route/src/DataGenerator.php @@ -2,7 +2,8 @@ namespace FastRoute; -interface DataGenerator { +interface DataGenerator +{ /** * Adds a route to the data generator. The route data uses the * same format that is returned by RouterParser::parser(). diff --git a/system/vendor/nikic/fast-route/src/DataGenerator/CharCountBased.php b/system/vendor/nikic/fast-route/src/DataGenerator/CharCountBased.php index 5c38b89..3cfeed6 100644 --- a/system/vendor/nikic/fast-route/src/DataGenerator/CharCountBased.php +++ b/system/vendor/nikic/fast-route/src/DataGenerator/CharCountBased.php @@ -2,12 +2,15 @@ namespace FastRoute\DataGenerator; -class CharCountBased extends RegexBasedAbstract { - protected function getApproxChunkSize() { +class CharCountBased extends RegexBasedAbstract +{ + protected function getApproxChunkSize() + { return 30; } - protected function processChunk($regexToRoutesMap) { + protected function processChunk($regexToRoutesMap) + { $routeMap = []; $regexes = []; diff --git a/system/vendor/nikic/fast-route/src/DataGenerator/GroupCountBased.php b/system/vendor/nikic/fast-route/src/DataGenerator/GroupCountBased.php index d51807f..54d9a05 100644 --- a/system/vendor/nikic/fast-route/src/DataGenerator/GroupCountBased.php +++ b/system/vendor/nikic/fast-route/src/DataGenerator/GroupCountBased.php @@ -2,12 +2,15 @@ namespace FastRoute\DataGenerator; -class GroupCountBased extends RegexBasedAbstract { - protected function getApproxChunkSize() { +class GroupCountBased extends RegexBasedAbstract +{ + protected function getApproxChunkSize() + { return 10; } - protected function processChunk($regexToRoutesMap) { + protected function processChunk($regexToRoutesMap) + { $routeMap = []; $regexes = []; $numGroups = 0; @@ -25,4 +28,3 @@ class GroupCountBased extends RegexBasedAbstract { return ['regex' => $regex, 'routeMap' => $routeMap]; } } - diff --git a/system/vendor/nikic/fast-route/src/DataGenerator/GroupPosBased.php b/system/vendor/nikic/fast-route/src/DataGenerator/GroupPosBased.php index 4152f7a..fc4dc0a 100644 --- a/system/vendor/nikic/fast-route/src/DataGenerator/GroupPosBased.php +++ b/system/vendor/nikic/fast-route/src/DataGenerator/GroupPosBased.php @@ -2,12 +2,15 @@ namespace FastRoute\DataGenerator; -class GroupPosBased extends RegexBasedAbstract { - protected function getApproxChunkSize() { +class GroupPosBased extends RegexBasedAbstract +{ + protected function getApproxChunkSize() + { return 10; } - protected function processChunk($regexToRoutesMap) { + protected function processChunk($regexToRoutesMap) + { $routeMap = []; $regexes = []; $offset = 1; @@ -22,4 +25,3 @@ class GroupPosBased extends RegexBasedAbstract { return ['regex' => $regex, 'routeMap' => $routeMap]; } } - diff --git a/system/vendor/nikic/fast-route/src/DataGenerator/MarkBased.php b/system/vendor/nikic/fast-route/src/DataGenerator/MarkBased.php index 61359f5..0aebed9 100644 --- a/system/vendor/nikic/fast-route/src/DataGenerator/MarkBased.php +++ b/system/vendor/nikic/fast-route/src/DataGenerator/MarkBased.php @@ -2,12 +2,15 @@ namespace FastRoute\DataGenerator; -class MarkBased extends RegexBasedAbstract { - protected function getApproxChunkSize() { +class MarkBased extends RegexBasedAbstract +{ + protected function getApproxChunkSize() + { return 30; } - protected function processChunk($regexToRoutesMap) { + protected function processChunk($regexToRoutesMap) + { $routeMap = []; $regexes = []; $markName = 'a'; @@ -22,4 +25,3 @@ class MarkBased extends RegexBasedAbstract { return ['regex' => $regex, 'routeMap' => $routeMap]; } } - diff --git a/system/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php b/system/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php index 713d897..6457290 100644 --- a/system/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php +++ b/system/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php @@ -2,18 +2,30 @@ namespace FastRoute\DataGenerator; -use FastRoute\DataGenerator; use FastRoute\BadRouteException; +use FastRoute\DataGenerator; use FastRoute\Route; -abstract class RegexBasedAbstract implements DataGenerator { +abstract class RegexBasedAbstract implements DataGenerator +{ + /** @var mixed[][] */ protected $staticRoutes = []; + + /** @var Route[][] */ protected $methodToRegexToRoutesMap = []; - protected abstract function getApproxChunkSize(); - protected abstract function processChunk($regexToRoutesMap); + /** + * @return int + */ + abstract protected function getApproxChunkSize(); - public function addRoute($httpMethod, $routeData, $handler) { + /** + * @return mixed[] + */ + abstract protected function processChunk($regexToRoutesMap); + + public function addRoute($httpMethod, $routeData, $handler) + { if ($this->isStaticRoute($routeData)) { $this->addStaticRoute($httpMethod, $routeData, $handler); } else { @@ -21,7 +33,11 @@ abstract class RegexBasedAbstract implements DataGenerator { } } - public function getData() { + /** + * @return mixed[] + */ + public function getData() + { if (empty($this->methodToRegexToRoutesMap)) { return [$this->staticRoutes, []]; } @@ -29,26 +45,41 @@ abstract class RegexBasedAbstract implements DataGenerator { return [$this->staticRoutes, $this->generateVariableRouteData()]; } - private function generateVariableRouteData() { + /** + * @return mixed[] + */ + private function generateVariableRouteData() + { $data = []; foreach ($this->methodToRegexToRoutesMap as $method => $regexToRoutesMap) { $chunkSize = $this->computeChunkSize(count($regexToRoutesMap)); $chunks = array_chunk($regexToRoutesMap, $chunkSize, true); - $data[$method] = array_map([$this, 'processChunk'], $chunks); + $data[$method] = array_map([$this, 'processChunk'], $chunks); } return $data; } - private function computeChunkSize($count) { + /** + * @param int + * @return int + */ + private function computeChunkSize($count) + { $numParts = max(1, round($count / $this->getApproxChunkSize())); - return ceil($count / $numParts); + return (int) ceil($count / $numParts); } - private function isStaticRoute($routeData) { + /** + * @param mixed[] + * @return bool + */ + private function isStaticRoute($routeData) + { return count($routeData) === 1 && is_string($routeData[0]); } - private function addStaticRoute($httpMethod, $routeData, $handler) { + private function addStaticRoute($httpMethod, $routeData, $handler) + { $routeStr = $routeData[0]; if (isset($this->staticRoutes[$httpMethod][$routeStr])) { @@ -72,7 +103,8 @@ abstract class RegexBasedAbstract implements DataGenerator { $this->staticRoutes[$httpMethod][$routeStr] = $handler; } - private function addVariableRoute($httpMethod, $routeData, $handler) { + private function addVariableRoute($httpMethod, $routeData, $handler) + { list($regex, $variables) = $this->buildRegexForRoute($routeData); if (isset($this->methodToRegexToRoutesMap[$httpMethod][$regex])) { @@ -87,7 +119,12 @@ abstract class RegexBasedAbstract implements DataGenerator { ); } - private function buildRegexForRoute($routeData) { + /** + * @param mixed[] + * @return mixed[] + */ + private function buildRegexForRoute($routeData) + { $regex = ''; $variables = []; foreach ($routeData as $part) { @@ -118,14 +155,19 @@ abstract class RegexBasedAbstract implements DataGenerator { return [$regex, $variables]; } - private function regexHasCapturingGroups($regex) { + /** + * @param string + * @return bool + */ + private function regexHasCapturingGroups($regex) + { if (false === strpos($regex, '(')) { // Needs to have at least a ( to contain a capturing group return false; } // Semi-accurate detection for capturing groups - return preg_match( + return (bool) preg_match( '~ (?: \(\?\( diff --git a/system/vendor/nikic/fast-route/src/Dispatcher.php b/system/vendor/nikic/fast-route/src/Dispatcher.php index ea98009..4ae72a3 100644 --- a/system/vendor/nikic/fast-route/src/Dispatcher.php +++ b/system/vendor/nikic/fast-route/src/Dispatcher.php @@ -2,7 +2,8 @@ namespace FastRoute; -interface Dispatcher { +interface Dispatcher +{ const NOT_FOUND = 0; const FOUND = 1; const METHOD_NOT_ALLOWED = 2; diff --git a/system/vendor/nikic/fast-route/src/Dispatcher/CharCountBased.php b/system/vendor/nikic/fast-route/src/Dispatcher/CharCountBased.php index 22ba240..ef1eec1 100644 --- a/system/vendor/nikic/fast-route/src/Dispatcher/CharCountBased.php +++ b/system/vendor/nikic/fast-route/src/Dispatcher/CharCountBased.php @@ -2,12 +2,15 @@ namespace FastRoute\Dispatcher; -class CharCountBased extends RegexBasedAbstract { - public function __construct($data) { +class CharCountBased extends RegexBasedAbstract +{ + public function __construct($data) + { list($this->staticRouteMap, $this->variableRouteData) = $data; } - protected function dispatchVariableRoute($routeData, $uri) { + protected function dispatchVariableRoute($routeData, $uri) + { foreach ($routeData as $data) { if (!preg_match($data['regex'], $uri . $data['suffix'], $matches)) { continue; diff --git a/system/vendor/nikic/fast-route/src/Dispatcher/GroupCountBased.php b/system/vendor/nikic/fast-route/src/Dispatcher/GroupCountBased.php index 0abd322..493e7a9 100644 --- a/system/vendor/nikic/fast-route/src/Dispatcher/GroupCountBased.php +++ b/system/vendor/nikic/fast-route/src/Dispatcher/GroupCountBased.php @@ -2,12 +2,15 @@ namespace FastRoute\Dispatcher; -class GroupCountBased extends RegexBasedAbstract { - public function __construct($data) { +class GroupCountBased extends RegexBasedAbstract +{ + public function __construct($data) + { list($this->staticRouteMap, $this->variableRouteData) = $data; } - protected function dispatchVariableRoute($routeData, $uri) { + protected function dispatchVariableRoute($routeData, $uri) + { foreach ($routeData as $data) { if (!preg_match($data['regex'], $uri, $matches)) { continue; diff --git a/system/vendor/nikic/fast-route/src/Dispatcher/GroupPosBased.php b/system/vendor/nikic/fast-route/src/Dispatcher/GroupPosBased.php index 32227d4..498220e 100644 --- a/system/vendor/nikic/fast-route/src/Dispatcher/GroupPosBased.php +++ b/system/vendor/nikic/fast-route/src/Dispatcher/GroupPosBased.php @@ -2,12 +2,15 @@ namespace FastRoute\Dispatcher; -class GroupPosBased extends RegexBasedAbstract { - public function __construct($data) { +class GroupPosBased extends RegexBasedAbstract +{ + public function __construct($data) + { list($this->staticRouteMap, $this->variableRouteData) = $data; } - protected function dispatchVariableRoute($routeData, $uri) { + protected function dispatchVariableRoute($routeData, $uri) + { foreach ($routeData as $data) { if (!preg_match($data['regex'], $uri, $matches)) { continue; diff --git a/system/vendor/nikic/fast-route/src/Dispatcher/MarkBased.php b/system/vendor/nikic/fast-route/src/Dispatcher/MarkBased.php index fefa711..22eb09b 100644 --- a/system/vendor/nikic/fast-route/src/Dispatcher/MarkBased.php +++ b/system/vendor/nikic/fast-route/src/Dispatcher/MarkBased.php @@ -2,12 +2,15 @@ namespace FastRoute\Dispatcher; -class MarkBased extends RegexBasedAbstract { - public function __construct($data) { +class MarkBased extends RegexBasedAbstract +{ + public function __construct($data) + { list($this->staticRouteMap, $this->variableRouteData) = $data; } - protected function dispatchVariableRoute($routeData, $uri) { + protected function dispatchVariableRoute($routeData, $uri) + { foreach ($routeData as $data) { if (!preg_match($data['regex'], $uri, $matches)) { continue; diff --git a/system/vendor/nikic/fast-route/src/Dispatcher/RegexBasedAbstract.php b/system/vendor/nikic/fast-route/src/Dispatcher/RegexBasedAbstract.php index 8823b9b..206e879 100644 --- a/system/vendor/nikic/fast-route/src/Dispatcher/RegexBasedAbstract.php +++ b/system/vendor/nikic/fast-route/src/Dispatcher/RegexBasedAbstract.php @@ -4,13 +4,21 @@ namespace FastRoute\Dispatcher; use FastRoute\Dispatcher; -abstract class RegexBasedAbstract implements Dispatcher { - protected $staticRouteMap; - protected $variableRouteData; +abstract class RegexBasedAbstract implements Dispatcher +{ + /** @var mixed[][] */ + protected $staticRouteMap = []; - protected abstract function dispatchVariableRoute($routeData, $uri); + /** @var mixed[] */ + protected $variableRouteData = []; - public function dispatch($httpMethod, $uri) { + /** + * @return mixed[] + */ + abstract protected function dispatchVariableRoute($routeData, $uri); + + public function dispatch($httpMethod, $uri) + { if (isset($this->staticRouteMap[$httpMethod][$uri])) { $handler = $this->staticRouteMap[$httpMethod][$uri]; return [self::FOUND, $handler, []]; @@ -73,8 +81,8 @@ abstract class RegexBasedAbstract implements Dispatcher { // If there are no allowed methods the route simply does not exist if ($allowedMethods) { return [self::METHOD_NOT_ALLOWED, $allowedMethods]; - } else { - return [self::NOT_FOUND]; } + + return [self::NOT_FOUND]; } } diff --git a/system/vendor/nikic/fast-route/src/Route.php b/system/vendor/nikic/fast-route/src/Route.php index d71ded1..e1bf7dd 100644 --- a/system/vendor/nikic/fast-route/src/Route.php +++ b/system/vendor/nikic/fast-route/src/Route.php @@ -2,10 +2,18 @@ namespace FastRoute; -class Route { +class Route +{ + /** @var string */ public $httpMethod; + + /** @var string */ public $regex; + + /** @var array */ public $variables; + + /** @var mixed */ public $handler; /** @@ -16,7 +24,8 @@ class Route { * @param string $regex * @param array $variables */ - public function __construct($httpMethod, $handler, $regex, $variables) { + public function __construct($httpMethod, $handler, $regex, $variables) + { $this->httpMethod = $httpMethod; $this->handler = $handler; $this->regex = $regex; @@ -30,9 +39,9 @@ class Route { * * @return bool */ - public function matches($str) { + public function matches($str) + { $regex = '~^' . $this->regex . '$~'; return (bool) preg_match($regex, $str); } } - diff --git a/system/vendor/nikic/fast-route/src/RouteCollector.php b/system/vendor/nikic/fast-route/src/RouteCollector.php index 7d7667b..c1c1762 100644 --- a/system/vendor/nikic/fast-route/src/RouteCollector.php +++ b/system/vendor/nikic/fast-route/src/RouteCollector.php @@ -2,9 +2,15 @@ namespace FastRoute; -class RouteCollector { +class RouteCollector +{ + /** @var RouteParser */ protected $routeParser; + + /** @var DataGenerator */ protected $dataGenerator; + + /** @var string */ protected $currentGroupPrefix; /** @@ -13,7 +19,8 @@ class RouteCollector { * @param RouteParser $routeParser * @param DataGenerator $dataGenerator */ - public function __construct(RouteParser $routeParser, DataGenerator $dataGenerator) { + public function __construct(RouteParser $routeParser, DataGenerator $dataGenerator) + { $this->routeParser = $routeParser; $this->dataGenerator = $dataGenerator; $this->currentGroupPrefix = ''; @@ -28,7 +35,8 @@ class RouteCollector { * @param string $route * @param mixed $handler */ - public function addRoute($httpMethod, $route, $handler) { + public function addRoute($httpMethod, $route, $handler) + { $route = $this->currentGroupPrefix . $route; $routeDatas = $this->routeParser->parse($route); foreach ((array) $httpMethod as $method) { @@ -46,13 +54,14 @@ class RouteCollector { * @param string $prefix * @param callable $callback */ - public function addGroup($prefix, callable $callback) { + public function addGroup($prefix, callable $callback) + { $previousGroupPrefix = $this->currentGroupPrefix; $this->currentGroupPrefix = $previousGroupPrefix . $prefix; $callback($this); $this->currentGroupPrefix = $previousGroupPrefix; } - + /** * Adds a GET route to the collection * @@ -61,10 +70,11 @@ class RouteCollector { * @param string $route * @param mixed $handler */ - public function get($route, $handler) { + public function get($route, $handler) + { $this->addRoute('GET', $route, $handler); } - + /** * Adds a POST route to the collection * @@ -73,10 +83,11 @@ class RouteCollector { * @param string $route * @param mixed $handler */ - public function post($route, $handler) { + public function post($route, $handler) + { $this->addRoute('POST', $route, $handler); } - + /** * Adds a PUT route to the collection * @@ -85,10 +96,11 @@ class RouteCollector { * @param string $route * @param mixed $handler */ - public function put($route, $handler) { + public function put($route, $handler) + { $this->addRoute('PUT', $route, $handler); } - + /** * Adds a DELETE route to the collection * @@ -97,10 +109,11 @@ class RouteCollector { * @param string $route * @param mixed $handler */ - public function delete($route, $handler) { + public function delete($route, $handler) + { $this->addRoute('DELETE', $route, $handler); } - + /** * Adds a PATCH route to the collection * @@ -109,7 +122,8 @@ class RouteCollector { * @param string $route * @param mixed $handler */ - public function patch($route, $handler) { + public function patch($route, $handler) + { $this->addRoute('PATCH', $route, $handler); } @@ -121,7 +135,8 @@ class RouteCollector { * @param string $route * @param mixed $handler */ - public function head($route, $handler) { + public function head($route, $handler) + { $this->addRoute('HEAD', $route, $handler); } @@ -130,7 +145,8 @@ class RouteCollector { * * @return array */ - public function getData() { + public function getData() + { return $this->dataGenerator->getData(); } } diff --git a/system/vendor/nikic/fast-route/src/RouteParser.php b/system/vendor/nikic/fast-route/src/RouteParser.php index c089c31..6a7685c 100644 --- a/system/vendor/nikic/fast-route/src/RouteParser.php +++ b/system/vendor/nikic/fast-route/src/RouteParser.php @@ -2,7 +2,8 @@ namespace FastRoute; -interface RouteParser { +interface RouteParser +{ /** * Parses a route string into multiple route data arrays. * @@ -29,7 +30,7 @@ interface RouteParser { * Here one route string was converted into two route data arrays. * * @param string $route Route string to parse - * + * * @return mixed[][] Array of route data arrays */ public function parse($route); diff --git a/system/vendor/nikic/fast-route/src/RouteParser/Std.php b/system/vendor/nikic/fast-route/src/RouteParser/Std.php index a6c21bd..4fbdee1 100644 --- a/system/vendor/nikic/fast-route/src/RouteParser/Std.php +++ b/system/vendor/nikic/fast-route/src/RouteParser/Std.php @@ -10,7 +10,8 @@ use FastRoute\RouteParser; * * "/user/{name}[/{id:[0-9]+}]" */ -class Std implements RouteParser { +class Std implements RouteParser +{ const VARIABLE_REGEX = <<<'REGEX' \{ \s* ([a-zA-Z_][a-zA-Z0-9_-]*) \s* @@ -21,7 +22,8 @@ class Std implements RouteParser { REGEX; const DEFAULT_DISPATCH_REGEX = '[^/]+'; - public function parse($route) { + public function parse($route) + { $routeWithoutClosingOptionals = rtrim($route, ']'); $numOptionals = strlen($route) - strlen($routeWithoutClosingOptionals); @@ -30,7 +32,7 @@ REGEX; if ($numOptionals !== count($segments) - 1) { // If there are any ] in the middle of the route, throw a more specific error message if (preg_match('~' . self::VARIABLE_REGEX . '(*SKIP)(*F) | \]~x', $routeWithoutClosingOptionals)) { - throw new BadRouteException("Optional segments can only occur at the end of a route"); + throw new BadRouteException('Optional segments can only occur at the end of a route'); } throw new BadRouteException("Number of opening '[' and closing ']' does not match"); } @@ -39,7 +41,7 @@ REGEX; $routeDatas = []; foreach ($segments as $n => $segment) { if ($segment === '' && $n !== 0) { - throw new BadRouteException("Empty optional part"); + throw new BadRouteException('Empty optional part'); } $currentRoute .= $segment; @@ -50,8 +52,12 @@ REGEX; /** * Parses a route string that does not contain optional segments. + * + * @param string + * @return mixed[] */ - private function parsePlaceholders($route) { + private function parsePlaceholders($route) + { if (!preg_match_all( '~' . self::VARIABLE_REGEX . '~x', $route, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER @@ -72,7 +78,7 @@ REGEX; $offset = $set[0][1] + strlen($set[0][0]); } - if ($offset != strlen($route)) { + if ($offset !== strlen($route)) { $routeData[] = substr($route, $offset); } diff --git a/system/vendor/nikic/fast-route/src/bootstrap.php b/system/vendor/nikic/fast-route/src/bootstrap.php index add216c..0bce3a4 100644 --- a/system/vendor/nikic/fast-route/src/bootstrap.php +++ b/system/vendor/nikic/fast-route/src/bootstrap.php @@ -4,7 +4,7 @@ namespace FastRoute; require __DIR__ . '/functions.php'; -spl_autoload_register(function($class) { +spl_autoload_register(function ($class) { if (strpos($class, 'FastRoute\\') === 0) { $name = substr($class, strlen('FastRoute')); require __DIR__ . strtr($name, '\\', DIRECTORY_SEPARATOR) . '.php'; diff --git a/system/vendor/nikic/fast-route/src/functions.php b/system/vendor/nikic/fast-route/src/functions.php index 46bc805..876a5d9 100644 --- a/system/vendor/nikic/fast-route/src/functions.php +++ b/system/vendor/nikic/fast-route/src/functions.php @@ -9,7 +9,8 @@ if (!function_exists('FastRoute\simpleDispatcher')) { * * @return Dispatcher */ - function simpleDispatcher(callable $routeDefinitionCallback, array $options = []) { + function simpleDispatcher(callable $routeDefinitionCallback, array $options = []) + { $options += [ 'routeParser' => 'FastRoute\\RouteParser\\Std', 'dataGenerator' => 'FastRoute\\DataGenerator\\GroupCountBased', @@ -32,7 +33,8 @@ if (!function_exists('FastRoute\simpleDispatcher')) { * * @return Dispatcher */ - function cachedDispatcher(callable $routeDefinitionCallback, array $options = []) { + function cachedDispatcher(callable $routeDefinitionCallback, array $options = []) + { $options += [ 'routeParser' => 'FastRoute\\RouteParser\\Std', 'dataGenerator' => 'FastRoute\\DataGenerator\\GroupCountBased', diff --git a/system/vendor/nikic/fast-route/test/Dispatcher/CharCountBasedTest.php b/system/vendor/nikic/fast-route/test/Dispatcher/CharCountBasedTest.php index 8168498..e15ff8b 100644 --- a/system/vendor/nikic/fast-route/test/Dispatcher/CharCountBasedTest.php +++ b/system/vendor/nikic/fast-route/test/Dispatcher/CharCountBasedTest.php @@ -2,12 +2,15 @@ namespace FastRoute\Dispatcher; -class CharCountBasedTest extends DispatcherTest { - protected function getDispatcherClass() { +class CharCountBasedTest extends DispatcherTest +{ + protected function getDispatcherClass() + { return 'FastRoute\\Dispatcher\\CharCountBased'; } - protected function getDataGeneratorClass() { + protected function getDataGeneratorClass() + { return 'FastRoute\\DataGenerator\\CharCountBased'; } } diff --git a/system/vendor/nikic/fast-route/test/Dispatcher/DispatcherTest.php b/system/vendor/nikic/fast-route/test/Dispatcher/DispatcherTest.php index a6d6205..c2edf8c 100644 --- a/system/vendor/nikic/fast-route/test/Dispatcher/DispatcherTest.php +++ b/system/vendor/nikic/fast-route/test/Dispatcher/DispatcherTest.php @@ -3,9 +3,10 @@ namespace FastRoute\Dispatcher; use FastRoute\RouteCollector; +use PHPUnit\Framework\TestCase; -abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { - +abstract class DispatcherTest extends TestCase +{ /** * Delegate dispatcher selection to child test classes */ @@ -19,7 +20,8 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { /** * Set appropriate options for the specific Dispatcher class we're testing */ - private function generateDispatcherOptions() { + private function generateDispatcherOptions() + { return [ 'dataGenerator' => $this->getDataGeneratorClass(), 'dispatcher' => $this->getDispatcherClass() @@ -29,7 +31,8 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider provideFoundDispatchCases */ - public function testFoundDispatches($method, $uri, $callback, $handler, $argDict) { + public function testFoundDispatches($method, $uri, $callback, $handler, $argDict) + { $dispatcher = \FastRoute\simpleDispatcher($callback, $this->generateDispatcherOptions()); $info = $dispatcher->dispatch($method, $uri); $this->assertSame($dispatcher::FOUND, $info[0]); @@ -40,11 +43,12 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider provideNotFoundDispatchCases */ - public function testNotFoundDispatches($method, $uri, $callback) { + public function testNotFoundDispatches($method, $uri, $callback) + { $dispatcher = \FastRoute\simpleDispatcher($callback, $this->generateDispatcherOptions()); $routeInfo = $dispatcher->dispatch($method, $uri); - $this->assertFalse(isset($routeInfo[1]), - "NOT_FOUND result must only contain a single element in the returned info array" + $this->assertArrayNotHasKey(1, $routeInfo, + 'NOT_FOUND result must only contain a single element in the returned info array' ); $this->assertSame($dispatcher::NOT_FOUND, $routeInfo[0]); } @@ -52,11 +56,12 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider provideMethodNotAllowedDispatchCases */ - public function testMethodNotAllowedDispatches($method, $uri, $callback, $availableMethods) { + public function testMethodNotAllowedDispatches($method, $uri, $callback, $availableMethods) + { $dispatcher = \FastRoute\simpleDispatcher($callback, $this->generateDispatcherOptions()); $routeInfo = $dispatcher->dispatch($method, $uri); - $this->assertTrue(isset($routeInfo[1]), - "METHOD_NOT_ALLOWED result must return an array of allowed methods at index 1" + $this->assertArrayHasKey(1, $routeInfo, + 'METHOD_NOT_ALLOWED result must return an array of allowed methods at index 1' ); list($routedStatus, $methodArray) = $dispatcher->dispatch($method, $uri); @@ -68,8 +73,9 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { * @expectedException \FastRoute\BadRouteException * @expectedExceptionMessage Cannot use the same placeholder "test" twice */ - public function testDuplicateVariableNameError() { - \FastRoute\simpleDispatcher(function(RouteCollector $r) { + public function testDuplicateVariableNameError() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { $r->addRoute('GET', '/foo/{test}/{test:\d+}', 'handler0'); }, $this->generateDispatcherOptions()); } @@ -78,8 +84,9 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { * @expectedException \FastRoute\BadRouteException * @expectedExceptionMessage Cannot register two routes matching "/user/([^/]+)" for method "GET" */ - public function testDuplicateVariableRoute() { - \FastRoute\simpleDispatcher(function(RouteCollector $r) { + public function testDuplicateVariableRoute() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { $r->addRoute('GET', '/user/{id}', 'handler0'); // oops, forgot \d+ restriction ;) $r->addRoute('GET', '/user/{name}', 'handler1'); }, $this->generateDispatcherOptions()); @@ -89,8 +96,9 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { * @expectedException \FastRoute\BadRouteException * @expectedExceptionMessage Cannot register two routes matching "/user" for method "GET" */ - public function testDuplicateStaticRoute() { - \FastRoute\simpleDispatcher(function(RouteCollector $r) { + public function testDuplicateStaticRoute() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { $r->addRoute('GET', '/user', 'handler0'); $r->addRoute('GET', '/user', 'handler1'); }, $this->generateDispatcherOptions()); @@ -100,8 +108,9 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { * @expectedException \FastRoute\BadRouteException * @expectedExceptionMessage Static route "/user/nikic" is shadowed by previously defined variable route "/user/([^/]+)" for method "GET" */ - public function testShadowedStaticRoute() { - \FastRoute\simpleDispatcher(function(RouteCollector $r) { + public function testShadowedStaticRoute() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { $r->addRoute('GET', '/user/{name}', 'handler0'); $r->addRoute('GET', '/user/nikic', 'handler1'); }, $this->generateDispatcherOptions()); @@ -111,18 +120,20 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { * @expectedException \FastRoute\BadRouteException * @expectedExceptionMessage Regex "(en|de)" for parameter "lang" contains a capturing group */ - public function testCapturing() { - \FastRoute\simpleDispatcher(function(RouteCollector $r) { + public function testCapturing() + { + \FastRoute\simpleDispatcher(function (RouteCollector $r) { $r->addRoute('GET', '/{lang:(en|de)}', 'handler0'); }, $this->generateDispatcherOptions()); } - public function provideFoundDispatchCases() { + public function provideFoundDispatchCases() + { $cases = []; // 0 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/resource/123/456', 'handler0'); }; @@ -135,7 +146,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 1 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/handler0', 'handler0'); $r->addRoute('GET', '/handler1', 'handler1'); $r->addRoute('GET', '/handler2', 'handler2'); @@ -150,7 +161,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 2 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler0'); $r->addRoute('GET', '/user/{id:[0-9]+}', 'handler1'); $r->addRoute('GET', '/user/{name}', 'handler2'); @@ -198,11 +209,10 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 6 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/user/{id:[0-9]+}', 'handler0'); $r->addRoute('GET', '/user/12345/extension', 'handler1'); $r->addRoute('GET', '/user/{id:[0-9]+}.{extension}', 'handler2'); - }; $method = 'GET'; @@ -214,7 +224,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 7 ----- Test GET method fallback on HEAD route miss ------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/user/{name}', 'handler0'); $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler1'); $r->addRoute('GET', '/static0', 'handler2'); @@ -264,7 +274,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 11 ---- More specified routes are not shadowed by less specific of another method ------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/user/{name}', 'handler0'); $r->addRoute('POST', '/user/{name:[a-z]+}', 'handler1'); }; @@ -278,7 +288,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 12 ---- Handler of more specific routes is used, if it occurs first --------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/user/{name}', 'handler0'); $r->addRoute('POST', '/user/{name:[a-z]+}', 'handler1'); $r->addRoute('POST', '/user/{name}', 'handler2'); @@ -293,7 +303,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 13 ---- Route with constant suffix -----------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/user/{name}', 'handler0'); $r->addRoute('GET', '/user/{name}/edit', 'handler1'); }; @@ -307,7 +317,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 14 ---- Handle multiple methods with the same handler ----------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute(['GET', 'POST'], '/user', 'handlerGetPost'); $r->addRoute(['DELETE'], '/user', 'handlerDelete'); $r->addRoute([], '/user', 'handlerNone'); @@ -318,53 +328,53 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { $cases[] = ['POST', '/user', $callback, 'handlerGetPost', $argDict]; $cases[] = ['DELETE', '/user', $callback, 'handlerDelete', $argDict]; - // 15 ---- + // 17 ---- - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('POST', '/user.json', 'handler0'); $r->addRoute('GET', '/{entity}.json', 'handler1'); }; $cases[] = ['GET', '/user.json', $callback, 'handler1', ['entity' => 'user']]; - // 16 ---- + // 18 ---- - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '', 'handler0'); }; $cases[] = ['GET', '', $callback, 'handler0', []]; - // 17 ---- + // 19 ---- - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('HEAD', '/a/{foo}', 'handler0'); $r->addRoute('GET', '/b/{foo}', 'handler1'); }; $cases[] = ['HEAD', '/b/bar', $callback, 'handler1', ['foo' => 'bar']]; - // 18 ---- + // 20 ---- - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('HEAD', '/a', 'handler0'); $r->addRoute('GET', '/b', 'handler1'); }; $cases[] = ['HEAD', '/b', $callback, 'handler1', []]; - // 19 ---- + // 21 ---- - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/foo', 'handler0'); $r->addRoute('HEAD', '/{bar}', 'handler1'); }; $cases[] = ['HEAD', '/foo', $callback, 'handler1', ['bar' => 'foo']]; - // 20 ---- + // 22 ---- - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('*', '/user', 'handler0'); $r->addRoute('*', '/{user}', 'handler1'); $r->addRoute('GET', '/user', 'handler2'); @@ -372,39 +382,49 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { $cases[] = ['GET', '/user', $callback, 'handler2', []]; - // 21 ---- + // 23 ---- - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('*', '/user', 'handler0'); $r->addRoute('GET', '/user', 'handler1'); }; $cases[] = ['POST', '/user', $callback, 'handler0', []]; - // 22 ---- + // 24 ---- $cases[] = ['HEAD', '/user', $callback, 'handler1', []]; - // 23 ---- + // 25 ---- - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/{bar}', 'handler0'); $r->addRoute('*', '/foo', 'handler1'); }; $cases[] = ['GET', '/foo', $callback, 'handler0', ['bar' => 'foo']]; + // 26 ---- + + $callback = function(RouteCollector $r) { + $r->addRoute('GET', '/user', 'handler0'); + $r->addRoute('*', '/{foo:.*}', 'handler1'); + }; + + $cases[] = ['POST', '/bar', $callback, 'handler1', ['foo' => 'bar']]; + // x --------------------------------------------------------------------------------------> return $cases; } - public function provideNotFoundDispatchCases() { + public function provideNotFoundDispatchCases() + { $cases = []; // 0 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/resource/123/456', 'handler0'); }; @@ -431,7 +451,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 3 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/handler0', 'handler0'); $r->addRoute('GET', '/handler1', 'handler1'); $r->addRoute('GET', '/handler2', 'handler2'); @@ -444,7 +464,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 4 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler0'); $r->addRoute('GET', '/user/{id:[0-9]+}', 'handler1'); $r->addRoute('GET', '/user/{name}', 'handler2'); @@ -468,19 +488,20 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // reuse callback from #5 $method = 'HEAD'; - $cases[] = array($method, $uri, $callback); + $cases[] = [$method, $uri, $callback]; // x --------------------------------------------------------------------------------------> return $cases; } - public function provideMethodNotAllowedDispatchCases() { + public function provideMethodNotAllowedDispatchCases() + { $cases = []; // 0 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/resource/123/456', 'handler0'); }; @@ -492,7 +513,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 1 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/resource/123/456', 'handler0'); $r->addRoute('POST', '/resource/123/456', 'handler1'); $r->addRoute('PUT', '/resource/123/456', 'handler2'); @@ -507,7 +528,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 2 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('GET', '/user/{name}/{id:[0-9]+}', 'handler0'); $r->addRoute('POST', '/user/{name}/{id:[0-9]+}', 'handler1'); $r->addRoute('PUT', '/user/{name}/{id:[0-9]+}', 'handler2'); @@ -522,7 +543,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 3 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('POST', '/user/{name}', 'handler1'); $r->addRoute('PUT', '/user/{name:[a-z]+}', 'handler2'); $r->addRoute('PATCH', '/user/{name:[a-z]+}', 'handler3'); @@ -536,7 +557,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 4 --------------------------------------------------------------------------------------> - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute(['GET', 'POST'], '/user', 'handlerGetPost'); $r->addRoute(['DELETE'], '/user', 'handlerDelete'); $r->addRoute([], '/user', 'handlerNone'); @@ -546,7 +567,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { // 5 - $callback = function(RouteCollector $r) { + $callback = function (RouteCollector $r) { $r->addRoute('POST', '/user.json', 'handler0'); $r->addRoute('GET', '/{entity}.json', 'handler1'); }; @@ -557,5 +578,4 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase { return $cases; } - } diff --git a/system/vendor/nikic/fast-route/test/Dispatcher/GroupCountBasedTest.php b/system/vendor/nikic/fast-route/test/Dispatcher/GroupCountBasedTest.php index 74820fc..f821ef5 100644 --- a/system/vendor/nikic/fast-route/test/Dispatcher/GroupCountBasedTest.php +++ b/system/vendor/nikic/fast-route/test/Dispatcher/GroupCountBasedTest.php @@ -2,12 +2,15 @@ namespace FastRoute\Dispatcher; -class GroupCountBasedTest extends DispatcherTest { - protected function getDispatcherClass() { +class GroupCountBasedTest extends DispatcherTest +{ + protected function getDispatcherClass() + { return 'FastRoute\\Dispatcher\\GroupCountBased'; } - protected function getDataGeneratorClass() { + protected function getDataGeneratorClass() + { return 'FastRoute\\DataGenerator\\GroupCountBased'; } } diff --git a/system/vendor/nikic/fast-route/test/Dispatcher/GroupPosBasedTest.php b/system/vendor/nikic/fast-route/test/Dispatcher/GroupPosBasedTest.php index c3d4f8d..b5c9567 100644 --- a/system/vendor/nikic/fast-route/test/Dispatcher/GroupPosBasedTest.php +++ b/system/vendor/nikic/fast-route/test/Dispatcher/GroupPosBasedTest.php @@ -2,12 +2,15 @@ namespace FastRoute\Dispatcher; -class GroupPosBasedTest extends DispatcherTest { - protected function getDispatcherClass() { +class GroupPosBasedTest extends DispatcherTest +{ + protected function getDispatcherClass() + { return 'FastRoute\\Dispatcher\\GroupPosBased'; } - protected function getDataGeneratorClass() { + protected function getDataGeneratorClass() + { return 'FastRoute\\DataGenerator\\GroupPosBased'; } } diff --git a/system/vendor/nikic/fast-route/test/Dispatcher/MarkBasedTest.php b/system/vendor/nikic/fast-route/test/Dispatcher/MarkBasedTest.php index 04b0af9..b3b27dd 100644 --- a/system/vendor/nikic/fast-route/test/Dispatcher/MarkBasedTest.php +++ b/system/vendor/nikic/fast-route/test/Dispatcher/MarkBasedTest.php @@ -2,19 +2,23 @@ namespace FastRoute\Dispatcher; -class MarkBasedTest extends DispatcherTest { - public function setUp() { +class MarkBasedTest extends DispatcherTest +{ + public function setUp() + { preg_match('/(*MARK:A)a/', 'a', $matches); if (!isset($matches['MARK'])) { $this->markTestSkipped('PHP 5.6 required for MARK support'); } } - protected function getDispatcherClass() { + protected function getDispatcherClass() + { return 'FastRoute\\Dispatcher\\MarkBased'; } - protected function getDataGeneratorClass() { + protected function getDataGeneratorClass() + { return 'FastRoute\\DataGenerator\\MarkBased'; } } diff --git a/system/vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php b/system/vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php index 7bc6ebb..b6fc53f 100644 --- a/system/vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php +++ b/system/vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php @@ -2,11 +2,16 @@ namespace FastRoute; -class HackTypecheckerTest extends \PhpUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class HackTypecheckerTest extends TestCase +{ const SERVER_ALREADY_RUNNING_CODE = 77; - public function testTypechecks($recurse = true) { + + public function testTypechecks($recurse = true) + { if (!defined('HHVM_VERSION')) { - $this->markTestSkipped("HHVM only"); + $this->markTestSkipped('HHVM only'); } if (!version_compare(HHVM_VERSION, '3.9.0', '>=')) { $this->markTestSkipped('classname requires HHVM 3.9+'); @@ -15,17 +20,17 @@ class HackTypecheckerTest extends \PhpUnit_Framework_TestCase { // The typechecker recurses the whole tree, so it makes sure // that everything in fixtures/ is valid when this runs. - $output = array(); + $output = []; $exit_code = null; exec( - 'hh_server --check '.escapeshellarg(__DIR__.'/../../').' 2>&1', + 'hh_server --check ' . escapeshellarg(__DIR__ . '/../../') . ' 2>&1', $output, $exit_code ); if ($exit_code === self::SERVER_ALREADY_RUNNING_CODE) { $this->assertTrue( $recurse, - "Typechecker still running after running hh_client stop" + 'Typechecker still running after running hh_client stop' ); // Server already running - 3.10 => 3.11 regression: // https://github.com/facebook/hhvm/issues/6646 diff --git a/system/vendor/nikic/fast-route/test/RouteCollectorTest.php b/system/vendor/nikic/fast-route/test/RouteCollectorTest.php index 11bcf1c..cc54407 100644 --- a/system/vendor/nikic/fast-route/test/RouteCollectorTest.php +++ b/system/vendor/nikic/fast-route/test/RouteCollectorTest.php @@ -2,8 +2,12 @@ namespace FastRoute; -class RouteCollectorTest extends \PHPUnit_Framework_TestCase { - public function testShortcuts() { +use PHPUnit\Framework\TestCase; + +class RouteCollectorTest extends TestCase +{ + public function testShortcuts() + { $r = new DummyRouteCollector(); $r->delete('/delete', 'delete'); @@ -25,7 +29,8 @@ class RouteCollectorTest extends \PHPUnit_Framework_TestCase { $this->assertSame($expected, $r->routes); } - public function testGroups() { + public function testGroups() + { $r = new DummyRouteCollector(); $r->delete('/delete', 'delete'); @@ -87,11 +92,17 @@ class RouteCollectorTest extends \PHPUnit_Framework_TestCase { } } -class DummyRouteCollector extends RouteCollector { +class DummyRouteCollector extends RouteCollector +{ public $routes = []; - public function __construct() {} - public function addRoute($method, $route, $handler) { + + public function __construct() + { + } + + public function addRoute($method, $route, $handler) + { $route = $this->currentGroupPrefix . $route; $this->routes[] = [$method, $route, $handler]; } -} \ No newline at end of file +} diff --git a/system/vendor/nikic/fast-route/test/RouteParser/StdTest.php b/system/vendor/nikic/fast-route/test/RouteParser/StdTest.php index 41f194b..e13e4de 100644 --- a/system/vendor/nikic/fast-route/test/RouteParser/StdTest.php +++ b/system/vendor/nikic/fast-route/test/RouteParser/StdTest.php @@ -2,22 +2,28 @@ namespace FastRoute\RouteParser; -class StdTest extends \PhpUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class StdTest extends TestCase +{ /** @dataProvider provideTestParse */ - public function testParse($routeString, $expectedRouteDatas) { + public function testParse($routeString, $expectedRouteDatas) + { $parser = new Std(); $routeDatas = $parser->parse($routeString); $this->assertSame($expectedRouteDatas, $routeDatas); } /** @dataProvider provideTestParseError */ - public function testParseError($routeString, $expectedExceptionMessage) { + public function testParseError($routeString, $expectedExceptionMessage) + { $parser = new Std(); $this->setExpectedException('FastRoute\\BadRouteException', $expectedExceptionMessage); $parser->parse($routeString); } - public function provideTestParse() { + public function provideTestParse() + { return [ [ '/test', @@ -112,7 +118,8 @@ class StdTest extends \PhpUnit_Framework_TestCase { ]; } - public function provideTestParseError() { + public function provideTestParseError() + { return [ [ '/test[opt', @@ -128,19 +135,19 @@ class StdTest extends \PhpUnit_Framework_TestCase { ], [ '/test[]', - "Empty optional part" + 'Empty optional part' ], [ '/test[[opt]]', - "Empty optional part" + 'Empty optional part' ], [ '[[test]]', - "Empty optional part" + 'Empty optional part' ], [ '/test[/opt]/required', - "Optional segments can only occur at the end of a route" + 'Optional segments can only occur at the end of a route' ], ]; } diff --git a/system/vendor/nikic/fast-route/test/bootstrap.php b/system/vendor/nikic/fast-route/test/bootstrap.php index 27e6d4c..3023f41 100644 --- a/system/vendor/nikic/fast-route/test/bootstrap.php +++ b/system/vendor/nikic/fast-route/test/bootstrap.php @@ -2,7 +2,7 @@ require_once __DIR__ . '/../src/functions.php'; -spl_autoload_register(function($class) { +spl_autoload_register(function ($class) { if (strpos($class, 'FastRoute\\') === 0) { $dir = strcasecmp(substr($class, -4), 'Test') ? 'src/' : 'test/'; $name = substr($class, strlen('FastRoute'));