diff --git a/lib/composer.json b/composer.json similarity index 50% rename from lib/composer.json rename to composer.json index edc301c..717b65a 100644 --- a/lib/composer.json +++ b/composer.json @@ -1,5 +1,8 @@ { "require": { "noccylabs/sdl": "~2.0" + }, + "config": { + "vendor-dir":"lib/vendor" } } diff --git a/lib/composer.lock b/lib/composer.lock deleted file mode 100644 index 820ffcb..0000000 --- a/lib/composer.lock +++ /dev/null @@ -1,271 +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": "99ecad19e8f5541913cd9eba4f5309a5", - "content-hash": "82d65a67454685f3a08b2b7171cb1dc3", - "packages": [ - { - "name": "noccylabs/sdl", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/noccylabs/php-sdl.git", - "reference": "ce8eabf6d1aa70ac8493a4235c904ce841ccabf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/noccylabs/php-sdl/zipball/ce8eabf6d1aa70ac8493a4235c904ce841ccabf8", - "reference": "ce8eabf6d1aa70ac8493a4235c904ce841ccabf8", - "shasum": "" - }, - "require": { - "psr/cache": "~1.0", - "symfony/expression-language": "~2.4 || ~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "NoccyLabs", - "email": "noccylabs@gmail.com" - } - ], - "description": "Simple Declarative Language (SDL)", - "time": "2016-06-17 20:41:53" - }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "time": "2016-08-06 20:24:11" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "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", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10 12:19:37" - }, - { - "name": "symfony/cache", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/cache.git", - "reference": "a2503bbf8ef729f4eb7b134efee6217f49ecd56d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/a2503bbf8ef729f4eb7b134efee6217f49ecd56d", - "reference": "a2503bbf8ef729f4eb7b134efee6217f49ecd56d", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "psr/cache": "~1.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/cache-implementation": "1.0" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/cache": "~1.6", - "doctrine/dbal": "~2.4", - "predis/predis": "~1.0" - }, - "suggest": { - "symfony/polyfill-apcu": "For using ApcuAdapter on HHVM" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Cache\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony implementation of PSR-6", - "homepage": "https://symfony.com", - "keywords": [ - "caching", - "psr6" - ], - "time": "2016-12-13 08:24:57" - }, - { - "name": "symfony/expression-language", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/expression-language.git", - "reference": "6ffbad90ac26e3aebc90798872a8b81979cf4fbd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/6ffbad90ac26e3aebc90798872a8b81979cf4fbd", - "reference": "6ffbad90ac26e3aebc90798872a8b81979cf4fbd", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/cache": "~3.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\ExpressionLanguage\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "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 ExpressionLanguage Component", - "homepage": "https://symfony.com", - "time": "2016-11-03 08:11:03" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/lib/vendor/autoload.php b/lib/vendor/autoload.php deleted file mode 100644 index 8a46426..0000000 --- a/lib/vendor/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - private $classMapAuthoritative = false; - private $missingClasses = array(); - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/lib/vendor/composer/LICENSE b/lib/vendor/composer/LICENSE deleted file mode 100644 index 1a28124..0000000 --- a/lib/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) 2016 Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/lib/vendor/composer/autoload_classmap.php b/lib/vendor/composer/autoload_classmap.php deleted file mode 100644 index 7a91153..0000000 --- a/lib/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,9 +0,0 @@ - array($vendorDir . '/noccylabs/sdl/src'), -); diff --git a/lib/vendor/composer/autoload_psr4.php b/lib/vendor/composer/autoload_psr4.php deleted file mode 100644 index 862b95c..0000000 --- a/lib/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,13 +0,0 @@ - array($vendorDir . '/symfony/expression-language'), - 'Symfony\\Component\\Cache\\' => array($vendorDir . '/symfony/cache'), - 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), - 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), -); diff --git a/lib/vendor/composer/autoload_real.php b/lib/vendor/composer/autoload_real.php deleted file mode 100644 index 704f36b..0000000 --- a/lib/vendor/composer/autoload_real.php +++ /dev/null @@ -1,52 +0,0 @@ -= 50600 && !defined('HHVM_VERSION'); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit11652f899f8a09a0f8f100a86427b814::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->register(true); - - return $loader; - } -} diff --git a/lib/vendor/composer/autoload_static.php b/lib/vendor/composer/autoload_static.php deleted file mode 100644 index 00304e4..0000000 --- a/lib/vendor/composer/autoload_static.php +++ /dev/null @@ -1,54 +0,0 @@ - - array ( - 'Symfony\\Component\\ExpressionLanguage\\' => 37, - 'Symfony\\Component\\Cache\\' => 24, - ), - 'P' => - array ( - 'Psr\\Log\\' => 8, - 'Psr\\Cache\\' => 10, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Symfony\\Component\\ExpressionLanguage\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/expression-language', - ), - 'Symfony\\Component\\Cache\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/cache', - ), - 'Psr\\Log\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', - ), - 'Psr\\Cache\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/cache/src', - ), - ); - - public static $fallbackDirsPsr0 = array ( - 0 => __DIR__ . '/..' . '/noccylabs/sdl/src', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit11652f899f8a09a0f8f100a86427b814::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit11652f899f8a09a0f8f100a86427b814::$prefixDirsPsr4; - $loader->fallbackDirsPsr0 = ComposerStaticInit11652f899f8a09a0f8f100a86427b814::$fallbackDirsPsr0; - - }, null, ClassLoader::class); - } -} diff --git a/lib/vendor/composer/installed.json b/lib/vendor/composer/installed.json deleted file mode 100644 index a0ad7d9..0000000 --- a/lib/vendor/composer/installed.json +++ /dev/null @@ -1,264 +0,0 @@ -[ - { - "name": "psr/cache", - "version": "1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2016-08-06 20:24:11", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ] - }, - { - "name": "psr/log", - "version": "1.0.2", - "version_normalized": "1.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2016-10-10 12:19:37", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Log\\": "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", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ] - }, - { - "name": "symfony/cache", - "version": "v3.2.1", - "version_normalized": "3.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/cache.git", - "reference": "a2503bbf8ef729f4eb7b134efee6217f49ecd56d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/a2503bbf8ef729f4eb7b134efee6217f49ecd56d", - "reference": "a2503bbf8ef729f4eb7b134efee6217f49ecd56d", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "psr/cache": "~1.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/cache-implementation": "1.0" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/cache": "~1.6", - "doctrine/dbal": "~2.4", - "predis/predis": "~1.0" - }, - "suggest": { - "symfony/polyfill-apcu": "For using ApcuAdapter on HHVM" - }, - "time": "2016-12-13 08:24:57", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Cache\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony implementation of PSR-6", - "homepage": "https://symfony.com", - "keywords": [ - "caching", - "psr6" - ] - }, - { - "name": "symfony/expression-language", - "version": "v3.2.1", - "version_normalized": "3.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/expression-language.git", - "reference": "6ffbad90ac26e3aebc90798872a8b81979cf4fbd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/6ffbad90ac26e3aebc90798872a8b81979cf4fbd", - "reference": "6ffbad90ac26e3aebc90798872a8b81979cf4fbd", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/cache": "~3.1" - }, - "time": "2016-11-03 08:11:03", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\ExpressionLanguage\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "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 ExpressionLanguage Component", - "homepage": "https://symfony.com" - }, - { - "name": "noccylabs/sdl", - "version": "2.0.2", - "version_normalized": "2.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/noccylabs/php-sdl.git", - "reference": "ce8eabf6d1aa70ac8493a4235c904ce841ccabf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/noccylabs/php-sdl/zipball/ce8eabf6d1aa70ac8493a4235c904ce841ccabf8", - "reference": "ce8eabf6d1aa70ac8493a4235c904ce841ccabf8", - "shasum": "" - }, - "require": { - "psr/cache": "~1.0", - "symfony/expression-language": "~2.4 || ~3.0" - }, - "time": "2016-06-17 20:41:53", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "NoccyLabs", - "email": "noccylabs@gmail.com" - } - ], - "description": "Simple Declarative Language (SDL)" - } -] diff --git a/lib/vendor/noccylabs/sdl/.gitignore b/lib/vendor/noccylabs/sdl/.gitignore deleted file mode 100644 index 486ec0f..0000000 --- a/lib/vendor/noccylabs/sdl/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/nbproject/private/ -vendor -composer.lock -/docs/generated diff --git a/lib/vendor/noccylabs/sdl/.travis.yml b/lib/vendor/noccylabs/sdl/.travis.yml deleted file mode 100644 index 4e2924e..0000000 --- a/lib/vendor/noccylabs/sdl/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: php -php: - - 5.4 - - 5.5 -branches: - only: - - sdl2 -install: - - composer self-update - - composer dump-autoload -script: phpunit --bootstrap tests/bootstrap.php tests/src/ diff --git a/lib/vendor/noccylabs/sdl/LICENSE b/lib/vendor/noccylabs/sdl/LICENSE deleted file mode 100644 index d7f1051..0000000 --- a/lib/vendor/noccylabs/sdl/LICENSE +++ /dev/null @@ -1,339 +0,0 @@ -GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {description} - Copyright (C) {year} {fullname} - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - {signature of Ty Coon}, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/lib/vendor/noccylabs/sdl/README.md b/lib/vendor/noccylabs/sdl/README.md deleted file mode 100644 index d27eff4..0000000 --- a/lib/vendor/noccylabs/sdl/README.md +++ /dev/null @@ -1,223 +0,0 @@ -[![Build Status](https://travis-ci.org/noccylabs/php-sdl.svg?branch=sdl2)](https://travis-ci.org/noccylabs/php-sdl) - -php-sdl 2.0 -=========== - -This is an implementation of the Simple Declarative Language (SDL) serialization -language for PHP. It has not thing to do with Simple Directmedia Layer. Think -of it like XML with less typing: - - greetings { - greeting "Aloha" where="Hawaii" - greeting "Hej" where="Sweden" - } - -This is the v2.0 rewrite of php-sdl, and as such some things are not quite -working yet. If you are looking for a working but not too extensible parser, -install the v1.x branch with composer, `composer require noccylabs/sdl:1.*`. -The current quirks are: - -* Not all `LiteralType`s are implemented. This is easily done now however, as - each type is in its own folder. -* The parser is broken still. -* Not all unit tests have been created. -* Comments can be generated, but not necessarily always parsed. -* Numeric types may lose precision. - -## Usage - -You shouldn't really use this right now. Here is a brief summary of what is working, -and what is not. Contributions and improvements are welcome. - -### Components - -| **Component** | **Description** | **Status** | -|:------------------------------|:-----------------------------|:----------:| -| `Sdl\SdlTag` | Creating tag trees | WORKING | -| `Sdl\SdlTag` | Encoding tags and children | WORKING | -| `Sdl\SdlTag` | Encoding tags with comments | WORKING | -| `Sdl\SdlTag` | Tree traversal | WORKING | -| `Sdl\SdlTag` | Tests implemented | PARTIAL | -| `Sdl\Parser\SdlParser` | Parsing tags and nested tags | WORKING | -| `Sdl\Parser\SdlParser` | Parsing tags with comments | | -| `Sdl\Parser\SdlParser` | Tests implemented | PARTIAL | -| `Sdl\LiteralType\TypeFactory` | LiteralType registering | PARTIAL | -| `Sdl\LiteralType\TypeFactory` | Tests implemented | PARTIAL | -| `Sdl\LiteralType\*Type` | All types implemented | PARTIAL | -| `Sdl\LiteralType\*Type` | Tests implemented | PARTIAL | -| `Sdl\Selector\SdlSelector` | Selecting with expressions | PARTIAL | -| `Sdl\Selector\SdlSelector` | Tests implemented | | - -### Functionality - -| **Function** | **Status** | -|:-------------------------------------------------------------|:----------:| -| Creating tag trees | WORKING | -| Encoding tag trees into SDL | WORKING | -| Parsing SDL into tag trees | PARTIAL | -| Navigating the tag tree | WORKING | -| Selecting tags with expressions | PARTIAL | -| Create LiteralTypes from native PHP variable types | WORKING | -| Create LiteralTypes from SDL tokens | PARTIAL | -| Access LiteralTypes as native PHP values | PARTIAL | -| Encode LiteralTypes into SDL tokens | PARTIAL | - -## Performance - -The parser is currently a little slow at reading, but this can probably be -optimized somewhat. Either way it offers a tidy alternative to the established -serialization formats (XML, JSON and YAML). It is important to remember that -the parsers for XML, JSON and YAML are running as native code, while the SDL -parser is written in PHP. - -That being said, it should be noted that php-sdl is best used with configuration -files that are not being requested at an excessive frequency (such as blog posts, -routing tables etc.) but rather for f.ex. job configurations, or immediate files -(like dumping blogposts into sdl for easy editing and import). - -Caching is implemented as it was in the 1.x version of the parser, i.e. the -cache file with the parsed tags is placed in the same directory as the SDL-fil -being parsed, with an identical filename except prefixed with a dot (.) and -suffixed with ".cache". For example "foo.sdl" would be cached as ".foo.sdl.cache". -This behaviour might change in the future. - -| **Format** | **Parser** | **10000x** | **Calls/s** | -|:----------:|:-------------------------------|--------------:|-------------:| -| SDL | SdlParser::parseString | 8.83s | 1132.50 | -| XML | DomDocument::loadXml | 0.43s | 23469.17 | -| JSON | json_decode | 0.26s | 38640.62 | -| YAML | yaml_parse_file | 0.44s | 22738.22 | - -Some possible improvements and optimizations include: - -* Improvements to the pre-parser optimization routines. -* Rewrite the parser using regular expressions (could be faster, could be slower) - -## Examples - -### Generating tag trees - -Generating is simple. Get a new root tag with `createRoot()` and start -adding your children. You can use the same fluid programming as you are used -to from Symfony2, where all the `setX()` methods return the current tag, and -a call to `end()` returns the parent node. `createChild()` is available to -create a tag, add it as a child to the current node, and return the newly -created child tag. - - use Sdl\SdlTag; - $tag = SdlTag::createRoot() - ->createChild("people") - ->createChild("person") - ->setValue("John Doe") - ->setAttribute("sex","male") - ->end() - ->end(); - echo $tag->encode(); - -Values and attributes can be assigned from PHP values, or directly via any of the -`LiteralType` descendants. - - use Sdl\SdlTag; - use Sdl\LiteralType\SdlBinary; - $tag = SdlTag::createRoot() - ->createChild("image") - ->setValue(new SdlBinary($file)) - ->setAttribute("type","image/jpeg") - ->end(); - -Remember to match your calls to `end()` to make sure you return the root -element when you are using the fluid method calls on a new root or non-variable: - - use Sdl\SdlTag; - $tag = SdlTag::createRoot(); - $tag->createChild("foo")->createChild("bar"); - // $tag will still point to the root even though end() wasn't called. - $bad = SdlTag::createRoot()->createChild("foo")->createChild("bar"); - // $bad will be pointing to "bar" here, not the root. - -You should however be able to get back to the root using `getParent()` if you -ever needed to: - - function root($tag) { - while(($parent = $tag->getParent()) - $tag = $parent; - return $tag; - } - -### Parsing a file - -To parse a file, use the `Sdl\Parser\SdlParser` class. It offers a few different -methods to parse content and return `Sdl\SdlTag` objects. - - use Sdl\Parser\SdlParser; - // Parse a file - $tag = SdlParser::parseFile("basic.sdl"); - // Parse a string - $tag = SdlParser::parseString($sdl_string); - -### Encoding tags to SDL - -Tags are encoded into SDL using the `encode()` method. If you need to write it -out to a file, use `file_put_contents()` or any other appropriate method to -write out the output from `encode()`. - - use Sdl\SdlTag; - // Create a new root - $tag = SdlTag::createRoot(); - // Add two children - $tag->addChild("foo")->setValuesFromArray([0, 1, 2 ]); - $tag->addChild("bar")->setValuesFromArray([2, 3, 4 ]); - // Output the final SDL - echo $tag->encode(); - -### Navigating children - -You can use `getAllChildren()`, `getChildrenByTagName(..)` to navigate the tree. - -The `SdlSelector` will provide a more convenient approach to querying the tree -with logical expressions. - - use Sdl\Parser\SdlParser; - $tag = SdlTag::createRoot(); - $tag->createChild("people") - ->createChild("person") - ->setValue("John Doe") - ->setAttribute("sex","male"); - $people = $tag->getChildrenByTagName("people")[0]->getAllChildren(); - echo "Person name: ".$people[0]->getValue()."\n"; - - // Enumerate children - foreach($tag->getAllChildren() as $ctag) { - printf("Tag: %s\n", $ctag->getTagName()); - } - -### Queries - -Queries make use of Symfony's ExpressionLanguage component to allow complex queries: - - use Sdl\Parser\SdlParser; - use Sdl\Selector\SdlSelector; - - // Load the data - $tag = SdlParser::parseFile(__DIR__."/sdl/products.sdl"); - // Create a new selector for the tag - $tag_sel = new SdlSelector($tag); - - // Execute the query - $expr = "/productcatalog/product[tag.attr('itemno')=='101-NAIL']"; - $item = $tag_sel->query($expr); - -## Development - -You can run the unit tests using **phpunit**: - - $ phpunit --bootstrap tests/bootstrap.php tests/src/ - -Just remember to create the autoloaders etc first using **composer**: - - $ composer dump-autoload - -When contributing code, follow the conventions used elsewhere and send a pull -request with your masterpiece. If you're too lazy to fix something yourself, or -more likely busy saving the world elsewhere, create an issue so someone else -can take care of it. diff --git a/lib/vendor/noccylabs/sdl/SDL.md b/lib/vendor/noccylabs/sdl/SDL.md deleted file mode 100644 index 333cc22..0000000 --- a/lib/vendor/noccylabs/sdl/SDL.md +++ /dev/null @@ -1,394 +0,0 @@ -# SDL Overview - -*(From http://107.20.201.134/display/SDL/Language+Guide)* - -SDL (Simple Declarative Language) was designed to provide a terse and perspicuous format for -describing common data structures and data types. Although XML is an excellent format for marking up -documents, embedding in free form text, and creating graphs it can be a cumbersome language for -expressing basic datastructures. SDL is particularly well suited for this purpose. Lists, maps, -trees, tables, and matrixes can be easily expressed in SDL. Following is a list of examples -demonstrating construction of various datastructures using typed data. - -Example 1: Creating a List - - numbers 12 53 2 635 - -Example 2: Creating a Map - - pets chihuahua="small" dalmation="hyper" mastiff="big" - -Example 3: Creating a Tree - - plants { - trees { - deciduous { - elm - oak - } - } - } - -Example 4: Creating a Matrix - - myMatrix { - 4 2 5 - 2 8 2 - 4 2 1 - } - -Example 5: A Tree of Nodes with Values and Attributes - - folder "myFiles" color="yellow" protection=on { - folder "my images" { - file "myHouse.jpg" color=true date=2005/11/05 - file "myCar.jpg" color=false date=2002/01/05 - } - folder "my documents" { - document "resume.pdf" - } - } - -Because of its terse syntax and type inference capabilities, SDL is ideally suited to applications -such as - - * Configuration Files - * Build Files - * Property Files - * Simple Object Serialization - * Log files (formatting and parsing) - -SDL was designed to be language agnostic. Currently APIs exist for Java and .NET (written in C#.) -C++, Python and Ruby ports are planned. - -## Tags - -A tag can contain a namespace, a name, a value list, attributes (with namespaces), and children. All -components are optional. If the name portion is ommited the tag name defaults to "content". -Namespaces default to the empty space (""). Names and namespaces are identifiers. - -Tags are written using the form: - - namespace:name values attributes { - children - } - -Tags are terminated with a new line (\n) or the ending bracket of a child list (}). Lines can be -continued by escaping the new line like so: - - values 3.5 true false "hello" \ - "more" "values" 345 12:23:41 - -Values are space separated literals and attributes are space separated key value pairs using the -format: - - namespace:key=value - -The namespace portion is optional. The namespace and key are SDL identifiers and the value is an SDL -literal. - -Children are SDL tags and may be nested to an arbitrary depth. They are indented by convention but -tabs are not significant in the language. - -As of SDL 1.1 tags can be listed separated by semicolons on the same line: - - tag1; tag2 "a value"; tag3 name="foo" - -## The Tag Data Structure - -Tag values and children are modelled as lists. Order is significant and duplicates are allowed. - -### Equality Test (Java) - - Tag tag1 = new Tag("root").read("nums 7 3"); - Tag tag2 = new Tag("root").read("nums 3 7"); - System.out.println(tag1.equals(tag2)); - // Will print "false". Value order is significant. - -Tag attributes are modelled as a sorted map. Order is not significant and duplicates are not -allowed. - -### Equality Test (C#) - - Tag tag1 = new Tag("root").ReadString("lights kitchen=on bathroom=off"); - Tag tag2 = new Tag("root").ReadString("lights bathroom=off kitchen=on"); - Console.WrintLine(tag1.Equals(tag2)); - // Will print "true". Attribute order is not significant. - -## Anonymous Tags - -Tags with no name are known as anonymous tags. They are automatically assigned the name "content". - -Example: An Anonymous Tag - - greetings { - "hello" language="English" - } - - # If we have a handle on the "greetings" tag we can access the - # anonymous child tag by calling - # Tag child1 = greetingTag.getChild("content"); - -Note: Anonymous tags must have at least one value - -Anonymous tags must have one or more values. They cannot contain only attributes. This design -decision was taken to avoid confusion between a tag with a single value and an anonymous tag -containing only one attribute. - - # Not allowed: An anonymous tag with a single attribute (and no values)... - size=5 - - # ...because it could easily be confused with a tag having a single value - size 5 - -## Identifiers - -An SDL identifier starts with a unicode letter or underscore (_) followed by zero or more unicode -letters, numbers, underscores (_), dashes (-), periods (.) and dollar signs ($). Examples of valid -identifiers are: - - myName - myName123 - my-name - my_name - _my-name - my_name_ - com.ikayzo.foo - -## Literals - -SDL supports 13 literal types. They are (parenthesis indicate optional components): - - * unicode string - examples: "hello" or `aloha` - * unicode character - example: '/' - Note: \uXXXX style unicode escapes are not supported (or -needed because sdl files are UTF8) - * integer (32 bits signed) - example: 123 - * long integer (64 bits signed) - examples: 123L or 123l - * float (32 bits signed) - examples 123.43F or 123.43f - * double float (64 bits signed) - example: 123.43 or 123.43d or 123.43D - * decimal (128+ bits signed*) - example: 123.44BD or 123.44bd - * boolean - examples: true or false or on or off - * date yyyy/mm/dd - example 2005/12/05 - * date time yyyy/mm/dd hh:mm(:ss)(.xxx)(-ZONE) - * time span using the format (d:)hh:mm:ss(.xxx) - * binary [standard Base64] example - [sdf789GSfsb2+3324sf2] - * null A literal for a null value (must be lower case) example - null - -Notes: For platforms that do not support this level of precision, decimal should resolve to the most -accurate decimal representation possible. - -## String Literals - -There are two ways to write a string literal. Double quoted literals begin and end with a double -quote ("). They cannot span lines unless the new line is escaped. If the new line is escaped, all -white space to the left of the first non-white space character in the next line is ignored. For -example, if we write - - test "john \ - doe" - -The test tag's value will be "john doe". The space before the escape is preserved, but the space -before the "d" in "doe" is ignored. White space characters (\n\r\t ), backslashes () and double -quotes (") must be escaped in double quote literals. - -Examples: Double Quote String Literals - - name "hello" - line "he said \"hello there\"" - whitespace "item1\titem2\nitem3\titem4" - continued "this is a long line \ - of text" - -The second type of string literal is the backquote (`) literal. It functions much like Python's -triple quote (""") or C#'s at quote (@""). All characters including whitespace between backquotes -are preserved. It is not necessary (or possible) to escape any type of character in a backquote -literal. - -Examples: Backquote String Literals - - winfile `c:\directory\myfile.xls` - talk `I said "something"` - xml ` - - - - ` - regex `\w+\.suite\(\)` - -Note: SDL interprets new lines in backquote String literals as a single new line character (\n) -regarless of the platform. - -## Binary Literals - -Binary literals use base64 characters enclosed in square brackets ([]). The binary literal type can -also span lines. White space is ignored. - -Examples: Binary Literals - - key [sdf789GSfsb2+3324sf2] name="my key" - image [ - R3df789GSfsb2edfSFSDF - uikuikk2349GSfsb2edfS - vFSDFR3df789GSfsb2edf - ] - upload from="ikayzo.org" data=[ - R3df789GSfsb2edfSFSDF - uikuikk2349GSfsb2edfS - vFSDFR3df789GSfsb2edf - ] - -## Date and Date/Time Literals - -SDL supports date and date/time literals. Date and date/time literals use a 24 hour clock (0-23). If -a timezone is not specified, the default locale's timezone will be used. - -Examples: Date and Date/Time Literals - - # create a tag called "date" with a date value of Dec 5, 2005 - date 2005/12/05 - - # a date time literal without a timezone - here 2005/12/05 14:12:23.345 - - # a date time literal with a timezone - in_japan 2005/12/05 14:12:23.345-JST - -Note: Timezones must be specified using a valid timezone ID (ex. America/Los_Angeles), three letter -abbreviation (ex. HST), or GMT(+/-)hh(:mm) formatted custom timezone (ex. GMT+02 or GMT+02:30) - -## Time Span Literals - -SDL Time Span literals represent a length of time (which may be negative.) TimeSpan literals are -useful for expressing the duration of an event, intervals, or chronological distances from a -reference point. - -Examples: Time Span Literals - - hours 03:00:00 - minutes 00:12:00 - seconds 00:00:42 - short_time 00:12:32.423 # 12 minutes, 32 seconds, 423 milliseconds - long_time 30d:15:23:04.023 # 30 days, 15 hours, 23 mins, 4 secs, 23 millis - before -00:02:30 # 2 hours and 30 minutes ago - about_two_days_ago -2d:00:04:00 - - -note 1: hours, minutes, and seconds are required - days and milliseconds are optional - -note 2: if the day component is included it must be suffixed with a lower case 'd' - - -## Comments - -SDL supports four comment types. - -The first three are line comment types. Line comments can start with a #, //, or --. Everything -between the beginning of the single line comment and the new line is ignored. The – style -separator comment is often used to visually separate sections like so: - - ints 1 2 3 - doubles 5.0 3.1 6.4 - - ------------------ - - lists { - 6 3 5 1 - 'a' 'r' 'q' - "bag" "of" "tricks" - } - -The fourth type of comment is the /* */ style multiline comment used in Java and C family languages. -Everything between the /* and */ is ignored. /* */ comments may span lines and occur in the middle -of lines. - -Examples: Multiline Comments - - myInts 1 2 /* 3 */ 4 // note: this list will contain 1, 2 and 4 - - tag1 "fee" - /* - tag2 "fi" - tag3 "fo" - */ - tag4 "fum" - -## SDL Files - -SDL files (any file ending with the extension .sdl) should always be encoded using UTF-8. The use of -unicode escaping (such as the \uxxxx format used by Java and C#) is not supported or required. Non -ASCII characters should be entered directly using a UTF-8 capable editor. - -Note: ASCII is transparently encoded in UTF8, so ASCII files can be used if only ASCII characters -are required. - -Example SDL File - - # a tag having only a name - my_tag - - # three tags acting as name value pairs - first_name "Akiko" - last_name "Johnson" - height 68 - - # a tag with a value list - person "Akiko" "Johnson" 68 - - # a tag with attributes - person first_name="Akiko" last_name="Johnson" height=68 - - # a tag with values and attributes - person "Akiko" "Johnson" height=60 - - # a tag with attributes using namespaces - person name:first-name="Akiko" name:last-name="Johnson" - - # a tag with values, attributes, namespaces, and children - my_namespace:person "Akiko" "Johnson" dimensions:height=68 { - son "Nouhiro" "Johnson" - daughter "Sabrina" "Johnson" location="Italy" { - hobbies "swimming" "surfing" - languages "English" "Italian" - smoker false - } - } - - ------------------------------------------------------------------ - // (notice the separator style comment above...) - - # a log entry - # note - this tag has two values (date_time and string) and an - # attribute (error) - entry 2005/11/23 10:14:23.253-GMT "Something bad happened" error=true - - # a long line - mylist "something" "another" true "shoe" 2002/12/13 "rock" \ - "morestuff" "sink" "penny" 12:15:23.425 - - # a long string - text "this is a long rambling line of text with a continuation \ - and it keeps going and going..." - - # anonymous tag examples - - files { - "/folder1/file.txt" - "/file2.txt" - } - - # To retrieve the files as a list of strings - # - # List files = tag.getChild("files").getChildrenValues("content"); - # - # We us the name "content" because the files tag has two children, each of - # which are anonymous tags (values with no name.) These tags are assigned - # the name "content" - - matrix { - 1 2 3 - 4 5 6 - } - - # To retrieve the values from the matrix (as a list of lists) - # - # List rows = tag.getChild("matrix").getChildrenValues("content"); - diff --git a/lib/vendor/noccylabs/sdl/composer.json b/lib/vendor/noccylabs/sdl/composer.json deleted file mode 100644 index 57b573e..0000000 --- a/lib/vendor/noccylabs/sdl/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "noccylabs/sdl", - "type": "library", - "description": "Simple Declarative Language (SDL)", - "license": "GPL-2.0+", - "authors": [ - { - "name": "NoccyLabs", - "email": "noccylabs@gmail.com" - } - ], - "require": { - "symfony/expression-language":"~2.4 || ~3.0", - "psr/cache":"~1.0" - }, - "autoload": { - "psr-0": { "": "src/" } - }, - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - } -} diff --git a/lib/vendor/noccylabs/sdl/examples/fluid-creation.php b/lib/vendor/noccylabs/sdl/examples/fluid-creation.php deleted file mode 100644 index ed17e42..0000000 --- a/lib/vendor/noccylabs/sdl/examples/fluid-creation.php +++ /dev/null @@ -1,51 +0,0 @@ -createChild("configuration") - ->createComment("Database configuration") - ->createChild("database") - ->createChild("connection") - ->setValuesFromArray(["pdo+sqlite://@APP_DATA/master.db"]) - ->setAttribute("charset", "UTF-8") - ->end() - ->createChild("cache") - ->setValue("appdata://cache/") - ->end() - ->end() - ->createComment("Directories and search paths") - ->createChild("directories") - ->createChild("data") - ->setValuesFromArray(["./data/"]) - ->end() - ->end() - ->encode(); diff --git a/lib/vendor/noccylabs/sdl/examples/parse-file.php b/lib/vendor/noccylabs/sdl/examples/parse-file.php deleted file mode 100644 index 830d242..0000000 --- a/lib/vendor/noccylabs/sdl/examples/parse-file.php +++ /dev/null @@ -1,29 +0,0 @@ -encode(); diff --git a/lib/vendor/noccylabs/sdl/examples/parse-string.php b/lib/vendor/noccylabs/sdl/examples/parse-string.php deleted file mode 100644 index b5533e9..0000000 --- a/lib/vendor/noccylabs/sdl/examples/parse-string.php +++ /dev/null @@ -1,30 +0,0 @@ -encode(); diff --git a/lib/vendor/noccylabs/sdl/examples/people.php b/lib/vendor/noccylabs/sdl/examples/people.php deleted file mode 100644 index bdbd4fd..0000000 --- a/lib/vendor/noccylabs/sdl/examples/people.php +++ /dev/null @@ -1,61 +0,0 @@ -createChild("people") - - ->createComment("Person 1: John Doe") - ->createChild("person") - ->setValue("John Doe") - ->setAttribute("sex","male") - ->end() - - ->createComment("Person 2: Jane Doe") - ->createChild("person") - ->setValue("Jane Doe") - ->setAttribute("sex","female") - ->end() - - ->createComment("Person 3: Uncle Doe") - ->createChild("person") - ->setValue("Uncle Doe") - ->setAttribute("sex","male") - ->setAttribute("alive",false) - ->setAttribute("died", new SdlDate("2013-3-13")) - ->createComment("Number of children: 2") - ->createChild("children") - ->setValuesFromArray(["Bob Doe", "Francis Doe"]) - ->end() - ->end() - - ->end(); -echo $tag->encode(); diff --git a/lib/vendor/noccylabs/sdl/examples/sdl/basic.sdl b/lib/vendor/noccylabs/sdl/examples/sdl/basic.sdl deleted file mode 100644 index 5f328c9..0000000 --- a/lib/vendor/noccylabs/sdl/examples/sdl/basic.sdl +++ /dev/null @@ -1,9 +0,0 @@ -person { - name "John Doe" - age 33 - location "Liverpool" country="UK" - hobbies { - "Fishing" - "Forking" - } -} diff --git a/lib/vendor/noccylabs/sdl/examples/sdl/complex.sdl b/lib/vendor/noccylabs/sdl/examples/sdl/complex.sdl deleted file mode 100644 index e2c1c19..0000000 --- a/lib/vendor/noccylabs/sdl/examples/sdl/complex.sdl +++ /dev/null @@ -1,7 +0,0 @@ -package { - package:name "foo.foopackage" - depends { - package "foo.barpackage" version="2.*" - package "bar.bazpackage" - } -} diff --git a/lib/vendor/noccylabs/sdl/examples/sdl/products.sdl b/lib/vendor/noccylabs/sdl/examples/sdl/products.sdl deleted file mode 100644 index c1cea5b..0000000 --- a/lib/vendor/noccylabs/sdl/examples/sdl/products.sdl +++ /dev/null @@ -1,15 +0,0 @@ -productcatalog { - product "Hammer" itemno="100-HAMMER" { - tags "hammer" "nail" - description:en "The perfect hammer for treating every problem like a nail!" - price:usd "19.99" - price:eur "22.49" - } - product "Nail" itemno="101-NAIL" { - tags "nail" - description:en "Generic nail for use with [100-HAMMER]. 50 per box." - package pcs=50 - price:usd "4.19" - price:eur "5.55" - } -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/examples/selecting-tags.php b/lib/vendor/noccylabs/sdl/examples/selecting-tags.php deleted file mode 100644 index 1644ab5..0000000 --- a/lib/vendor/noccylabs/sdl/examples/selecting-tags.php +++ /dev/null @@ -1,39 +0,0 @@ -encode(); -echo "\n"; - -$tag_sel = new SdlSelector($tag); - -$expr = "/productcatalog/product[tag.attr('itemno')=='101-NAIL']"; -echo "Query: {$expr}\n"; -$deps = $tag_sel->query($expr); -foreach($deps as $dep) -{ - echo $dep->encodeTag(); -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/examples/traversal.php b/lib/vendor/noccylabs/sdl/examples/traversal.php deleted file mode 100644 index 3c2f677..0000000 --- a/lib/vendor/noccylabs/sdl/examples/traversal.php +++ /dev/null @@ -1,36 +0,0 @@ -getChildrenByTagName("package"); -$pkg_name = $packages[0] - ->getChildrenByTagName("package:name")[0] - ->getValue(); -echo "Package name: {$pkg_name}\n"; - - diff --git a/lib/vendor/noccylabs/sdl/examples/using-literaltypes.php b/lib/vendor/noccylabs/sdl/examples/using-literaltypes.php deleted file mode 100644 index c7cd4bc..0000000 --- a/lib/vendor/noccylabs/sdl/examples/using-literaltypes.php +++ /dev/null @@ -1,67 +0,0 @@ -: %s\n", $v->getType(), $v->getSdlLiteral()); - } - else - { - var_dump($v); - } -} - -// Creating dates -dump(new SdlDate("2014-01-01")); - -// This will end up being true -dump(new SdlBoolean("no")); -// this one is false -dump(SdlBoolean::fromLiteral("no")); - -// Floats can be cast to Ints. Note that SDL floats map to PHP doubles. -$my_float = new SdlFloat(3.14); -dump($my_float); -$my_int = $my_float->castTo(new SdlInteger); -dump($my_int); - -// Binary data -dump(new SdlBinary("Hello World!")); -$data = substr(file_get_contents(__FILE__),0,100); -dump(new SdlBinary($data)); - -// Nulls -dump(new SdlNull); \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/nbproject/project.properties b/lib/vendor/noccylabs/sdl/nbproject/project.properties deleted file mode 100644 index b0cfa96..0000000 --- a/lib/vendor/noccylabs/sdl/nbproject/project.properties +++ /dev/null @@ -1,24 +0,0 @@ -auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_create_2e_tests=true -auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_enabled=true -auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_path=tests/bootstrap.php -auxiliary.org-netbeans-modules-php-phpunit.configuration_2e_enabled=false -auxiliary.org-netbeans-modules-php-phpunit.configuration_2e_path= -auxiliary.org-netbeans-modules-php-phpunit.customSuite_2e_enabled=false -auxiliary.org-netbeans-modules-php-phpunit.customSuite_2e_path= -auxiliary.org-netbeans-modules-php-phpunit.phpUnit_2e_enabled=false -auxiliary.org-netbeans-modules-php-phpunit.phpUnit_2e_path= -auxiliary.org-netbeans-modules-php-phpunit.test_2e_groups_2e_ask=false -auxiliary.org-netbeans-modules-php-phpunit.test_2e_run_2e_all=true -code.analysis.excludes= -file.reference.php-sdl-tests=tests -ignore.path= -include.path=${php.global.include.path} -php.version=PHP_54 -project.license=gpl20 -source.encoding=UTF-8 -src.dir=. -tags.asp=false -tags.short=false -test.src.dir=${file.reference.php-sdl-tests} -testing.providers=PhpUnit -web.root=. diff --git a/lib/vendor/noccylabs/sdl/nbproject/project.xml b/lib/vendor/noccylabs/sdl/nbproject/project.xml deleted file mode 100644 index 9ede468..0000000 --- a/lib/vendor/noccylabs/sdl/nbproject/project.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - org.netbeans.modules.php.project - - - php-sdl - - - diff --git a/lib/vendor/noccylabs/sdl/phpunit.xml b/lib/vendor/noccylabs/sdl/phpunit.xml deleted file mode 100644 index f88064c..0000000 --- a/lib/vendor/noccylabs/sdl/phpunit.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - tests/src/ - - - diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/Exception/ParserException.php b/lib/vendor/noccylabs/sdl/src/Sdl/Exception/ParserException.php deleted file mode 100644 index 406eed4..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/Exception/ParserException.php +++ /dev/null @@ -1,31 +0,0 @@ - string: Hello World - * 492 -> int: 492 - * - * And also be able to format and return the respective literal tokens, f.ex.: - * bool:true -> "on" - * float:3.14 -> 3.14f - * - * The getValue() and setValue() should cast the values as needed to match the - * respective types, f.ex. assigning "no" to an SdlBool will be the same as - * passing true (as ((bool)"no")) == true). Passing no to setSdlLiteral will - * result in false (as it is not a string, no can't be quoted when passed). - * - */ -abstract class LiteralType -{ - - /** - * Constructor - * - * @param mixed $value The value to assign - * @param bool $from_literal If true the value is parsed as a literal - */ - public function __construct($value=null, $from_literal=false) - { - if ($from_literal) - { - $this->setSdlLiteral($value); - } - else - { - $this->setValue($value); - } - } - - /** - * Create a new instance from the specific derived literal type by passing - * it a string literal. - * - * @param type $value - * @return \Sdl\LiteralType\type_class - */ - public static function fromLiteral($value) - { - $type_class = get_called_class(); - $type_inst = new $type_class; - $type_inst->setSdlLiteral($value); - return $type_inst; - } - - /** - * Get the name of the type represented by the instance. - * - * @return string The type name, f.ex. "SdlString" - */ - public function getType() - { - return preg_replace("|(.*)\\\\|","",get_called_class()); - } - - /** - * Cast a value type into another type. - * - * @param \Sdl\LiteralType\LiteralType $target The instance to cast the value to. - * @return \Sdl\LiteralType\LiteralType The cast value. - */ - public function castTo(LiteralType $target) - { - $target->setValue($this->getValue()); - return $target; - } - - /** - * Get the value as its native PHP type. - * - * @return mixed The value - */ - abstract public function getValue(); - - /** - * Set the value from its native PHP type. - * - * @param mixed $value The new value - */ - abstract public function setValue($value); - - /** - * Return the SDL literal as a string. - * - * @return string The SDL literal as a string - */ - abstract public function getSdlLiteral(); - - /** - * Set the value from its SDL literal. - * - * @param string $string The SDL literal - */ - abstract public function setSdlLiteral($string); - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlBinary.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlBinary.php deleted file mode 100644 index d9048c7..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlBinary.php +++ /dev/null @@ -1,60 +0,0 @@ -value = (string)$value; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($literal) - { - $buf = preg_replace("/\w\n\t/","",trim($literal,"[]")); - $this->value = base64_decode($buf); - return $this; - } - - public function getSdlLiteral() - { - $value = wordwrap((string)base64_encode($this->value), 75, "\n ",true); - if (strpos($value,"\n")!==false) - { - return "[\n ".$value."\n]"; - } - return "[{$value}]"; - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlBoolean.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlBoolean.php deleted file mode 100644 index 87861f7..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlBoolean.php +++ /dev/null @@ -1,66 +0,0 @@ -value = (bool)$value; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($value) - { - if (is_string($value)) - { - if (in_array($value, [ "off", "false", "no" ])) - { - $value = false; - } - } - $this->value = (bool)$value; - } - - public function getSdlLiteral() - { - return $this->value?"yes":"no"; - - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlCharacter.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlCharacter.php deleted file mode 100644 index 8b00511..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlCharacter.php +++ /dev/null @@ -1,56 +0,0 @@ -value = (string)$value; - } - - public function getValue() - { - $value = substr($this->value,0,1); - return $value; - } - - public function setSdlLiteral($literal) - { - $this->value = trim($literal,"'"); - return $this; - } - - public function getSdlLiteral() - { - $value = substr($this->value,0,1); - return "'{$value}'"; - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDate.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDate.php deleted file mode 100644 index a753dad..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDate.php +++ /dev/null @@ -1,58 +0,0 @@ -value = $date; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($string) - { - $this->value = (int)$string; - } - - public function getSdlLiteral() - { - return date("Y/m/d",$this->value); - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDateTime.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDateTime.php deleted file mode 100644 index 78aa365..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDateTime.php +++ /dev/null @@ -1,75 +0,0 @@ -value = $date; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($string) - { - $match = null; - preg_match_all(self::RE_DATETIME, $value, $match); - list($year, $month, $day) = [(int) $match[1][0], (int) $match[2][0], (int) $match[3][0]]; - list($hour, $minute, $second) = [(int) $match[4][0], (int) $match[5][0], $match[6][0]]; - list($micro, $tz) = [(float) $match[7][0], (string) $match[8][0]]; - if ($second) - $second = (int) substr($second, 1); - else - $second = 0; - if ($tz && (!defined("SDL_IGNORE_TIMEZONE"))) - { - throw new SdlParserException("Timezones for dates are not implemented. Define SDL_IGNORE_TIMEZONE to disable this exception.", SdlParserException::ERR_NOT_IMPLEMENTED); - } - // TODO: Implement timezones - $ts = mktime($hour, $minute, $second, $month, $day, $year); // - $ts+= $micro; - //echo "{$value} =>\n Y: {$year}\n M: {$month}\n D: {$day}\n H: {$hour}\n M: {$minute}\n S: {$second}\n µ: {$micro}\n TZ: {$tz}\n ==> {$ts}\n"; - $this->value = $ts; - } - - public function getSdlLiteral() - { - return date("Y/m/d h:i:s",$this->value); - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDecimal.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDecimal.php deleted file mode 100644 index 36de05b..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDecimal.php +++ /dev/null @@ -1,62 +0,0 @@ -value = $value; - } - throw new \Sdl\Exception\TypeException("Invalid value for SdlDecimal"); - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($string) - { - if (preg_match(self::$match_pattern, $string)) - { - $this->value = substr($string,0,-2); - } - throw new \Sdl\Exception\TypeException("Invalid literal for SdlDecimal"); - } - - public function getSdlLiteral() - { - return $this->value; - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDouble.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDouble.php deleted file mode 100644 index b92da7a..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlDouble.php +++ /dev/null @@ -1,53 +0,0 @@ -value = (double)$value; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($string) - { - $this->value = (double)$string; - } - - public function getSdlLiteral() - { - return $this->value; - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlFloat.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlFloat.php deleted file mode 100644 index d242ac4..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlFloat.php +++ /dev/null @@ -1,54 +0,0 @@ -value = (float)$value; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($string) - { - $this->value = (float)$string; - } - - public function getSdlLiteral() - { - return $this->value; - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlInteger.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlInteger.php deleted file mode 100644 index 33e7957..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlInteger.php +++ /dev/null @@ -1,54 +0,0 @@ -value = (int)$value; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($string) - { - $this->value = (int)$string; - } - - public function getSdlLiteral() - { - return $this->value; - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlLongInt.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlLongInt.php deleted file mode 100644 index 2c055a5..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlLongInt.php +++ /dev/null @@ -1,53 +0,0 @@ -value = (int)$value; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($string) - { - $this->value = (int)$string; - } - - public function getSdlLiteral() - { - return $this->value.'l'; - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlNull.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlNull.php deleted file mode 100644 index 2b81cd3..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlNull.php +++ /dev/null @@ -1,50 +0,0 @@ -value = (string)$value; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($literal) - { - $this->value = trim($literal,"`"); - return $this; - } - - public function getSdlLiteral() - { - return "`{$value}`"; - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlString.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlString.php deleted file mode 100644 index 417f459..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlString.php +++ /dev/null @@ -1,67 +0,0 @@ -value = (string)$value; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($literal) - { - $strval = substr($literal, 1, strlen($literal) - 2); - if (strpos($strval, "\n") !== false) - { - $strs = explode("\n", $strval); - $stro = array_shift($strs); - foreach ($strs as $str) - { - $stro = rtrim(rtrim($stro), "\\") . ltrim($str); - } - $strval = $stro; - } - $value = stripcslashes($strval); - $this->value = $value; - return $this; - } - - public function getSdlLiteral() - { - $value = addcslashes($this->value,"\0..\37"); - return "\"{$value}\""; - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlTimespan.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlTimespan.php deleted file mode 100644 index 61fca58..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/SdlTimespan.php +++ /dev/null @@ -1,66 +0,0 @@ -value = $date; - } - - public function getValue() - { - return $this->value; - - } - - public function setSdlLiteral($string) - { - $match = null; - preg_match_all(self::$match_pattern, $string, $match); - list($days, $hours, $minutes, $seconds, $micro) = [(int) $match[1][0], (int) $match[2][0], (int) $match[3][0], (int) $match[4][0], (float) $match[5][0]]; - $time = ($seconds) + ($minutes * 60) + ($hours * 60 * 60) + ($days * 60 * 60 * 24); - if ($micro) - $time += $micro; - // echo "{$value} =>\n H: {$hours}\n M: {$minutes}\n S: {$seconds}\n ==> {$time}\n"; - - $this->value = $time; - } - - public function getSdlLiteral() - { - return date("Y/m/d",$this->value); - } - -} \ No newline at end of file diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/TypeFactory.php b/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/TypeFactory.php deleted file mode 100644 index ceadf20..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/LiteralType/TypeFactory.php +++ /dev/null @@ -1,168 +0,0 @@ -getString()); - } - - /** - * Convert a string into a LiteralType. If a LiteralType is passed, it will - * be returned unmodified. - * - * If no types have been registered with registerLiteralType() or - * registerDefaultTypes(), registerDefaultTypes() will be called automatically. - * - * @param mixed|\Sdl\LiteralType\LiteralType $value The value to convert into a LiteralType - * @return \Sdl\LiteralType\LiteralType|null The LiteralType - */ - public static function createFromString($value) - { - if ($value instanceof LiteralType) - { - return $value; - } - - if (count(self::$types) == 0) - { - self::registerDefaultTypes(); - } - - foreach(self::$types as $match=>$class) - { - if (preg_match($match, $value)) - { - return $class::fromLiteral($value); - } - } - - throw new TypeException("No matching literal type for '{$value}'"); - - } - - /** - * Return a LiteralType derived instance representing the provided PHP - * value. - * - * If no types have been registered with registerLiteralType() or - * registerDefaultTypes(), registerDefaultTypes() will be called automatically. - * - * @param mixed $var The PHP value to convert into a LiteralType - * @return \Sdl\LiteralType\LiteralType The LiteralValue - */ - public static function createFromPhpValue($var) - { - - // Register default types if there are no types loaded. - if (count(self::$types) == 0) - { - self::registerDefaultTypes(); - } - - // Get the var type and check the known types to find a match - $type = gettype($var); - if (array_key_exists($type,self::$php_types)) - { - $class = self::$php_types[$type]; - return new $class($var); - } - - throw new TypeException("No matching literal type for type '{$type}'"); - //var_dump(self::$php_types); - - } - - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/Parser/ParserToken.php b/lib/vendor/noccylabs/sdl/src/Sdl/Parser/ParserToken.php deleted file mode 100644 index 113fae9..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/Parser/ParserToken.php +++ /dev/null @@ -1,158 +0,0 @@ -token = $token; - $this->string = $string; - $this->line = $line; - } - - /** - * Creates and returns a Token from the output of token_get_all - * - * @static - * @param string|array $token The token as a single string or array - * @return \Sdl\Parser\ParserToken - */ - public static function createFromPhpToken($token) - { - if (is_array($token)) - { - return new ParserToken($token[0],$token[1],$token[2]); - } - else - { - return new ParserToken(null, $token); - } - - } - - /** - * Set the token id - * - * @param int $token The token id - * @return \Sdl\Parser\ParserToken - */ - public function setToken($token) - { - $this->token = $token; - return $this; - } - - /** - * Set the token string - * - * @param string $string The token string - * @return \Sdl\Parser\ParserToken - */ - public function setString($string) - { - $this->string = $string; - return $this; - } - - /** - * Set the line number - * - * @param int $line The line number - * @return \Sdl\Parser\ParserToken - */ - public function setLineNumber($line) - { - $this->line = $line; - return $this; - } - - /** - * Return the token id - * - * @return int The token id - */ - public function getToken() - { - return $this->token; - } - - /** - * Return the token id as a string - * - * @return string The token id as a string - */ - public function getTokenName() - { - if (null !== $this->token) - { - return token_name($this->token); - } - return "NULL"; - } - - /** - * Return the token string - * - * @return string The token string - */ - public function getString() - { - return $this->string; - } - - /** - * Return the line number of the token - * - * @return int The line number - */ - public function getLineNumber() - { - return $this->line; - } - - /** - * PHP string cast. - * - * @return string String cast - */ - public function __toString() - { - return $this->string; - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/Parser/SdlParser.php b/lib/vendor/noccylabs/sdl/src/Sdl/Parser/SdlParser.php deleted file mode 100644 index b7a7605..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/Parser/SdlParser.php +++ /dev/null @@ -1,174 +0,0 @@ -parseString($string); - return $parser->parseFromTokenStream($tokens); - } - - public function parseFromTokenStream(TokenStream $token_stream) - { - // Create new root node - $root = new SdlTag; - $root->setTagName(self::ROOT_TAG); - // Rewind the token stream - $token_stream->rewind(); - // Clean up the stream - $sdl_tokens = $token_stream->filterTokens(function($token) { - $str = $token->getString(); - if (strpos($str, "\n") !== false) { - $token->setString("\n"); - } - elseif (trim($str)=="") - { - return null; - } - return $token; - })->asStringArray(); - // process namespaces, merge them with the keys - $out_tokens = []; $last=null; - foreach($sdl_tokens as $token) - { - if ($last == ":") - { - $out_tokens[count($out_tokens)-1].=":".$token; - } - elseif ($token == ":") - { - // skip - } - else - { - $out_tokens[] = $token; - } - $last = $token; - } - - $this->tokens = $out_tokens; - while (count($this->tokens) > 0) - { - $this->parseTokens($root); // , $out_tokens); - } - - return $root; - - } - - private function parseTokens(SdlTag &$tag) - { - $_ = [null,[],[]]; - while (count($this->tokens) > 0) - { - $tok = array_shift($this->tokens); - if (($tok == ";") || ($tok == "\n") || ($tok == "{")) - { - if ($_[0]) - { - $_tag = new SdlTag($_[0]); - $_[1] = array_map("Sdl\\LiteralType\\TypeFactory::createFromString", $_[1]); - foreach($_[2] as $k=>$v) - { - $_tag->setAttribute($k, TypeFactory::createFromString($v)); - } - $_tag->setValuesFromArray($_[1]); - $tag->addChild($_tag); - //echo "{$_[0]}:\n"; var_dump($_[1]); var_dump($_[2]); echo "\n\n"; - } - $_ = [null,[],[]]; - if ($tok == "{") - { - $this->parseTokens($_tag); - } - } - elseif ($tok == "}") - { - return; - } - elseif ($_[0]==null) - { - if (SdlUtils::isValidIdentifier($tok)) - { - $_[0] = $tok; - } - else - { - $_[0] = "value"; - $_[1][] = $tok; - } - } - else - { - if ($tok == "=") - { - $attr_name = array_pop($_[1]); - $val = array_shift($this->tokens); - $_[2][$attr_name] = $val; - } - else - { - $_[1][] = $tok; - } - } - } - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/Parser/TokenStream.php b/lib/vendor/noccylabs/sdl/src/Sdl/Parser/TokenStream.php deleted file mode 100644 index 2fd7951..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/Parser/TokenStream.php +++ /dev/null @@ -1,215 +0,0 @@ -tokens = []; - // Append a tokens[] = ParserToken::createFromPhpToken($token); - } - } - - public function addToken(ParserToken $token) - { - $this->tokens[] = $token; - } - - public function pushToken(ParserToken $token) - { - array_unshift($this->tokens, $token); - } - - public function asString() - { - $out = null; - foreach($this->tokens as $token) - { - $out .= $token->getString(); - } - return $out; - } - - public function asStringArray() - { - $out = []; - foreach($this->tokens as $token) - { - $out[] = $token->getString(); - } - return $out; - } - - private function matchToken(ParserToken $token, $match) - { - if (is_array($match)) - { - foreach($match as $item) - { - if ($this->matchToken($token,$item)) - { - return true; - } - } - return false; - } - if (is_int($match)) - { - return ($token->getToken() == $match); - } - if (is_string($match)) - { - return ($token->getString() == $match); - } - return false; - } - - /** - * Return an array of tokens up until the one that does not match the - * specified tokens. - * - * @param type $match - * @return type - */ - public function getUntil($match) - { - $out = new TokenStream; - while ($this->valid()) - { - $current = $this->current(); - if ($this->matchToken($current,$match)) - { - break; - } - $out->addToken($this->current()); - $this->next(); - } - return $out; - } - - public function filterTokens(callable $filter_function) - { - $token_list = new TokenStream; - foreach($this->tokens as $token) - { - $tok_out = $filter_function($token); - if ($tok_out) - { - $token_list->addToken($tok_out); - } - } - return $token_list; - } - - public function getWhile($match) - { - $out = new TokenStream; - while ($this->valid()) - { - $out->addToken($this->current()); - $this->next(); - $current = $this->current(); - if (!$this->matchToken($current,$match)) - { - break; - } - } - return $out; - } - - public function count() - { - return count($this->tokens); - } - - public function current() - { - if ($this->token_index < count($this->tokens)) - { - return $this->tokens[$this->token_index]; - } - return null; - } - - public function next() - { - $this->token_index += 1; - } - - public function key() - { - return $this->token_index; - } - - public function valid() - { - return ($this->token_index < count($this->tokens)); - } - - public function rewind() - { - $this->token_index = 0; - } - - public function getNext() - { - $next = $this->token_index + 1; - if ($next < count($this->tokens)) - { - return $this->tokens[$next]; - } - return null; - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/SdlComment.php b/lib/vendor/noccylabs/sdl/src/Sdl/SdlComment.php deleted file mode 100644 index 1d6eab3..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/SdlComment.php +++ /dev/null @@ -1,94 +0,0 @@ -value = (string)$value; - } - - /** - * Get the comment text - * - * @return string The comment text - */ - public function getValue() - { - return $this->value; - } - - /** - * - * @return string The encoded comment tag - */ - public function encodeTag() - { - if (empty(self::$comment_style)) { - self::$comment_style = self::STYLE_HASH; - } - $enc = self::$comment_style." ". - join("\n".self::$comment_style." ",explode("\n",$this->getValue(0))); - return $enc; - } -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/SdlTag.php b/lib/vendor/noccylabs/sdl/src/Sdl/SdlTag.php deleted file mode 100644 index 9248dbe..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/SdlTag.php +++ /dev/null @@ -1,409 +0,0 @@ -setTagName ($tag_name); - } - } - - /** - * Set the name of the tag, optionally including namespace. Throws a - * ParserException if the name is not valid. - * - * @param type $name - * @return \Sdl\SdlTag - * @throws ParserException - */ - public function setTagName($name) - { - // Check validity - if (SdlUtils::isValidIdentifier($name)) - { - // TODO: Extract namespace - $this->tag_name = $name; - return $this; - } - throw new ParserException( - "Invalid identifier '{$name}'", - ParserException::ERR_INVALID_IDENTIFIER - ); - } - - /** - * Get the tag name - * - * @return string The name of the tag, including namespace if defined. - */ - public function getTagName() - { - return $this->tag_name; - } - - /** - * Check if an attribute exists. - * - * @param string $attribute The attribute name - * @return bool True if the attribute exists - */ - public function hasAttribute($attribute) - { - return array_key_exists($attribute, $this->attributes); - } - - /** - * Get an attribute from the tag. - * - * @param string $attribute - * @return null|mixed The attribute - */ - public function getAttribute($attribute) - { - if ($this->hasAttribute($attribute)) - { - return $this->attributes[$attribute]->getValue(); - } - return null; - } - - public function getAttributeStrings() - { - $ret = array(); - foreach($this->attributes as $name=>$attribute) { - $ret[$name] = $attribute->getValue(); - } - return $ret; - } - - /** - * Create or update an attribute with a new value - * - * @param string $attribute - * @param mixed $value - * @return \Sdl\SdlTag - */ - public function setAttribute($attribute,$value) - { - // Check validity - if (!($value instanceof LiteralType\LiteralType)) - { - $value = LiteralType\TypeFactory::createFromPhpValue($value); - } - $this->attributes[$attribute] = $value; - return $this; - } - - public function setAttributesFromArray(array $attributes) - { - foreach($attributes as $attr=>$value) - { - $this->setAttribute($attr,$value); - } - } - - /** - * Remove an attribute from the tag - * - * @param string $attribute - */ - public function removeAttribute($attribute) - { - // TODO: Implement - } - - /** - * Set the first value (this[0]) to the specified value. - * - * @param mixed $value - */ - public function setValue($value) - { - if (!($value instanceof LiteralType\LiteralType)) - { - $value = LiteralType\TypeFactory::createFromPhpValue($value); - } - $this->values[0] = $value; - return $this; - } - - /** - * Set a value at a specific index - * - * @param int $index - * @param mixed $value - * @return \Sdl\SdlTag - */ - public function setValueAt($index,$value) - { - if (!($value instanceof LiteralType\LiteralType)) - { - $value = LiteralType\TypeFactory::createFromPhpValue($value); - } - $this->values[$index] = $value; - return $this; - } - - /** - * Assign the values of the tag from the array passed. - * - * @param array $values The values to assign - * @return \Sdl\SdlTag - */ - public function setValuesFromArray(array $values) - { - $this->values = []; - for($n = 0; $n < count($values); $n++) - { - $this->setValueAt($n, $values[$n]); - } - return $this; - - } - - /** - * Get the first value, or the value at the specified index. - * - * @param int $index - * @return mixed The value at the specified index (default: 0) - */ - public function getValue($index = 0) - { - if ($index < count($this->values)) - { - return $this->values[$index]->getValue(); - } - } - - /** - * Get all values from this tag. - * - * @return array The values - */ - public function getAllValues() - { - return array_map(function($obj){ - return $obj->getValue(); - }, $this->values); - } - - /** - * Check if the tag has children (including comments) - * - * @return bool True if the tag has child tags - */ - public function hasChildren() - { - // TODO: Skip the comment nodes? - return (count($this->children)>0); - } - - /** - * Return an array of all the child tags. - * - * @return array Array of child tags - */ - public function getChildren() - { - return (array)$this->children; - } - - /** - * Get the child tags that match the given tag name. This only operates on - * direct children and not recursively. - * - * @param string $tagname The tag name to match - * @return array[Sdl\SdlTag] The matching children - */ - public function getChildrenByTagName($tagname) - { - $ret = (array)array_map(function($tag) use($tagname) { - if ($tag->getTagName() == $tagname) - { - return $tag; - } - }, $this->children); - return array_filter($ret); - } - - /** - * Add a child tag to the tag. - * - * @param \Sdl\ISdlElement $tag Child tag to add - * @return \Sdl\SdlTag - */ - public function addChild(ISdlElement $tag) - { - if (!($tag instanceof SdlComment)) - { - $tag->setParent($this); - } - $this->children[] = $tag; - return $this; - } - - /** - * Create and return a new SDL root tag. - * - * @return SdlTag A newly created root tag - */ - public static function createRoot() - { - $tag = new self; - return $tag; - } - - /** - * Create a new tag and add it as a child to the current tag. - * - * @param string $tagname - * @return SdlTag The newly created child tag - */ - public function createChild($tagname) - { - $tag = new self; - $tag->setTagName($tagname); - $tag->setParent($this); - $this->addChild($tag); - return $tag; - } - - /** - * Create a new comment element and add it as a child to the current tag. - * - * @param string $text The comment text - * @return \Sdl\SdlTag - */ - public function createComment($text) - { - $comment = new SdlComment(); - $comment->setValue($text); - $this->addChild($comment); - return $this; - } - - /** - * Return to the parent context (alias of getParent()) - * - * @return SdlTag The parent tag - */ - public function end() - { - return $this->getParent(); - } - - /** - * Return the parent tag. - * - * @return SdlTag The parent tag - */ - public function getParent() - { - return $this->parent_tag; - } - - /** - * Set the parent tag - * - * @param \Sdl\SdlTag $parent The parent tag - * @return \Sdl\SdlTag - */ - public function setParent(SdlTag $parent) - { - $this->parent_tag = $parent; - return $this; - } - - /** - * Encode the tag and its children into valid Sdl. Called by the encode() - * method. - * - * @return string - */ - public function encodeTag() - { - $string = ($this->tag_namespace?":{$this->tag_namespace}":"") - . ($this->tag_name) - ; - foreach($this->values as $value) { - if ($value) { - $string .= " {$value->getSdlLiteral()}"; - } - } - foreach($this->attributes as $attribute=>$value) { - $string .= " {$attribute}={$value->getSdlLiteral()}"; - } - if (count($this->children)>0) - { - $string.= " {\n"; - foreach($this->children as $child) - { - $string.= " ".str_replace("\n","\n ",$child->encodeTag())."\n"; - } - $string.= "}"; - } - return $string; - } - - /** - * Encode the children of the tag into a string - * - * @return string The encoded children of this tag - */ - public function encode() - { - $string = null; - if (count($this->children)>0) - { - $string = ""; - foreach($this->children as $child) - { - $string.= $child->encodeTag()."\n"; - } - } - return $string; - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/SdlUtils.php b/lib/vendor/noccylabs/sdl/src/Sdl/SdlUtils.php deleted file mode 100644 index 47d5209..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/SdlUtils.php +++ /dev/null @@ -1,55 +0,0 @@ -tag = $tag; - } - - public function query($expression) - { - $exprs = []; $esc = 0; $expr = null; - for($n = 0; $n < strlen($expression); $n++) - { - if (($expression[$n]=="/") && ($esc==0)) - { - if ($expr) - { - $exprs[] = $expr; $expr = null; - } - } - elseif (($expression[$n]=="[")) - { - $esc++; - $expr.= $expression[$n]; - } - elseif (($expression[$n]=="]")) - { - $esc--; - $expr.= $expression[$n]; - } - else - { - $expr.= $expression[$n]; - } - } - if ($expr) { - $exprs[] = $expr; - } - $ret = $this->selectTagsByExpressionStack($exprs,$this->tag); - return $ret; - } - - /** - * Select tags using the TagSelector while traversing the tree, collecting - * all matching tags. - * - * - * @param array $exprs - * @param \Sdl\SdlTag $context - * @return type - */ - protected function selectTagsByExpressionStack(array $exprs, SdlTag $context) - { - $select = array_shift($exprs); - // Find item - $matcher = new TagMatcher($select); - $result = []; - foreach($context->getChildren() as $tag) - { - if ($matcher->match($tag)) - { - $result[] = $tag; - } - } - // Recurse - if (count($exprs)>0) - { - $output = []; - foreach ($result as $resulttag) - { - $out = (array)$this->selectTagsByExpressionStack($exprs,$resulttag); - $output = array_merge($output,$out); - } - return $output; - } - return $result; - } - - public function queryOne($expression) - { - $query = $this->query($expression); - if (count($query) > 0) - { - return $query[0]; - } - return null; - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/Selector/TagMatcher.php b/lib/vendor/noccylabs/sdl/src/Sdl/Selector/TagMatcher.php deleted file mode 100644 index 86c49b3..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/Selector/TagMatcher.php +++ /dev/null @@ -1,79 +0,0 @@ -setExpression($expression); - } - - public function setExpression($expression) - { - $match = null; - if (strpos($expression,"[")!==false) - { - list($this->tag_match,$this->expr_match) = explode("[",rtrim($expression,"]")); - } - else - { - $this->tag_match = $expression; - } - } - - public function match(SdlTag $tag) - { - if ($this->tag_match == $tag->getTagName()) - { - return $this->matchExpression($tag); - } - return false; - } - - private function matchExpression(SdlTag $tag) - { - if ($this->expr_match == null) - { - return true; - } - $expressionlanguage = new \Symfony\Component\ExpressionLanguage\ExpressionLanguage(); - $tag_wrapper = new TagWrapper($tag); - return $expressionlanguage->evaluate( - $this->expr_match, [ - "tag" => $tag_wrapper - ] - ); - - } - -} diff --git a/lib/vendor/noccylabs/sdl/src/Sdl/Selector/TagWrapper.php b/lib/vendor/noccylabs/sdl/src/Sdl/Selector/TagWrapper.php deleted file mode 100644 index 01d02bf..0000000 --- a/lib/vendor/noccylabs/sdl/src/Sdl/Selector/TagWrapper.php +++ /dev/null @@ -1,41 +0,0 @@ -tag = $tag; - } - - public function attr($name) - { - return $this->tag->getAttribute($name); - } - -} diff --git a/lib/vendor/noccylabs/sdl/tests/bootstrap.php b/lib/vendor/noccylabs/sdl/tests/bootstrap.php deleted file mode 100644 index 75cf989..0000000 --- a/lib/vendor/noccylabs/sdl/tests/bootstrap.php +++ /dev/null @@ -1,5 +0,0 @@ -object = new SdlString("Hello World!"); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - - } - - /** - * @covers Sdl\LiteralType\LiteralType::getType - * @todo Implement testGetType(). - */ - public function testGetType() - { - // Remove the following lines when you implement this test. - $this->assertEquals($this->object->getType(),"SdlString"); - } - - /** - * @covers Sdl\LiteralType\LiteralType::castTo - * @todo Implement testCastTo(). - */ - public function testCastTo() - { - // Remove the following lines when you implement this test. - $int_value = $this->object->castTo(new SdlInteger); - $this->assertEquals($int_value->getType(),"SdlInteger"); - $this->assertEquals($int_value->getValue(),0); - $int_value->setValue(1); - $this->assertEquals($int_value->getValue(),1); - - $bool_value = $int_value->castTo(new SdlBoolean); - $this->assertEquals($bool_value->getType(),"SdlBoolean"); - $this->assertEquals($bool_value->getValue(),true); - - $bool_value2 = $this->object->castTo(new SdlBoolean); - $this->assertEquals($bool_value2->getValue(),true); - - } - -} diff --git a/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/SdlIntegerTest.php b/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/SdlIntegerTest.php deleted file mode 100644 index f440889..0000000 --- a/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/SdlIntegerTest.php +++ /dev/null @@ -1,64 +0,0 @@ -object = new SdlInteger; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - - } - - /** - * @covers Sdl\LiteralType\SdlInteger::setValue - * @covers Sdl\LiteralType\SdlInteger::getValue - */ - public function testSetValue() - { - $this->object->setValue("123"); - $this->assertEquals(123,$this->object->getValue()); - $this->object->setValue(234); - $this->assertEquals(234,$this->object->getValue()); - $this->object->setValue(345.6); - $this->assertEquals(345,$this->object->getValue()); - } - - /** - * @covers Sdl\LiteralType\SdlInteger::setSdlLiteral - * @covers Sdl\LiteralType\SdlInteger::getSdlLiteral - * @todo Implement testSetSdlLiteral(). - */ - public function testSetSdlLiteral() - { - $this->object->setSdlLiteral("123"); - $this->assertEquals("123",$this->object->getSdlLiteral()); - $this->object->setSdlLiteral(234); - $this->assertEquals("234",$this->object->getSdlLiteral()); - $this->object->setSdlLiteral(345.6); - $this->assertEquals("345",$this->object->getSdlLiteral()); - } - - -} diff --git a/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/SdlNullTest.php b/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/SdlNullTest.php deleted file mode 100644 index 9ed7e7e..0000000 --- a/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/SdlNullTest.php +++ /dev/null @@ -1,75 +0,0 @@ -object = new SdlNull; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - - } - - /** - * @covers Sdl\LiteralType\SdlNull::setValue - * @todo Implement testSetValue(). - */ - public function testSetValue() - { - $this->object->setValue(123); - $this->assertEquals(null,$this->object->getValue()); - } - - /** - * @covers Sdl\LiteralType\SdlNull::getValue - * @todo Implement testGetValue(). - */ - public function testGetValue() - { - $this->assertEquals(null,$this->object->getValue()); - $this->object->setValue(123); - $this->assertEquals(null,$this->object->getValue()); - } - - /** - * @covers Sdl\LiteralType\SdlNull::setSdlLiteral - * @todo Implement testSetSdlLiteral(). - */ - public function testSetSdlLiteral() - { - $this->assertEquals("null",$this->object->getSdlLiteral()); - $this->object->setSdlLiteral("null"); - $this->assertEquals("null",$this->object->getSdlLiteral()); - } - - /** - * @covers Sdl\LiteralType\SdlNull::getSdlLiteral - * @todo Implement testGetSdlLiteral(). - */ - public function testGetSdlLiteral() - { - $this->assertEquals("null",$this->object->getSdlLiteral()); - } - -} diff --git a/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/TypeFactoryTest.php b/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/TypeFactoryTest.php deleted file mode 100644 index b5cff44..0000000 --- a/lib/vendor/noccylabs/sdl/tests/src/Sdl/LiteralType/TypeFactoryTest.php +++ /dev/null @@ -1,67 +0,0 @@ -assertEquals("SdlInteger", $int_type->getType()); - - $float_type = TypeFactory::createFromString("123f"); - $this->assertEquals("SdlFloat", $float_type->getType()); - - $bool_type = TypeFactory::createFromString("true"); - $this->assertEquals("SdlBoolean", $bool_type->getType()); - - $str_type = TypeFactory::createFromString("\"123\""); - $this->assertEquals("SdlString", $str_type->getType()); - - } - - /** - * @covers Sdl\LiteralType\TypeFactory::createFromPhpValue - * @todo Implement testCreateFromPhpValue(). - */ - public function testCreateFromPhpValue() - { - // Test integers - $int_type = TypeFactory::createFromPhpValue((int)42); - $this->assertEquals("SdlInteger", $int_type->getType()); - // Test floats - $double_type = TypeFactory::createFromPhpValue((double)4.2); - $this->assertEquals("SdlDouble", $double_type->getType()); - $float_type = TypeFactory::createFromPhpValue((float)4.2); - $this->assertEquals("SdlDouble", $float_type->getType()); - // Test booleans - $bool_type = TypeFactory::createFromPhpValue(true); - $this->assertEquals("SdlBoolean", $bool_type->getType()); - // Test strings - $str_type = TypeFactory::createFromPhpValue("foo"); - $this->assertEquals("SdlString", $str_type->getType()); - } -} diff --git a/lib/vendor/noccylabs/sdl/tests/src/Sdl/Parser/SdlParserTest.php b/lib/vendor/noccylabs/sdl/tests/src/Sdl/Parser/SdlParserTest.php deleted file mode 100644 index 04e24e9..0000000 --- a/lib/vendor/noccylabs/sdl/tests/src/Sdl/Parser/SdlParserTest.php +++ /dev/null @@ -1,55 +0,0 @@ -assertInstanceOf("Sdl\\SdlTag", $tag); - $this->assertEquals($sdl,$tag->encode()); - } - - /** - * @covers Sdl\Parser\SdlParser::parseString - * @covers Sdl\Parser\SdlParser::parseFromTokenStream - */ - public function testParseString() - { - $file = __DIR__."/../../../../examples/sdl/complex.sdl"; - $sdl = file_get_contents($file); - $tag = SdlParser::parseString($sdl); - $this->assertInstanceOf("Sdl\\SdlTag", $tag); - $this->assertEquals($sdl,$tag->encode()); - } - -} diff --git a/lib/vendor/noccylabs/sdl/tests/src/Sdl/Parser/TokenStreamTest.php b/lib/vendor/noccylabs/sdl/tests/src/Sdl/Parser/TokenStreamTest.php deleted file mode 100644 index 6e9adf5..0000000 --- a/lib/vendor/noccylabs/sdl/tests/src/Sdl/Parser/TokenStreamTest.php +++ /dev/null @@ -1,103 +0,0 @@ -object = new TokenStream; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - - } - - /** - * @covers Sdl\Parser\TokenStream::parseString - * @todo Implement testParseString(). - */ - public function testParseString() - { - $this->object->parseString("foo;"); - $this->assertEquals(count($this->object),2); - } - - /** - * @covers Sdl\Parser\TokenStream::current - * @todo Implement testCurrent(). - */ - public function testCurrent() - { - $this->object->parseString("foo;"); - $this->assertEquals($this->object->current(),"foo"); - } - - /** - * @covers Sdl\Parser\TokenStream::next - * @todo Implement testNext(). - */ - public function testNext() - { - $this->object->parseString("foo;"); - $this->object->next(); - $this->assertEquals($this->object->current(),";"); - } - - /** - * @covers Sdl\Parser\TokenStream::key - * @todo Implement testKey(). - */ - public function testKey() - { - $this->object->parseString("foo;"); - $this->assertEquals($this->object->key(),0); - $this->object->next(); - $this->assertEquals($this->object->key(),1); - } - - /** - * @covers Sdl\Parser\TokenStream::valid - * @todo Implement testValid(). - */ - public function testValid() - { - $this->object->parseString("foo;"); - $this->assertEquals($this->object->valid(),true); - $this->object->next(); - $this->object->next(); - $this->object->next(); - $this->assertEquals($this->object->valid(),false); - } - - /** - * @covers Sdl\Parser\TokenStream::rewind - * @todo Implement testRewind(). - */ - public function testRewind() - { - $this->object->parseString("foo;"); - $this->object->next(); - $this->object->rewind(); - $this->assertEquals($this->object->key(),0); - } - -} diff --git a/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlCommentTest.php b/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlCommentTest.php deleted file mode 100644 index 2281cef..0000000 --- a/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlCommentTest.php +++ /dev/null @@ -1,63 +0,0 @@ -object = new SdlComment; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - - } - - /** - * @covers Sdl\SdlComment::getTagName - * @todo Implement testGetTagName(). - */ - public function testGetTagName() - { - $this->assertEquals($this->object->getTagName(), "@COMMENT"); - } - - /** - * @covers Sdl\SdlComment::setCommentStyle - * @covers Sdl\SdlComment::setValue - * @covers Sdl\SdlComment::getValue - * @covers Sdl\SdlComment::encodeTag - * @todo Implement testSetCommentStyle(). - */ - public function testSetCommentStyle() - { - - foreach( array(SdlComment::STYLE_PHP, SdlComment::STYLE_HASH, SdlComment::STYLE_DASH) as $style) { - SdlComment::setCommentStyle($style); - $comment = new SdlComment(); - $comment->setValue("Hello World"); - $sdl = $comment->encodeTag(); - $expect = $style." Hello World"; - $this->assertEquals($expect, $sdl); - } - - } -} diff --git a/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlTagTest.php b/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlTagTest.php deleted file mode 100644 index a57590e..0000000 --- a/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlTagTest.php +++ /dev/null @@ -1,221 +0,0 @@ -object = new SdlTag; - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - - } - - /** - * @covers Sdl\SdlTag::setTagName - * @todo Implement testSetTagName(). - */ - public function testSetTagName() - { - // Remove the following lines when you implement this test. - $this->object->setTagName("foo:bar"); - $this->assertEquals($this->object->getTagName(),"foo:bar"); - } - - /** - * @covers Sdl\SdlTag::hasAttribute - * @todo Implement testHasAttribute(). - */ - public function testHasAttribute() - { - $this->assertFalse($this->object->hasAttribute("foo")); - $this->object->setAttribute("foo","bar"); - $this->assertTrue($this->object->hasAttribute("foo")); - } - - /** - * @covers Sdl\SdlTag::getAttribute - * @todo Implement testGetAttribute(). - */ - public function testGetAttribute() - { - $this->assertEquals($this->object->getAttribute("foo"),null); - } - - /** - * @covers Sdl\SdlTag::setAttribute - * @todo Implement testSetAttribute(). - */ - public function testSetAttribute() - { - $nod = new SdlTag("tag1"); - - $nod->setAttribute("foo","baz"); - $this->assertEquals("baz", $nod->getAttribute("foo")); - } - - /** - * @covers Sdl\SdlTag::setValue - * @todo Implement testSetValue(). - */ - public function testSetValue() - { - $nod = new SdlTag("tag1"); - - $nod->setValue("Hello"); - $this->assertEquals("Hello", $nod->getValue()); - $this->assertEquals("Hello", $nod->getValue(0)); - } - - /** - * @covers Sdl\SdlTag::setValuesFromArray - * @todo Implement testSetValuesFromArray(). - */ - public function testSetValuesFromArray() - { - $nod = new SdlTag("tag1"); - - $arr = array("Hello", "World"); - $nod->setValuesFromArray($arr); - $this->assertEquals("Hello", $nod->getValue()); - $this->assertEquals("Hello", $nod->getValue(0)); - $this->assertEquals("World", $nod->getValue(1)); - } - - /** - * @covers Sdl\SdlTag::hasChildren - * @todo Implement testHasChildren(). - */ - public function testHasChildren() - { - $nod = new SdlTag("tag1"); - $child = new SdlTag("tag2"); - $nod->addChild($child); - - $this->assertTrue($nod->hasChildren()); - } - - /** - * @covers Sdl\SdlTag::getChildren - * @todo Implement testGetChildren(). - */ - public function testGetChildren() - { - $nod = new SdlTag("tag1"); - $child = new SdlTag("tag2"); - $nod->addChild($child); - - $this->assertEquals(array($child), $nod->getChildren()); - } - - /** - * @covers Sdl\SdlTag::addChild - * @todo Implement testAddChild(). - */ - public function testAddChild() - { - $nod = new SdlTag("tag1"); - $child = new SdlTag("tag2"); - $nod->addChild($child); - - $this->assertEquals($child->getParent(), $nod); - } - - /** - * @covers Sdl\SdlTag::createChild - * @todo Implement testCreateChild(). - */ - public function testCreateChild() - { - $nod = new SdlTag("tag1"); - $child = $nod->createChild("tag2"); - - $this->assertNotNull($child); - $this->assertNotEquals($child, $nod); - } - - /** - * @covers Sdl\SdlTag::end - * @todo Implement testEnd(). - */ - public function testEnd() - { - $nod = new SdlTag("tag1"); - $child = $nod->createChild("tag2"); - - $this->assertEquals($child->end(), $nod); - } - - /** - * @covers Sdl\SdlTag::getParent - * @todo Implement testGetParent(). - */ - public function testGetParent() - { - $nod = new SdlTag("tag1"); - - $this->assertEquals($nod->getParent(), null); - } - - /** - * @covers Sdl\SdlTag::setParent - * @todo Implement testSetParent(). - */ - public function testSetParent() - { - $nod = new SdlTag("tag1"); - $pnod = new SdlTag("tag2"); - - $this->assertEquals($nod->getParent(), null); - $nod->setParent($pnod); - $this->assertEquals($nod->getParent(), $pnod); - } - - public function testCreateComment() - { - SdlComment::setCommentStyle(SdlComment::STYLE_HASH); - $out = $this->object->createComment("Hello World")->encode(); - $this->assertEquals("# Hello World\n", $out); - } - - /** - * @covers Sdl\SdlTag::encode - * @todo Implement testEncode(). - */ - public function testEncode() - { - $out = $this->object - ->createChild("foo") - ->createChild("bar") - ->setValuesFromArray([1,2,3]) - ->end() - ->createChild("baz") - ->setValuesFromArray(["do","re","mi"]) - ->end() - ->end() - ->encode(); - $expect = "foo {\n bar 1 2 3\n baz \"do\" \"re\" \"mi\"\n}\n"; - $this->assertEquals($expect,$out); - } - -} diff --git a/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlUtilsTest.php b/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlUtilsTest.php deleted file mode 100644 index ed47315..0000000 --- a/lib/vendor/noccylabs/sdl/tests/src/Sdl/SdlUtilsTest.php +++ /dev/null @@ -1,55 +0,0 @@ -assertEquals(true,SdlUtils::isValidIdentifier($identifier)); - } - - foreach($invalid as $identifier) - { - $this->assertEquals(false,SdlUtils::isValidIdentifier($identifier)); - } - } - -} diff --git a/lib/vendor/psr/cache/CHANGELOG.md b/lib/vendor/psr/cache/CHANGELOG.md deleted file mode 100644 index 58ddab0..0000000 --- a/lib/vendor/psr/cache/CHANGELOG.md +++ /dev/null @@ -1,16 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file, in reverse chronological order by release. - -## 1.0.1 - 2016-08-06 - -### Fixed - -- Make spacing consistent in phpdoc annotations php-fig/cache#9 - chalasr -- Fix grammar in phpdoc annotations php-fig/cache#10 - chalasr -- Be more specific in docblocks that `getItems()` and `deleteItems()` take an array of strings (`string[]`) compared to just `array` php-fig/cache#8 - GrahamCampbell -- For `expiresAt()` and `expiresAfter()` in CacheItemInterface fix docblock to specify null as a valid parameters as well as an implementation of DateTimeInterface php-fig/cache#7 - GrahamCampbell - -## 1.0.0 - 2015-12-11 - -Initial stable release; reflects accepted PSR-6 specification diff --git a/lib/vendor/psr/cache/LICENSE.txt b/lib/vendor/psr/cache/LICENSE.txt deleted file mode 100644 index b1c2c97..0000000 --- a/lib/vendor/psr/cache/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 PHP Framework Interoperability Group - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/vendor/psr/cache/README.md b/lib/vendor/psr/cache/README.md deleted file mode 100644 index c8706ce..0000000 --- a/lib/vendor/psr/cache/README.md +++ /dev/null @@ -1,9 +0,0 @@ -PSR Cache -========= - -This repository holds all interfaces defined by -[PSR-6](http://www.php-fig.org/psr/psr-6/). - -Note that this is not a Cache implementation of its own. It is merely an -interface that describes a Cache implementation. See the specification for more -details. diff --git a/lib/vendor/psr/cache/composer.json b/lib/vendor/psr/cache/composer.json deleted file mode 100644 index e828fec..0000000 --- a/lib/vendor/psr/cache/composer.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "psr/cache", - "description": "Common interface for caching libraries", - "keywords": ["psr", "psr-6", "cache"], - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=5.3.0" - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/lib/vendor/psr/cache/src/CacheException.php b/lib/vendor/psr/cache/src/CacheException.php deleted file mode 100644 index e27f22f..0000000 --- a/lib/vendor/psr/cache/src/CacheException.php +++ /dev/null @@ -1,10 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } -} diff --git a/lib/vendor/psr/log/Psr/Log/InvalidArgumentException.php b/lib/vendor/psr/log/Psr/Log/InvalidArgumentException.php deleted file mode 100644 index 67f852d..0000000 --- a/lib/vendor/psr/log/Psr/Log/InvalidArgumentException.php +++ /dev/null @@ -1,7 +0,0 @@ -logger = $logger; - } -} diff --git a/lib/vendor/psr/log/Psr/Log/LoggerInterface.php b/lib/vendor/psr/log/Psr/Log/LoggerInterface.php deleted file mode 100644 index 5ea7243..0000000 --- a/lib/vendor/psr/log/Psr/Log/LoggerInterface.php +++ /dev/null @@ -1,123 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - */ - abstract public function log($level, $message, array $context = array()); -} diff --git a/lib/vendor/psr/log/Psr/Log/NullLogger.php b/lib/vendor/psr/log/Psr/Log/NullLogger.php deleted file mode 100644 index d8cd682..0000000 --- a/lib/vendor/psr/log/Psr/Log/NullLogger.php +++ /dev/null @@ -1,28 +0,0 @@ -logger) { }` - * blocks. - */ -class NullLogger extends AbstractLogger -{ - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - */ - public function log($level, $message, array $context = array()) - { - // noop - } -} diff --git a/lib/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/lib/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php deleted file mode 100644 index a0391a5..0000000 --- a/lib/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +++ /dev/null @@ -1,140 +0,0 @@ - ". - * - * Example ->error('Foo') would yield "error Foo". - * - * @return string[] - */ - abstract public function getLogs(); - - public function testImplements() - { - $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); - } - - /** - * @dataProvider provideLevelsAndMessages - */ - public function testLogsAtAllLevels($level, $message) - { - $logger = $this->getLogger(); - $logger->{$level}($message, array('user' => 'Bob')); - $logger->log($level, $message, array('user' => 'Bob')); - - $expected = array( - $level.' message of level '.$level.' with context: Bob', - $level.' message of level '.$level.' with context: Bob', - ); - $this->assertEquals($expected, $this->getLogs()); - } - - public function provideLevelsAndMessages() - { - return array( - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), - ); - } - - /** - * @expectedException \Psr\Log\InvalidArgumentException - */ - public function testThrowsOnInvalidLevel() - { - $logger = $this->getLogger(); - $logger->log('invalid level', 'Foo'); - } - - public function testContextReplacement() - { - $logger = $this->getLogger(); - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); - - $expected = array('info {Message {nothing} Bob Bar a}'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testObjectCastToString() - { - if (method_exists($this, 'createPartialMock')) { - $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); - } else { - $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); - } - $dummy->expects($this->once()) - ->method('__toString') - ->will($this->returnValue('DUMMY')); - - $this->getLogger()->warning($dummy); - - $expected = array('warning DUMMY'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextCanContainAnything() - { - $context = array( - 'bool' => true, - 'null' => null, - 'string' => 'Foo', - 'int' => 0, - 'float' => 0.5, - 'nested' => array('with object' => new DummyTest), - 'object' => new \DateTime, - 'resource' => fopen('php://memory', 'r'), - ); - - $this->getLogger()->warning('Crazy context data', $context); - - $expected = array('warning Crazy context data'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextExceptionKeyCanBeExceptionOrOtherValues() - { - $logger = $this->getLogger(); - $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); - - $expected = array( - 'warning Random message', - 'critical Uncaught Exception!' - ); - $this->assertEquals($expected, $this->getLogs()); - } -} - -class DummyTest -{ - public function __toString() - { - } -} diff --git a/lib/vendor/psr/log/README.md b/lib/vendor/psr/log/README.md deleted file mode 100644 index 574bc1c..0000000 --- a/lib/vendor/psr/log/README.md +++ /dev/null @@ -1,45 +0,0 @@ -PSR Log -======= - -This repository holds all interfaces/classes/traits related to -[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). - -Note that this is not a logger of its own. It is merely an interface that -describes a logger. See the specification for more details. - -Usage ------ - -If you need a logger, you can use the interface like this: - -```php -logger = $logger; - } - - public function doSomething() - { - if ($this->logger) { - $this->logger->info('Doing work'); - } - - // do something useful - } -} -``` - -You can then pick one of the implementations of the interface to get a logger. - -If you want to implement the interface, you can require this package and -implement `Psr\Log\LoggerInterface` in your code. Please read the -[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) -for details. diff --git a/lib/vendor/psr/log/composer.json b/lib/vendor/psr/log/composer.json deleted file mode 100644 index 87934d7..0000000 --- a/lib/vendor/psr/log/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "psr/log", - "description": "Common interface for logging libraries", - "keywords": ["psr", "psr-3", "log"], - "homepage": "https://github.com/php-fig/log", - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=5.3.0" - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/lib/vendor/symfony/cache/.gitignore b/lib/vendor/symfony/cache/.gitignore deleted file mode 100644 index 5414c2c..0000000 --- a/lib/vendor/symfony/cache/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -composer.lock -phpunit.xml -vendor/ diff --git a/lib/vendor/symfony/cache/Adapter/AbstractAdapter.php b/lib/vendor/symfony/cache/Adapter/AbstractAdapter.php deleted file mode 100644 index 4a78896..0000000 --- a/lib/vendor/symfony/cache/Adapter/AbstractAdapter.php +++ /dev/null @@ -1,449 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\CacheItemInterface; -use Psr\Log\LoggerAwareInterface; -use Psr\Log\LoggerAwareTrait; -use Psr\Log\LoggerInterface; -use Symfony\Component\Cache\CacheItem; -use Symfony\Component\Cache\Exception\InvalidArgumentException; - -/** - * @author Nicolas Grekas - */ -abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface -{ - use LoggerAwareTrait; - - private static $apcuSupported; - private static $phpFilesSupported; - - private $namespace; - private $deferred = array(); - private $createCacheItem; - private $mergeByLifetime; - - /** - * @var int|null The maximum length to enforce for identifiers or null when no limit applies - */ - protected $maxIdLength; - - protected function __construct($namespace = '', $defaultLifetime = 0) - { - $this->namespace = '' === $namespace ? '' : $this->getId($namespace).':'; - if (null !== $this->maxIdLength && strlen($namespace) > $this->maxIdLength - 24) { - throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, strlen($namespace), $namespace)); - } - $this->createCacheItem = \Closure::bind( - function ($key, $value, $isHit) use ($defaultLifetime) { - $item = new CacheItem(); - $item->key = $key; - $item->value = $value; - $item->isHit = $isHit; - $item->defaultLifetime = $defaultLifetime; - - return $item; - }, - null, - CacheItem::class - ); - $this->mergeByLifetime = \Closure::bind( - function ($deferred, $namespace, &$expiredIds) { - $byLifetime = array(); - $now = time(); - $expiredIds = array(); - - foreach ($deferred as $key => $item) { - if (null === $item->expiry) { - $byLifetime[0 < $item->defaultLifetime ? $item->defaultLifetime : 0][$namespace.$key] = $item->value; - } elseif ($item->expiry > $now) { - $byLifetime[$item->expiry - $now][$namespace.$key] = $item->value; - } else { - $expiredIds[] = $namespace.$key; - } - } - - return $byLifetime; - }, - null, - CacheItem::class - ); - } - - public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null) - { - if (null === self::$apcuSupported) { - self::$apcuSupported = ApcuAdapter::isSupported(); - } - - if (!self::$apcuSupported && null === self::$phpFilesSupported) { - self::$phpFilesSupported = PhpFilesAdapter::isSupported(); - } - - if (self::$phpFilesSupported) { - $opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory); - if (null !== $logger) { - $opcache->setLogger($logger); - } - - return $opcache; - } - - $fs = new FilesystemAdapter($namespace, $defaultLifetime, $directory); - if (null !== $logger) { - $fs->setLogger($logger); - } - if (!self::$apcuSupported) { - return $fs; - } - - $apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version); - if (null !== $logger) { - $apcu->setLogger($logger); - } - - return new ChainAdapter(array($apcu, $fs)); - } - - /** - * Fetches several cache items. - * - * @param array $ids The cache identifiers to fetch - * - * @return array|\Traversable The corresponding values found in the cache - */ - abstract protected function doFetch(array $ids); - - /** - * Confirms if the cache contains specified cache item. - * - * @param string $id The identifier for which to check existence - * - * @return bool True if item exists in the cache, false otherwise - */ - abstract protected function doHave($id); - - /** - * Deletes all items in the pool. - * - * @param string The prefix used for all identifiers managed by this pool - * - * @return bool True if the pool was successfully cleared, false otherwise - */ - abstract protected function doClear($namespace); - - /** - * Removes multiple items from the pool. - * - * @param array $ids An array of identifiers that should be removed from the pool - * - * @return bool True if the items were successfully removed, false otherwise - */ - abstract protected function doDelete(array $ids); - - /** - * Persists several cache items immediately. - * - * @param array $values The values to cache, indexed by their cache identifier - * @param int $lifetime The lifetime of the cached values, 0 for persisting until manual cleaning - * - * @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not - */ - abstract protected function doSave(array $values, $lifetime); - - /** - * {@inheritdoc} - */ - public function getItem($key) - { - if ($this->deferred) { - $this->commit(); - } - $id = $this->getId($key); - - $f = $this->createCacheItem; - $isHit = false; - $value = null; - - try { - foreach ($this->doFetch(array($id)) as $value) { - $isHit = true; - } - } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch key "{key}"', array('key' => $key, 'exception' => $e)); - } - - return $f($key, $value, $isHit); - } - - /** - * {@inheritdoc} - */ - public function getItems(array $keys = array()) - { - if ($this->deferred) { - $this->commit(); - } - $ids = array(); - - foreach ($keys as $key) { - $ids[] = $this->getId($key); - } - try { - $items = $this->doFetch($ids); - } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch requested items', array('keys' => $keys, 'exception' => $e)); - $items = array(); - } - $ids = array_combine($ids, $keys); - - return $this->generateItems($items, $ids); - } - - /** - * {@inheritdoc} - */ - public function hasItem($key) - { - $id = $this->getId($key); - - if (isset($this->deferred[$key])) { - $this->commit(); - } - - try { - return $this->doHave($id); - } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to check if key "{key}" is cached', array('key' => $key, 'exception' => $e)); - - return false; - } - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $this->deferred = array(); - - try { - return $this->doClear($this->namespace); - } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to clear the cache', array('exception' => $e)); - - return false; - } - } - - /** - * {@inheritdoc} - */ - public function deleteItem($key) - { - return $this->deleteItems(array($key)); - } - - /** - * {@inheritdoc} - */ - public function deleteItems(array $keys) - { - $ids = array(); - - foreach ($keys as $key) { - $ids[$key] = $this->getId($key); - unset($this->deferred[$key]); - } - - try { - if ($this->doDelete($ids)) { - return true; - } - } catch (\Exception $e) { - } - - $ok = true; - - // When bulk-delete failed, retry each item individually - foreach ($ids as $key => $id) { - try { - $e = null; - if ($this->doDelete(array($id))) { - continue; - } - } catch (\Exception $e) { - } - CacheItem::log($this->logger, 'Failed to delete key "{key}"', array('key' => $key, 'exception' => $e)); - $ok = false; - } - - return $ok; - } - - /** - * {@inheritdoc} - */ - public function save(CacheItemInterface $item) - { - if (!$item instanceof CacheItem) { - return false; - } - $this->deferred[$item->getKey()] = $item; - - return $this->commit(); - } - - /** - * {@inheritdoc} - */ - public function saveDeferred(CacheItemInterface $item) - { - if (!$item instanceof CacheItem) { - return false; - } - $this->deferred[$item->getKey()] = $item; - - return true; - } - - /** - * {@inheritdoc} - */ - public function commit() - { - $ok = true; - $byLifetime = $this->mergeByLifetime; - $byLifetime = $byLifetime($this->deferred, $this->namespace, $expiredIds); - $retry = $this->deferred = array(); - - if ($expiredIds) { - $this->doDelete($expiredIds); - } - foreach ($byLifetime as $lifetime => $values) { - try { - $e = $this->doSave($values, $lifetime); - } catch (\Exception $e) { - } - if (true === $e || array() === $e) { - continue; - } - if (is_array($e) || 1 === count($values)) { - foreach (is_array($e) ? $e : array_keys($values) as $id) { - $ok = false; - $v = $values[$id]; - $type = is_object($v) ? get_class($v) : gettype($v); - CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => substr($id, strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null)); - } - } else { - foreach ($values as $id => $v) { - $retry[$lifetime][] = $id; - } - } - } - - // When bulk-save failed, retry each item individually - foreach ($retry as $lifetime => $ids) { - foreach ($ids as $id) { - try { - $v = $byLifetime[$lifetime][$id]; - $e = $this->doSave(array($id => $v), $lifetime); - } catch (\Exception $e) { - } - if (true === $e || array() === $e) { - continue; - } - $ok = false; - $type = is_object($v) ? get_class($v) : gettype($v); - CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => substr($id, strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null)); - } - } - - return $ok; - } - - public function __destruct() - { - if ($this->deferred) { - $this->commit(); - } - } - - /** - * Like the native unserialize() function but throws an exception if anything goes wrong. - * - * @param string $value - * - * @return mixed - * - * @throws \Exception - */ - protected static function unserialize($value) - { - if ('b:0;' === $value) { - return false; - } - $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); - try { - if (false !== $value = unserialize($value)) { - return $value; - } - throw new \DomainException('Failed to unserialize cached value'); - } catch (\Error $e) { - throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); - } finally { - ini_set('unserialize_callback_func', $unserializeCallbackHandler); - } - } - - private function getId($key) - { - CacheItem::validateKey($key); - - if (null === $this->maxIdLength) { - return $this->namespace.$key; - } - if (strlen($id = $this->namespace.$key) > $this->maxIdLength) { - $id = $this->namespace.substr_replace(base64_encode(hash('sha256', $key, true)), ':', -22); - } - - return $id; - } - - private function generateItems($items, &$keys) - { - $f = $this->createCacheItem; - - try { - foreach ($items as $id => $value) { - $key = $keys[$id]; - unset($keys[$id]); - yield $key => $f($key, $value, true); - } - } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch requested items', array('keys' => array_values($keys), 'exception' => $e)); - } - - foreach ($keys as $key) { - yield $key => $f($key, null, false); - } - } - - /** - * @internal - */ - public static function handleUnserializeCallback($class) - { - throw new \DomainException('Class not found: '.$class); - } -} diff --git a/lib/vendor/symfony/cache/Adapter/AdapterInterface.php b/lib/vendor/symfony/cache/Adapter/AdapterInterface.php deleted file mode 100644 index 85a0da8..0000000 --- a/lib/vendor/symfony/cache/Adapter/AdapterInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\CacheItem; - -/** - * Interface for adapters managing instances of Symfony's {@see CacheItem}. - * - * @author Kévin Dunglas - */ -interface AdapterInterface extends CacheItemPoolInterface -{ -} diff --git a/lib/vendor/symfony/cache/Adapter/ApcuAdapter.php b/lib/vendor/symfony/cache/Adapter/ApcuAdapter.php deleted file mode 100644 index 67afd5c..0000000 --- a/lib/vendor/symfony/cache/Adapter/ApcuAdapter.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Symfony\Component\Cache\CacheItem; -use Symfony\Component\Cache\Exception\CacheException; - -/** - * @author Nicolas Grekas - */ -class ApcuAdapter extends AbstractAdapter -{ - public static function isSupported() - { - return function_exists('apcu_fetch') && ini_get('apc.enabled') && !('cli' === PHP_SAPI && !ini_get('apc.enable_cli')); - } - - public function __construct($namespace = '', $defaultLifetime = 0, $version = null) - { - if (!static::isSupported()) { - throw new CacheException('APCu is not enabled'); - } - if ('cli' === PHP_SAPI) { - ini_set('apc.use_request_time', 0); - } - parent::__construct($namespace, $defaultLifetime); - - if (null !== $version) { - CacheItem::validateKey($version); - - if (!apcu_exists($version.'@'.$namespace)) { - $this->clear($namespace); - apcu_add($version.'@'.$namespace, null); - } - } - } - - /** - * {@inheritdoc} - */ - protected function doFetch(array $ids) - { - try { - return apcu_fetch($ids); - } catch (\Error $e) { - throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); - } - } - - /** - * {@inheritdoc} - */ - protected function doHave($id) - { - return apcu_exists($id); - } - - /** - * {@inheritdoc} - */ - protected function doClear($namespace) - { - return isset($namespace[0]) && class_exists('APCuIterator', false) - ? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), APC_ITER_KEY)) - : apcu_clear_cache(); - } - - /** - * {@inheritdoc} - */ - protected function doDelete(array $ids) - { - foreach ($ids as $id) { - apcu_delete($id); - } - - return true; - } - - /** - * {@inheritdoc} - */ - protected function doSave(array $values, $lifetime) - { - try { - return array_keys(apcu_store($values, null, $lifetime)); - } catch (\Error $e) { - } catch (\Exception $e) { - } - - if (1 === count($values)) { - // Workaround https://github.com/krakjoe/apcu/issues/170 - apcu_delete(key($values)); - } - - throw $e; - } -} diff --git a/lib/vendor/symfony/cache/Adapter/ArrayAdapter.php b/lib/vendor/symfony/cache/Adapter/ArrayAdapter.php deleted file mode 100644 index 2898ba5..0000000 --- a/lib/vendor/symfony/cache/Adapter/ArrayAdapter.php +++ /dev/null @@ -1,230 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\CacheItemInterface; -use Psr\Log\LoggerAwareInterface; -use Psr\Log\LoggerAwareTrait; -use Symfony\Component\Cache\CacheItem; - -/** - * @author Nicolas Grekas - */ -class ArrayAdapter implements AdapterInterface, LoggerAwareInterface -{ - use LoggerAwareTrait; - - private $storeSerialized; - private $values = array(); - private $expiries = array(); - private $createCacheItem; - - /** - * @param int $defaultLifetime - * @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise - */ - public function __construct($defaultLifetime = 0, $storeSerialized = true) - { - $this->storeSerialized = $storeSerialized; - $this->createCacheItem = \Closure::bind( - function ($key, $value, $isHit) use ($defaultLifetime) { - $item = new CacheItem(); - $item->key = $key; - $item->value = $value; - $item->isHit = $isHit; - $item->defaultLifetime = $defaultLifetime; - - return $item; - }, - null, - CacheItem::class - ); - } - - /** - * {@inheritdoc} - */ - public function getItem($key) - { - $isHit = $this->hasItem($key); - try { - if (!$isHit) { - $this->values[$key] = $value = null; - } elseif (!$this->storeSerialized) { - $value = $this->values[$key]; - } elseif ('b:0;' === $value = $this->values[$key]) { - $value = false; - } elseif (false === $value = unserialize($value)) { - $this->values[$key] = $value = null; - $isHit = false; - } - } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to unserialize key "{key}"', array('key' => $key, 'exception' => $e)); - $this->values[$key] = $value = null; - $isHit = false; - } - $f = $this->createCacheItem; - - return $f($key, $value, $isHit); - } - - /** - * {@inheritdoc} - */ - public function getItems(array $keys = array()) - { - foreach ($keys as $key) { - CacheItem::validateKey($key); - } - - return $this->generateItems($keys, time()); - } - - /** - * Returns all cached values, with cache miss as null. - * - * @return array - */ - public function getValues() - { - return $this->values; - } - - /** - * {@inheritdoc} - */ - public function hasItem($key) - { - CacheItem::validateKey($key); - - return isset($this->expiries[$key]) && ($this->expiries[$key] >= time() || !$this->deleteItem($key)); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $this->values = $this->expiries = array(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function deleteItem($key) - { - CacheItem::validateKey($key); - - unset($this->values[$key], $this->expiries[$key]); - - return true; - } - - /** - * {@inheritdoc} - */ - public function deleteItems(array $keys) - { - foreach ($keys as $key) { - $this->deleteItem($key); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function save(CacheItemInterface $item) - { - if (!$item instanceof CacheItem) { - return false; - } - $item = (array) $item; - $key = $item["\0*\0key"]; - $value = $item["\0*\0value"]; - $expiry = $item["\0*\0expiry"]; - - if (null !== $expiry && $expiry <= time()) { - $this->deleteItem($key); - - return true; - } - if ($this->storeSerialized) { - try { - $value = serialize($value); - } catch (\Exception $e) { - $type = is_object($value) ? get_class($value) : gettype($value); - CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => $key, 'type' => $type, 'exception' => $e)); - - return false; - } - } - if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) { - $expiry = time() + $item["\0*\0defaultLifetime"]; - } - - $this->values[$key] = $value; - $this->expiries[$key] = null !== $expiry ? $expiry : PHP_INT_MAX; - - return true; - } - - /** - * {@inheritdoc} - */ - public function saveDeferred(CacheItemInterface $item) - { - return $this->save($item); - } - - /** - * {@inheritdoc} - */ - public function commit() - { - return true; - } - - private function generateItems(array $keys, $now) - { - $f = $this->createCacheItem; - - foreach ($keys as $i => $key) { - try { - if (!$isHit = isset($this->expiries[$key]) && ($this->expiries[$key] >= $now || !$this->deleteItem($key))) { - $this->values[$key] = $value = null; - } elseif (!$this->storeSerialized) { - $value = $this->values[$key]; - } elseif ('b:0;' === $value = $this->values[$key]) { - $value = false; - } elseif (false === $value = unserialize($value)) { - $this->values[$key] = $value = null; - $isHit = false; - } - } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to unserialize key "{key}"', array('key' => $key, 'exception' => $e)); - $this->values[$key] = $value = null; - $isHit = false; - } - unset($keys[$i]); - - yield $key => $f($key, $value, $isHit); - } - - foreach ($keys as $key) { - yield $key => $f($key, null, false); - } - } -} diff --git a/lib/vendor/symfony/cache/Adapter/ChainAdapter.php b/lib/vendor/symfony/cache/Adapter/ChainAdapter.php deleted file mode 100644 index c731e47..0000000 --- a/lib/vendor/symfony/cache/Adapter/ChainAdapter.php +++ /dev/null @@ -1,226 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\CacheItemInterface; -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\CacheItem; -use Symfony\Component\Cache\Exception\InvalidArgumentException; - -/** - * Chains several adapters together. - * - * Cached items are fetched from the first adapter having them in its data store. - * They are saved and deleted in all adapters at once. - * - * @author Kévin Dunglas - */ -class ChainAdapter implements AdapterInterface -{ - private $adapters = array(); - private $saveUp; - - /** - * @param CacheItemPoolInterface[] $adapters The ordered list of adapters used to fetch cached items - * @param int $maxLifetime The max lifetime of items propagated from lower adapters to upper ones - */ - public function __construct(array $adapters, $maxLifetime = 0) - { - if (!$adapters) { - throw new InvalidArgumentException('At least one adapter must be specified.'); - } - - foreach ($adapters as $adapter) { - if (!$adapter instanceof CacheItemPoolInterface) { - throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', get_class($adapter), CacheItemPoolInterface::class)); - } - - if ($adapter instanceof AdapterInterface) { - $this->adapters[] = $adapter; - } else { - $this->adapters[] = new ProxyAdapter($adapter); - } - } - - $this->saveUp = \Closure::bind( - function ($adapter, $item) use ($maxLifetime) { - $origDefaultLifetime = $item->defaultLifetime; - - if (0 < $maxLifetime && ($origDefaultLifetime <= 0 || $maxLifetime < $origDefaultLifetime)) { - $item->defaultLifetime = $maxLifetime; - } - - $adapter->save($item); - $item->defaultLifetime = $origDefaultLifetime; - }, - null, - CacheItem::class - ); - } - - /** - * {@inheritdoc} - */ - public function getItem($key) - { - $saveUp = $this->saveUp; - - foreach ($this->adapters as $i => $adapter) { - $item = $adapter->getItem($key); - - if ($item->isHit()) { - while (0 <= --$i) { - $saveUp($this->adapters[$i], $item); - } - - return $item; - } - } - - return $item; - } - - /** - * {@inheritdoc} - */ - public function getItems(array $keys = array()) - { - return $this->generateItems($this->adapters[0]->getItems($keys), 0); - } - - private function generateItems($items, $adapterIndex) - { - $missing = array(); - $nextAdapterIndex = $adapterIndex + 1; - $nextAdapter = isset($this->adapters[$nextAdapterIndex]) ? $this->adapters[$nextAdapterIndex] : null; - - foreach ($items as $k => $item) { - if (!$nextAdapter || $item->isHit()) { - yield $k => $item; - } else { - $missing[] = $k; - } - } - - if ($missing) { - $saveUp = $this->saveUp; - $adapter = $this->adapters[$adapterIndex]; - $items = $this->generateItems($nextAdapter->getItems($missing), $nextAdapterIndex); - - foreach ($items as $k => $item) { - if ($item->isHit()) { - $saveUp($adapter, $item); - } - - yield $k => $item; - } - } - } - - /** - * {@inheritdoc} - */ - public function hasItem($key) - { - foreach ($this->adapters as $adapter) { - if ($adapter->hasItem($key)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $cleared = true; - - foreach ($this->adapters as $adapter) { - $cleared = $adapter->clear() && $cleared; - } - - return $cleared; - } - - /** - * {@inheritdoc} - */ - public function deleteItem($key) - { - $deleted = true; - - foreach ($this->adapters as $adapter) { - $deleted = $adapter->deleteItem($key) && $deleted; - } - - return $deleted; - } - - /** - * {@inheritdoc} - */ - public function deleteItems(array $keys) - { - $deleted = true; - - foreach ($this->adapters as $adapter) { - $deleted = $adapter->deleteItems($keys) && $deleted; - } - - return $deleted; - } - - /** - * {@inheritdoc} - */ - public function save(CacheItemInterface $item) - { - $saved = true; - - foreach ($this->adapters as $adapter) { - $saved = $adapter->save($item) && $saved; - } - - return $saved; - } - - /** - * {@inheritdoc} - */ - public function saveDeferred(CacheItemInterface $item) - { - $saved = true; - - foreach ($this->adapters as $adapter) { - $saved = $adapter->saveDeferred($item) && $saved; - } - - return $saved; - } - - /** - * {@inheritdoc} - */ - public function commit() - { - $committed = true; - - foreach ($this->adapters as $adapter) { - $committed = $adapter->commit() && $committed; - } - - return $committed; - } -} diff --git a/lib/vendor/symfony/cache/Adapter/DoctrineAdapter.php b/lib/vendor/symfony/cache/Adapter/DoctrineAdapter.php deleted file mode 100644 index ed91bf5..0000000 --- a/lib/vendor/symfony/cache/Adapter/DoctrineAdapter.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Doctrine\Common\Cache\CacheProvider; - -/** - * @author Nicolas Grekas - */ -class DoctrineAdapter extends AbstractAdapter -{ - private $provider; - - public function __construct(CacheProvider $provider, $namespace = '', $defaultLifetime = 0) - { - parent::__construct('', $defaultLifetime); - $this->provider = $provider; - $provider->setNamespace($namespace); - } - - /** - * {@inheritdoc} - */ - protected function doFetch(array $ids) - { - $unserializeCallbackHandler = ini_set('unserialize_callback_func', parent::class.'::handleUnserializeCallback'); - try { - return $this->provider->fetchMultiple($ids); - } catch (\Error $e) { - $trace = $e->getTrace(); - - if (isset($trace[0]['function']) && !isset($trace[0]['class'])) { - switch ($trace[0]['function']) { - case 'unserialize': - case 'apcu_fetch': - case 'apc_fetch': - throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); - } - } - - throw $e; - } finally { - ini_set('unserialize_callback_func', $unserializeCallbackHandler); - } - } - - /** - * {@inheritdoc} - */ - protected function doHave($id) - { - return $this->provider->contains($id); - } - - /** - * {@inheritdoc} - */ - protected function doClear($namespace) - { - $namespace = $this->provider->getNamespace(); - - return isset($namespace[0]) - ? $this->provider->deleteAll() - : $this->provider->flushAll(); - } - - /** - * {@inheritdoc} - */ - protected function doDelete(array $ids) - { - $ok = true; - foreach ($ids as $id) { - $ok = $this->provider->delete($id) && $ok; - } - - return $ok; - } - - /** - * {@inheritdoc} - */ - protected function doSave(array $values, $lifetime) - { - return $this->provider->saveMultiple($values, $lifetime); - } -} diff --git a/lib/vendor/symfony/cache/Adapter/FilesystemAdapter.php b/lib/vendor/symfony/cache/Adapter/FilesystemAdapter.php deleted file mode 100644 index 5be4519..0000000 --- a/lib/vendor/symfony/cache/Adapter/FilesystemAdapter.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -/** - * @author Nicolas Grekas - */ -class FilesystemAdapter extends AbstractAdapter -{ - use FilesystemAdapterTrait; - - public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) - { - parent::__construct('', $defaultLifetime); - $this->init($namespace, $directory); - } - - /** - * {@inheritdoc} - */ - protected function doFetch(array $ids) - { - $values = array(); - $now = time(); - - foreach ($ids as $id) { - $file = $this->getFile($id); - if (!file_exists($file) || !$h = @fopen($file, 'rb')) { - continue; - } - if ($now >= (int) $expiresAt = fgets($h)) { - fclose($h); - if (isset($expiresAt[0])) { - @unlink($file); - } - } else { - $i = rawurldecode(rtrim(fgets($h))); - $value = stream_get_contents($h); - fclose($h); - if ($i === $id) { - $values[$id] = parent::unserialize($value); - } - } - } - - return $values; - } - - /** - * {@inheritdoc} - */ - protected function doHave($id) - { - $file = $this->getFile($id); - - return file_exists($file) && (@filemtime($file) > time() || $this->doFetch(array($id))); - } - - /** - * {@inheritdoc} - */ - protected function doSave(array $values, $lifetime) - { - $ok = true; - $expiresAt = time() + ($lifetime ?: 31557600); // 31557600s = 1 year - - foreach ($values as $id => $value) { - $ok = $this->write($this->getFile($id, true), $expiresAt."\n".rawurlencode($id)."\n".serialize($value), $expiresAt) && $ok; - } - - return $ok; - } -} diff --git a/lib/vendor/symfony/cache/Adapter/FilesystemAdapterTrait.php b/lib/vendor/symfony/cache/Adapter/FilesystemAdapterTrait.php deleted file mode 100644 index 2f6e43e..0000000 --- a/lib/vendor/symfony/cache/Adapter/FilesystemAdapterTrait.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Symfony\Component\Cache\Exception\InvalidArgumentException; - -/** - * @author Nicolas Grekas - * - * @internal - */ -trait FilesystemAdapterTrait -{ - private $directory; - private $tmp; - - private function init($namespace, $directory) - { - if (!isset($directory[0])) { - $directory = sys_get_temp_dir().'/symfony-cache'; - } - if (isset($namespace[0])) { - if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { - throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); - } - $directory .= '/'.$namespace; - } - if (!file_exists($dir = $directory.'/.')) { - @mkdir($directory, 0777, true); - } - if (false === $dir = realpath($dir) ?: (file_exists($dir) ? $dir : false)) { - throw new InvalidArgumentException(sprintf('Cache directory does not exist (%s)', $directory)); - } - if (!is_writable($dir .= DIRECTORY_SEPARATOR)) { - throw new InvalidArgumentException(sprintf('Cache directory is not writable (%s)', $directory)); - } - // On Windows the whole path is limited to 258 chars - if ('\\' === DIRECTORY_SEPARATOR && strlen($dir) > 234) { - throw new InvalidArgumentException(sprintf('Cache directory too long (%s)', $directory)); - } - - $this->directory = $dir; - $this->tmp = $this->directory.uniqid('', true); - } - - /** - * {@inheritdoc} - */ - protected function doClear($namespace) - { - $ok = true; - - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS)) as $file) { - $ok = ($file->isDir() || @unlink($file) || !file_exists($file)) && $ok; - } - - return $ok; - } - - /** - * {@inheritdoc} - */ - protected function doDelete(array $ids) - { - $ok = true; - - foreach ($ids as $id) { - $file = $this->getFile($id); - $ok = (!file_exists($file) || @unlink($file) || !file_exists($file)) && $ok; - } - - return $ok; - } - - private function write($file, $data, $expiresAt = null) - { - if (false === @file_put_contents($this->tmp, $data)) { - return false; - } - if (null !== $expiresAt) { - @touch($this->tmp, $expiresAt); - } - - if (@rename($this->tmp, $file)) { - return true; - } - @unlink($this->tmp); - - return false; - } - - private function getFile($id, $mkdir = false) - { - $hash = str_replace('/', '-', base64_encode(hash('sha256', static::class.$id, true))); - $dir = $this->directory.strtoupper($hash[0].DIRECTORY_SEPARATOR.$hash[1].DIRECTORY_SEPARATOR); - - if ($mkdir && !file_exists($dir)) { - @mkdir($dir, 0777, true); - } - - return $dir.substr($hash, 2, 20); - } -} diff --git a/lib/vendor/symfony/cache/Adapter/NullAdapter.php b/lib/vendor/symfony/cache/Adapter/NullAdapter.php deleted file mode 100644 index f58f81e..0000000 --- a/lib/vendor/symfony/cache/Adapter/NullAdapter.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\CacheItemInterface; -use Symfony\Component\Cache\CacheItem; - -/** - * @author Titouan Galopin - */ -class NullAdapter implements AdapterInterface -{ - private $createCacheItem; - - public function __construct() - { - $this->createCacheItem = \Closure::bind( - function ($key) { - $item = new CacheItem(); - $item->key = $key; - $item->isHit = false; - - return $item; - }, - $this, - CacheItem::class - ); - } - - /** - * {@inheritdoc} - */ - public function getItem($key) - { - $f = $this->createCacheItem; - - return $f($key); - } - - /** - * {@inheritdoc} - */ - public function getItems(array $keys = array()) - { - return $this->generateItems($keys); - } - - /** - * {@inheritdoc} - */ - public function hasItem($key) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function deleteItem($key) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function deleteItems(array $keys) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function save(CacheItemInterface $item) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function saveDeferred(CacheItemInterface $item) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function commit() - { - return false; - } - - private function generateItems(array $keys) - { - $f = $this->createCacheItem; - - foreach ($keys as $key) { - yield $key => $f($key); - } - } -} diff --git a/lib/vendor/symfony/cache/Adapter/PdoAdapter.php b/lib/vendor/symfony/cache/Adapter/PdoAdapter.php deleted file mode 100644 index 24245fc..0000000 --- a/lib/vendor/symfony/cache/Adapter/PdoAdapter.php +++ /dev/null @@ -1,395 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Driver\ServerInfoAwareConnection; -use Doctrine\DBAL\DBALException; -use Doctrine\DBAL\Schema\Schema; -use Symfony\Component\Cache\Exception\InvalidArgumentException; - -class PdoAdapter extends AbstractAdapter -{ - protected $maxIdLength = 255; - - private $conn; - private $dsn; - private $driver; - private $serverVersion; - private $table = 'cache_items'; - private $idCol = 'item_id'; - private $dataCol = 'item_data'; - private $lifetimeCol = 'item_lifetime'; - private $timeCol = 'item_time'; - private $username = ''; - private $password = ''; - private $connectionOptions = array(); - - /** - * Constructor. - * - * You can either pass an existing database connection as PDO instance or - * a Doctrine DBAL Connection or a DSN string that will be used to - * lazy-connect to the database when the cache is actually used. - * - * List of available options: - * * db_table: The name of the table [default: cache_items] - * * db_id_col: The column where to store the cache id [default: item_id] - * * db_data_col: The column where to store the cache data [default: item_data] - * * db_lifetime_col: The column where to store the lifetime [default: item_lifetime] - * * db_time_col: The column where to store the timestamp [default: item_time] - * * db_username: The username when lazy-connect [default: ''] - * * db_password: The password when lazy-connect [default: ''] - * * db_connection_options: An array of driver-specific connection options [default: array()] - * - * @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null - * @param string $namespace - * @param int $defaultLifetime - * @param array $options An associative array of options - * - * @throws InvalidArgumentException When first argument is not PDO nor Connection nor string - * @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION - * @throws InvalidArgumentException When namespace contains invalid characters - */ - public function __construct($connOrDsn, $namespace = '', $defaultLifetime = 0, array $options = array()) - { - if (isset($namespace[0]) && preg_match('#[^-+.A-Za-z0-9]#', $namespace, $match)) { - throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+.A-Za-z0-9] are allowed.', $match[0])); - } - - if ($connOrDsn instanceof \PDO) { - if (\PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { - throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); - } - - $this->conn = $connOrDsn; - } elseif ($connOrDsn instanceof Connection) { - $this->conn = $connOrDsn; - } elseif (is_string($connOrDsn)) { - $this->dsn = $connOrDsn; - } else { - throw new InvalidArgumentException(sprintf('"%s" requires PDO or Doctrine\DBAL\Connection instance or DSN string as first argument, "%s" given.', __CLASS__, is_object($connOrDsn) ? get_class($connOrDsn) : gettype($connOrDsn))); - } - - $this->table = isset($options['db_table']) ? $options['db_table'] : $this->table; - $this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol; - $this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol; - $this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol; - $this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol; - $this->username = isset($options['db_username']) ? $options['db_username'] : $this->username; - $this->password = isset($options['db_password']) ? $options['db_password'] : $this->password; - $this->connectionOptions = isset($options['db_connection_options']) ? $options['db_connection_options'] : $this->connectionOptions; - - parent::__construct($namespace, $defaultLifetime); - } - - /** - * Creates the table to store cache items which can be called once for setup. - * - * Cache ID are saved in a column of maximum length 255. Cache data is - * saved in a BLOB. - * - * @throws \PDOException When the table already exists - * @throws DBALException When the table already exists - * @throws \DomainException When an unsupported PDO driver is used - */ - public function createTable() - { - // connect if we are not yet - $conn = $this->getConnection(); - - if ($conn instanceof Connection) { - $schema = new Schema(); - $table = $schema->createTable($this->table); - $table->addColumn($this->idCol, 'blob', array('length' => 255)); - $table->addColumn($this->dataCol, 'blob', array('length' => 16777215)); - $table->addColumn($this->lifetimeCol, 'integer', array('unsigned' => true, 'notnull' => false)); - $table->addColumn($this->timeCol, 'integer', array('unsigned' => true, 'foo' => 'bar')); - $table->setPrimaryKey(array($this->idCol)); - - foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) { - $conn->exec($sql); - } - - return; - } - - switch ($this->driver) { - case 'mysql': - // We use varbinary for the ID column because it prevents unwanted conversions: - // - character set conversions between server and client - // - trailing space removal - // - case-insensitivity - // - language processing like é == e - $sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(255) NOT NULL PRIMARY KEY, $this->dataCol MEDIUMBLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB"; - break; - case 'sqlite': - $sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)"; - break; - case 'pgsql': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)"; - break; - case 'oci': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(255) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)"; - break; - case 'sqlsrv': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)"; - break; - default: - throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver)); - } - - $conn->exec($sql); - } - - /** - * {@inheritdoc} - */ - protected function doFetch(array $ids) - { - $now = time(); - $expired = array(); - - $sql = str_pad('', (count($ids) << 1) - 1, '?,'); - $sql = "SELECT $this->idCol, CASE WHEN $this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > ? THEN $this->dataCol ELSE NULL END FROM $this->table WHERE $this->idCol IN ($sql)"; - $stmt = $this->getConnection()->prepare($sql); - $stmt->bindValue($i = 1, $now, \PDO::PARAM_INT); - foreach ($ids as $id) { - $stmt->bindValue(++$i, $id); - } - $stmt->execute(); - - while ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - if (null === $row[1]) { - $expired[] = $row[0]; - } else { - yield $row[0] => parent::unserialize(is_resource($row[1]) ? stream_get_contents($row[1]) : $row[1]); - } - } - - if ($expired) { - $sql = str_pad('', (count($expired) << 1) - 1, '?,'); - $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol <= ? AND $this->idCol IN ($sql)"; - $stmt = $this->getConnection()->prepare($sql); - $stmt->bindValue($i = 1, $now, \PDO::PARAM_INT); - foreach ($expired as $id) { - $stmt->bindValue(++$i, $id); - } - $stmt->execute($expired); - } - } - - /** - * {@inheritdoc} - */ - protected function doHave($id) - { - $sql = "SELECT 1 FROM $this->table WHERE $this->idCol = :id AND ($this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > :time)"; - $stmt = $this->getConnection()->prepare($sql); - - $stmt->bindValue(':id', $id); - $stmt->bindValue(':time', time(), \PDO::PARAM_INT); - $stmt->execute(); - - return (bool) $stmt->fetchColumn(); - } - - /** - * {@inheritdoc} - */ - protected function doClear($namespace) - { - $conn = $this->getConnection(); - - if ('' === $namespace) { - if ('sqlite' === $this->driver) { - $sql = "DELETE FROM $this->table"; - } else { - $sql = "TRUNCATE TABLE $this->table"; - } - } else { - $sql = "DELETE FROM $this->table WHERE $this->idCol LIKE '$namespace%'"; - } - - $conn->exec($sql); - - return true; - } - - /** - * {@inheritdoc} - */ - protected function doDelete(array $ids) - { - $sql = str_pad('', (count($ids) << 1) - 1, '?,'); - $sql = "DELETE FROM $this->table WHERE $this->idCol IN ($sql)"; - $stmt = $this->getConnection()->prepare($sql); - $stmt->execute(array_values($ids)); - - return true; - } - - /** - * {@inheritdoc} - */ - protected function doSave(array $values, $lifetime) - { - $serialized = array(); - $failed = array(); - - foreach ($values as $id => $value) { - try { - $serialized[$id] = serialize($value); - } catch (\Exception $e) { - $failed[] = $id; - } - } - - if (!$serialized) { - return $failed; - } - - $conn = $this->getConnection(); - $driver = $this->driver; - $insertSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)"; - - switch (true) { - case 'mysql' === $driver: - $sql = $insertSql." ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)"; - break; - case 'oci' === $driver: - // DUAL is Oracle specific dummy table - $sql = "MERGE INTO $this->table USING DUAL ON ($this->idCol = ?) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?"; - break; - case 'sqlsrv' === $driver && version_compare($this->getServerVersion(), '10', '>='): - // MERGE is only available since SQL Server 2008 and must be terminated by semicolon - // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx - $sql = "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = ?) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?;"; - break; - case 'sqlite' === $driver: - $sql = 'INSERT OR REPLACE'.substr($insertSql, 6); - break; - case 'pgsql' === $driver && version_compare($this->getServerVersion(), '9.5', '>='): - $sql = $insertSql." ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)"; - break; - default: - $driver = null; - $sql = "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id"; - break; - } - - $now = time(); - $lifetime = $lifetime ?: null; - $stmt = $conn->prepare($sql); - - if ('sqlsrv' === $driver || 'oci' === $driver) { - $stmt->bindParam(1, $id); - $stmt->bindParam(2, $id); - $stmt->bindParam(3, $data, \PDO::PARAM_LOB); - $stmt->bindValue(4, $lifetime, \PDO::PARAM_INT); - $stmt->bindValue(5, $now, \PDO::PARAM_INT); - $stmt->bindParam(6, $data, \PDO::PARAM_LOB); - $stmt->bindValue(7, $lifetime, \PDO::PARAM_INT); - $stmt->bindValue(8, $now, \PDO::PARAM_INT); - } else { - $stmt->bindParam(':id', $id); - $stmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $stmt->bindValue(':lifetime', $lifetime, \PDO::PARAM_INT); - $stmt->bindValue(':time', $now, \PDO::PARAM_INT); - } - if (null === $driver) { - $insertStmt = $conn->prepare($insertSql); - - $insertStmt->bindParam(':id', $id); - $insertStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $insertStmt->bindValue(':lifetime', $lifetime, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', $now, \PDO::PARAM_INT); - } - - foreach ($serialized as $id => $data) { - $stmt->execute(); - - if (null === $driver && !$stmt->rowCount()) { - try { - $insertStmt->execute(); - } catch (DBALException $e) { - } catch (\PDOException $e) { - // A concurrent write won, let it be - } - } - } - - return $failed; - } - - /** - * @return \PDO|Connection - */ - private function getConnection() - { - if (null === $this->conn) { - $this->conn = new \PDO($this->dsn, $this->username, $this->password, $this->connectionOptions); - $this->conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - } - if (null === $this->driver) { - if ($this->conn instanceof \PDO) { - $this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME); - } else { - switch ($this->driver = $this->conn->getDriver()->getName()) { - case 'mysqli': - case 'pdo_mysql': - case 'drizzle_pdo_mysql': - $this->driver = 'mysql'; - break; - case 'pdo_sqlite': - $this->driver = 'sqlite'; - break; - case 'pdo_pgsql': - $this->driver = 'pgsql'; - break; - case 'oci8': - case 'pdo_oracle': - $this->driver = 'oci'; - break; - case 'pdo_sqlsrv': - $this->driver = 'sqlsrv'; - break; - } - } - } - - return $this->conn; - } - - /** - * @return string - */ - private function getServerVersion() - { - if (null === $this->serverVersion) { - $conn = $this->conn instanceof \PDO ? $this->conn : $this->conn->getWrappedConnection(); - if ($conn instanceof \PDO) { - $this->serverVersion = $conn->getAttribute(\PDO::ATTR_SERVER_VERSION); - } elseif ($conn instanceof ServerInfoAwareConnection) { - $this->serverVersion = $conn->getServerVersion(); - } else { - $this->serverVersion = '0'; - } - } - - return $this->serverVersion; - } -} diff --git a/lib/vendor/symfony/cache/Adapter/PhpArrayAdapter.php b/lib/vendor/symfony/cache/Adapter/PhpArrayAdapter.php deleted file mode 100644 index 35fcad9..0000000 --- a/lib/vendor/symfony/cache/Adapter/PhpArrayAdapter.php +++ /dev/null @@ -1,374 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\CacheItemInterface; -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\CacheItem; -use Symfony\Component\Cache\Exception\InvalidArgumentException; - -/** - * Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0. - * Warmed up items are read-only and run-time discovered items are cached using a fallback adapter. - * - * @author Titouan Galopin - * @author Nicolas Grekas - */ -class PhpArrayAdapter implements AdapterInterface -{ - private $file; - private $values; - private $createCacheItem; - private $fallbackPool; - - /** - * @param string $file The PHP file were values are cached - * @param AdapterInterface $fallbackPool A pool to fallback on when an item is not hit - */ - public function __construct($file, AdapterInterface $fallbackPool) - { - $this->file = $file; - $this->fallbackPool = $fallbackPool; - $this->createCacheItem = \Closure::bind( - function ($key, $value, $isHit) { - $item = new CacheItem(); - $item->key = $key; - $item->value = $value; - $item->isHit = $isHit; - - return $item; - }, - null, - CacheItem::class - ); - } - - /** - * This adapter should only be used on PHP 7.0+ to take advantage of how PHP - * stores arrays in its latest versions. This factory method decorates the given - * fallback pool with this adapter only if the current PHP version is supported. - * - * @param string $file The PHP file were values are cached - * - * @return CacheItemPoolInterface - */ - public static function create($file, CacheItemPoolInterface $fallbackPool) - { - // Shared memory is available in PHP 7.0+ with OPCache enabled and in HHVM - if ((PHP_VERSION_ID >= 70000 && ini_get('opcache.enable')) || defined('HHVM_VERSION')) { - if (!$fallbackPool instanceof AdapterInterface) { - $fallbackPool = new ProxyAdapter($fallbackPool); - } - - return new static($file, $fallbackPool); - } - - return $fallbackPool; - } - - /** - * Store an array of cached values. - * - * @param array $values The cached values - */ - public function warmUp(array $values) - { - if (file_exists($this->file)) { - if (!is_file($this->file)) { - throw new InvalidArgumentException(sprintf('Cache path exists and is not a file: %s.', $this->file)); - } - - if (!is_writable($this->file)) { - throw new InvalidArgumentException(sprintf('Cache file is not writable: %s.', $this->file)); - } - } else { - $directory = dirname($this->file); - - if (!is_dir($directory) && !@mkdir($directory, 0777, true)) { - throw new InvalidArgumentException(sprintf('Cache directory does not exist and cannot be created: %s.', $directory)); - } - - if (!is_writable($directory)) { - throw new InvalidArgumentException(sprintf('Cache directory is not writable: %s.', $directory)); - } - } - - $dump = <<<'EOF' - $value) { - CacheItem::validateKey(is_int($key) ? (string) $key : $key); - - if (null === $value || is_object($value)) { - try { - $value = serialize($value); - } catch (\Exception $e) { - throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, get_class($value)), 0, $e); - } - } elseif (is_array($value)) { - try { - $serialized = serialize($value); - $unserialized = unserialize($serialized); - } catch (\Exception $e) { - throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable array value.', $key), 0, $e); - } - // Store arrays serialized if they contain any objects or references - if ($unserialized !== $value || (false !== strpos($serialized, ';R:') && preg_match('/;R:[1-9]/', $serialized))) { - $value = $serialized; - } - } elseif (is_string($value)) { - // Serialize strings if they could be confused with serialized objects or arrays - if ('N;' === $value || (isset($value[2]) && ':' === $value[1])) { - $value = serialize($value); - } - } elseif (!is_scalar($value)) { - throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, gettype($value))); - } - - $dump .= var_export($key, true).' => '.var_export($value, true).",\n"; - } - - $dump .= "\n);\n"; - $dump = str_replace("' . \"\\0\" . '", "\0", $dump); - - $tmpFile = uniqid($this->file, true); - - file_put_contents($tmpFile, $dump); - @chmod($tmpFile, 0666); - unset($serialized, $unserialized, $value, $dump); - - @rename($tmpFile, $this->file); - - $this->values = (include $this->file) ?: array(); - } - - /** - * {@inheritdoc} - */ - public function getItem($key) - { - if (null === $this->values) { - $this->initialize(); - } - - if (!is_string($key)) { - throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); - } - - if (!isset($this->values[$key])) { - return $this->fallbackPool->getItem($key); - } - - $value = $this->values[$key]; - $isHit = true; - - if ('N;' === $value) { - $value = null; - } elseif (is_string($value) && isset($value[2]) && ':' === $value[1]) { - try { - $e = null; - $value = unserialize($value); - } catch (\Error $e) { - } catch (\Exception $e) { - } - if (null !== $e) { - $value = null; - $isHit = false; - } - } - - $f = $this->createCacheItem; - - return $f($key, $value, $isHit); - } - - /** - * {@inheritdoc} - */ - public function getItems(array $keys = array()) - { - if (null === $this->values) { - $this->initialize(); - } - - foreach ($keys as $key) { - if (!is_string($key)) { - throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); - } - } - - return $this->generateItems($keys); - } - - /** - * {@inheritdoc} - */ - public function hasItem($key) - { - if (null === $this->values) { - $this->initialize(); - } - - if (!is_string($key)) { - throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); - } - - return isset($this->values[$key]) || $this->fallbackPool->hasItem($key); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $this->values = array(); - - $cleared = @unlink($this->file) || !file_exists($this->file); - - return $this->fallbackPool->clear() && $cleared; - } - - /** - * {@inheritdoc} - */ - public function deleteItem($key) - { - if (null === $this->values) { - $this->initialize(); - } - - if (!is_string($key)) { - throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); - } - - return !isset($this->values[$key]) && $this->fallbackPool->deleteItem($key); - } - - /** - * {@inheritdoc} - */ - public function deleteItems(array $keys) - { - if (null === $this->values) { - $this->initialize(); - } - - $deleted = true; - $fallbackKeys = array(); - - foreach ($keys as $key) { - if (!is_string($key)) { - throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', is_object($key) ? get_class($key) : gettype($key))); - } - - if (isset($this->values[$key])) { - $deleted = false; - } else { - $fallbackKeys[] = $key; - } - } - - if ($fallbackKeys) { - $deleted = $this->fallbackPool->deleteItems($fallbackKeys) && $deleted; - } - - return $deleted; - } - - /** - * {@inheritdoc} - */ - public function save(CacheItemInterface $item) - { - if (null === $this->values) { - $this->initialize(); - } - - return !isset($this->values[$item->getKey()]) && $this->fallbackPool->save($item); - } - - /** - * {@inheritdoc} - */ - public function saveDeferred(CacheItemInterface $item) - { - if (null === $this->values) { - $this->initialize(); - } - - return !isset($this->values[$item->getKey()]) && $this->fallbackPool->saveDeferred($item); - } - - /** - * {@inheritdoc} - */ - public function commit() - { - return $this->fallbackPool->commit(); - } - - /** - * Load the cache file. - */ - private function initialize() - { - $this->values = @(include $this->file) ?: array(); - } - - /** - * Generator for items. - * - * @param array $keys - * - * @return \Generator - */ - private function generateItems(array $keys) - { - $f = $this->createCacheItem; - $fallbackKeys = array(); - - foreach ($keys as $key) { - if (isset($this->values[$key])) { - $value = $this->values[$key]; - - if ('N;' === $value) { - yield $key => $f($key, null, true); - } elseif (is_string($value) && isset($value[2]) && ':' === $value[1]) { - try { - yield $key => $f($key, unserialize($value), true); - } catch (\Error $e) { - yield $key => $f($key, null, false); - } catch (\Exception $e) { - yield $key => $f($key, null, false); - } - } else { - yield $key => $f($key, $value, true); - } - } else { - $fallbackKeys[] = $key; - } - } - - if ($fallbackKeys) { - foreach ($this->fallbackPool->getItems($fallbackKeys) as $key => $item) { - yield $key => $item; - } - } - } -} diff --git a/lib/vendor/symfony/cache/Adapter/PhpFilesAdapter.php b/lib/vendor/symfony/cache/Adapter/PhpFilesAdapter.php deleted file mode 100644 index 8e09280..0000000 --- a/lib/vendor/symfony/cache/Adapter/PhpFilesAdapter.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Symfony\Component\Cache\Exception\CacheException; -use Symfony\Component\Cache\Exception\InvalidArgumentException; - -/** - * @author Piotr Stankowski - * @author Nicolas Grekas - */ -class PhpFilesAdapter extends AbstractAdapter -{ - use FilesystemAdapterTrait; - - private $includeHandler; - - public static function isSupported() - { - return function_exists('opcache_compile_file') && ini_get('opcache.enable'); - } - - public function __construct($namespace = '', $defaultLifetime = 0, $directory = null) - { - if (!static::isSupported()) { - throw new CacheException('OPcache is not enabled'); - } - parent::__construct('', $defaultLifetime); - $this->init($namespace, $directory); - - $e = new \Exception(); - $this->includeHandler = function () use ($e) { throw $e; }; - } - - /** - * {@inheritdoc} - */ - protected function doFetch(array $ids) - { - $values = array(); - $now = time(); - - set_error_handler($this->includeHandler); - try { - foreach ($ids as $id) { - try { - $file = $this->getFile($id); - list($expiresAt, $values[$id]) = include $file; - if ($now >= $expiresAt) { - unset($values[$id]); - } - } catch (\Exception $e) { - continue; - } - } - } finally { - restore_error_handler(); - } - - foreach ($values as $id => $value) { - if ('N;' === $value) { - $values[$id] = null; - } elseif (is_string($value) && isset($value[2]) && ':' === $value[1]) { - $values[$id] = parent::unserialize($value); - } - } - - return $values; - } - - /** - * {@inheritdoc} - */ - protected function doHave($id) - { - return (bool) $this->doFetch(array($id)); - } - - /** - * {@inheritdoc} - */ - protected function doSave(array $values, $lifetime) - { - $ok = true; - $data = array($lifetime ? time() + $lifetime : PHP_INT_MAX, ''); - - foreach ($values as $key => $value) { - if (null === $value || is_object($value)) { - $value = serialize($value); - } elseif (is_array($value)) { - $serialized = serialize($value); - $unserialized = parent::unserialize($serialized); - // Store arrays serialized if they contain any objects or references - if ($unserialized !== $value || (false !== strpos($serialized, ';R:') && preg_match('/;R:[1-9]/', $serialized))) { - $value = $serialized; - } - } elseif (is_string($value)) { - // Serialize strings if they could be confused with serialized objects or arrays - if ('N;' === $value || (isset($value[2]) && ':' === $value[1])) { - $value = serialize($value); - } - } elseif (!is_scalar($value)) { - throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, gettype($value))); - } - - $data[1] = $value; - $file = $this->getFile($key, true); - $ok = $this->write($file, ' - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\CacheItemInterface; -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\CacheItem; - -/** - * @author Nicolas Grekas - */ -class ProxyAdapter implements AdapterInterface -{ - private $pool; - private $namespace; - private $namespaceLen; - private $createCacheItem; - private $poolHash; - - public function __construct(CacheItemPoolInterface $pool, $namespace = '', $defaultLifetime = 0) - { - $this->pool = $pool; - $this->poolHash = $poolHash = spl_object_hash($pool); - $this->namespace = '' === $namespace ? '' : $this->getId($namespace); - $this->namespaceLen = strlen($namespace); - $this->createCacheItem = \Closure::bind( - function ($key, $innerItem) use ($defaultLifetime, $poolHash) { - $item = new CacheItem(); - $item->key = $key; - $item->value = $innerItem->get(); - $item->isHit = $innerItem->isHit(); - $item->defaultLifetime = $defaultLifetime; - $item->innerItem = $innerItem; - $item->poolHash = $poolHash; - $innerItem->set(null); - - return $item; - }, - null, - CacheItem::class - ); - } - - /** - * {@inheritdoc} - */ - public function getItem($key) - { - $f = $this->createCacheItem; - $item = $this->pool->getItem($this->getId($key)); - - return $f($key, $item); - } - - /** - * {@inheritdoc} - */ - public function getItems(array $keys = array()) - { - if ($this->namespaceLen) { - foreach ($keys as $i => $key) { - $keys[$i] = $this->getId($key); - } - } - - return $this->generateItems($this->pool->getItems($keys)); - } - - /** - * {@inheritdoc} - */ - public function hasItem($key) - { - return $this->pool->hasItem($this->getId($key)); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - return $this->pool->clear(); - } - - /** - * {@inheritdoc} - */ - public function deleteItem($key) - { - return $this->pool->deleteItem($this->getId($key)); - } - - /** - * {@inheritdoc} - */ - public function deleteItems(array $keys) - { - if ($this->namespaceLen) { - foreach ($keys as $i => $key) { - $keys[$i] = $this->getId($key); - } - } - - return $this->pool->deleteItems($keys); - } - - /** - * {@inheritdoc} - */ - public function save(CacheItemInterface $item) - { - return $this->doSave($item, __FUNCTION__); - } - - /** - * {@inheritdoc} - */ - public function saveDeferred(CacheItemInterface $item) - { - return $this->doSave($item, __FUNCTION__); - } - - /** - * {@inheritdoc} - */ - public function commit() - { - return $this->pool->commit(); - } - - private function doSave(CacheItemInterface $item, $method) - { - if (!$item instanceof CacheItem) { - return false; - } - $item = (array) $item; - $expiry = $item["\0*\0expiry"]; - if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) { - $expiry = time() + $item["\0*\0defaultLifetime"]; - } - $innerItem = $item["\0*\0poolHash"] === $this->poolHash ? $item["\0*\0innerItem"] : $this->pool->getItem($this->namespace.$item["\0*\0key"]); - $innerItem->set($item["\0*\0value"]); - $innerItem->expiresAt(null !== $expiry ? \DateTime::createFromFormat('U', $expiry) : null); - - return $this->pool->$method($innerItem); - } - - private function generateItems($items) - { - $f = $this->createCacheItem; - - foreach ($items as $key => $item) { - if ($this->namespaceLen) { - $key = substr($key, $this->namespaceLen); - } - - yield $key => $f($key, $item); - } - } - - private function getId($key) - { - CacheItem::validateKey($key); - - return $this->namespace.$key; - } -} diff --git a/lib/vendor/symfony/cache/Adapter/RedisAdapter.php b/lib/vendor/symfony/cache/Adapter/RedisAdapter.php deleted file mode 100644 index fccfb92..0000000 --- a/lib/vendor/symfony/cache/Adapter/RedisAdapter.php +++ /dev/null @@ -1,311 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Predis\Connection\Factory; -use Predis\Connection\Aggregate\PredisCluster; -use Predis\Connection\Aggregate\RedisCluster; -use Symfony\Component\Cache\Exception\InvalidArgumentException; - -/** - * @author Aurimas Niekis - * @author Nicolas Grekas - */ -class RedisAdapter extends AbstractAdapter -{ - private static $defaultConnectionOptions = array( - 'class' => null, - 'persistent' => 0, - 'persistent_id' => null, - 'timeout' => 0, - 'read_timeout' => 0, - 'retry_interval' => 0, - ); - private $redis; - - /** - * @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient - */ - public function __construct($redisClient, $namespace = '', $defaultLifetime = 0) - { - parent::__construct($namespace, $defaultLifetime); - - if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { - throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); - } - if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\Client) { - throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, is_object($redisClient) ? get_class($redisClient) : gettype($redisClient))); - } - $this->redis = $redisClient; - } - - /** - * Creates a Redis connection using a DSN configuration. - * - * Example DSN: - * - redis://localhost - * - redis://example.com:1234 - * - redis://secret@example.com/13 - * - redis:///var/run/redis.sock - * - redis://secret@/var/run/redis.sock/13 - * - * @param string $dsn - * @param array $options See self::$defaultConnectionOptions - * - * @throws InvalidArgumentException When the DSN is invalid. - * - * @return \Redis|\Predis\Client According to the "class" option - */ - public static function createConnection($dsn, array $options = array()) - { - if (0 !== strpos($dsn, 'redis://')) { - throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s does not start with "redis://"', $dsn)); - } - $params = preg_replace_callback('#^redis://(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) { - if (isset($m[1])) { - $auth = $m[1]; - } - - return 'file://'; - }, $dsn); - if (false === $params = parse_url($params)) { - throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s', $dsn)); - } - if (!isset($params['host']) && !isset($params['path'])) { - throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s', $dsn)); - } - if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) { - $params['dbindex'] = $m[1]; - $params['path'] = substr($params['path'], 0, -strlen($m[0])); - } - $params += array( - 'host' => isset($params['host']) ? $params['host'] : $params['path'], - 'port' => isset($params['host']) ? 6379 : null, - 'dbindex' => 0, - ); - if (isset($params['query'])) { - parse_str($params['query'], $query); - $params += $query; - } - $params += $options + self::$defaultConnectionOptions; - $class = null === $params['class'] ? (extension_loaded('redis') ? \Redis::class : \Predis\Client::class) : $params['class']; - - if (is_a($class, \Redis::class, true)) { - $connect = $params['persistent'] || $params['persistent_id'] ? 'pconnect' : 'connect'; - $redis = new $class(); - @$redis->{$connect}($params['host'], $params['port'], $params['timeout'], $params['persistent_id'], $params['retry_interval']); - - if (@!$redis->isConnected()) { - $e = ($e = error_get_last()) && preg_match('/^Redis::p?connect\(\): (.*)/', $e['message'], $e) ? sprintf(' (%s)', $e[1]) : ''; - throw new InvalidArgumentException(sprintf('Redis connection failed%s: %s', $e, $dsn)); - } - - if ((null !== $auth && !$redis->auth($auth)) - || ($params['dbindex'] && !$redis->select($params['dbindex'])) - || ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout'])) - ) { - $e = preg_replace('/^ERR /', '', $redis->getLastError()); - throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e, $dsn)); - } - } elseif (is_a($class, \Predis\Client::class, true)) { - $params['scheme'] = isset($params['host']) ? 'tcp' : 'unix'; - $params['database'] = $params['dbindex'] ?: null; - $params['password'] = $auth; - $redis = new $class((new Factory())->create($params)); - } elseif (class_exists($class, false)) { - throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis" or "Predis\Client"', $class)); - } else { - throw new InvalidArgumentException(sprintf('Class "%s" does not exist', $class)); - } - - return $redis; - } - - /** - * {@inheritdoc} - */ - protected function doFetch(array $ids) - { - if ($ids) { - $values = $this->redis->mGet($ids); - $index = 0; - foreach ($ids as $id) { - if ($value = $values[$index++]) { - yield $id => parent::unserialize($value); - } - } - } - } - - /** - * {@inheritdoc} - */ - protected function doHave($id) - { - return (bool) $this->redis->exists($id); - } - - /** - * {@inheritdoc} - */ - protected function doClear($namespace) - { - // When using a native Redis cluster, clearing the cache cannot work and always returns false. - // Clearing the cache should then be done by any other means (e.g. by restarting the cluster). - - $cleared = true; - $hosts = array($this->redis); - $evalArgs = array(array($namespace), 0); - - if ($this->redis instanceof \Predis\Client) { - $evalArgs = array(0, $namespace); - - $connection = $this->redis->getConnection(); - if ($connection instanceof PredisCluster) { - $hosts = array(); - foreach ($connection as $c) { - $hosts[] = new \Predis\Client($c); - } - } elseif ($connection instanceof RedisCluster) { - return false; - } - } elseif ($this->redis instanceof \RedisArray) { - $hosts = array(); - foreach ($this->redis->_hosts() as $host) { - $hosts[] = $this->redis->_instance($host); - } - } elseif ($this->redis instanceof \RedisCluster) { - return false; - } - foreach ($hosts as $host) { - if (!isset($namespace[0])) { - $cleared = $host->flushDb() && $cleared; - continue; - } - - $info = $host->info('Server'); - $info = isset($info['Server']) ? $info['Server'] : $info; - - if (!version_compare($info['redis_version'], '2.8', '>=')) { - // As documented in Redis documentation (http://redis.io/commands/keys) using KEYS - // can hang your server when it is executed against large databases (millions of items). - // Whenever you hit this scale, you should really consider upgrading to Redis 2.8 or above. - $cleared = $host->eval("local keys=redis.call('KEYS',ARGV[1]..'*') for i=1,#keys,5000 do redis.call('DEL',unpack(keys,i,math.min(i+4999,#keys))) end return 1", $evalArgs[0], $evalArgs[1]) && $cleared; - continue; - } - - $cursor = null; - do { - $keys = $host instanceof \Predis\Client ? $host->scan($cursor, 'MATCH', $namespace.'*', 'COUNT', 1000) : $host->scan($cursor, $namespace.'*', 1000); - if (isset($keys[1]) && is_array($keys[1])) { - $cursor = $keys[0]; - $keys = $keys[1]; - } - if ($keys) { - $host->del($keys); - } - } while ($cursor = (int) $cursor); - } - - return $cleared; - } - - /** - * {@inheritdoc} - */ - protected function doDelete(array $ids) - { - if ($ids) { - $this->redis->del($ids); - } - - return true; - } - - /** - * {@inheritdoc} - */ - protected function doSave(array $values, $lifetime) - { - $serialized = array(); - $failed = array(); - - foreach ($values as $id => $value) { - try { - $serialized[$id] = serialize($value); - } catch (\Exception $e) { - $failed[] = $id; - } - } - - if (!$serialized) { - return $failed; - } - - if (0 >= $lifetime) { - $this->redis->mSet($serialized); - - return $failed; - } - - $this->pipeline(function ($pipe) use (&$serialized, $lifetime) { - foreach ($serialized as $id => $value) { - $pipe('setEx', $id, array($lifetime, $value)); - } - }); - - return $failed; - } - - private function execute($command, $id, array $args, $redis = null) - { - array_unshift($args, $id); - call_user_func_array(array($redis ?: $this->redis, $command), $args); - } - - private function pipeline(\Closure $callback) - { - $redis = $this->redis; - - try { - if ($redis instanceof \Predis\Client) { - $redis->pipeline(function ($pipe) use ($callback) { - $this->redis = $pipe; - $callback(array($this, 'execute')); - }); - } elseif ($redis instanceof \RedisArray) { - $connections = array(); - $callback(function ($command, $id, $args) use (&$connections) { - if (!isset($connections[$h = $this->redis->_target($id)])) { - $connections[$h] = $this->redis->_instance($h); - $connections[$h]->multi(\Redis::PIPELINE); - } - $this->execute($command, $id, $args, $connections[$h]); - }); - foreach ($connections as $c) { - $c->exec(); - } - } else { - $pipe = $redis->multi(\Redis::PIPELINE); - try { - $callback(array($this, 'execute')); - } finally { - if ($pipe) { - $redis->exec(); - } - } - } - } finally { - $this->redis = $redis; - } - } -} diff --git a/lib/vendor/symfony/cache/Adapter/TagAwareAdapter.php b/lib/vendor/symfony/cache/Adapter/TagAwareAdapter.php deleted file mode 100644 index 802c30f..0000000 --- a/lib/vendor/symfony/cache/Adapter/TagAwareAdapter.php +++ /dev/null @@ -1,308 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\CacheItemInterface; -use Psr\Cache\InvalidArgumentException; -use Symfony\Component\Cache\CacheItem; - -/** - * @author Nicolas Grekas - */ -class TagAwareAdapter implements TagAwareAdapterInterface -{ - const TAGS_PREFIX = "\0tags\0"; - - private $itemsAdapter; - private $deferred = array(); - private $createCacheItem; - private $getTagsByKey; - private $tagsAdapter; - - public function __construct(AdapterInterface $itemsAdapter, AdapterInterface $tagsAdapter = null) - { - $this->itemsAdapter = $itemsAdapter; - $this->tagsAdapter = $tagsAdapter ?: $itemsAdapter; - $this->createCacheItem = \Closure::bind( - function ($key, $value = null, CacheItem $protoItem = null) { - $item = new CacheItem(); - $item->key = $key; - $item->value = $value; - $item->isHit = false; - - if (null !== $protoItem) { - $item->defaultLifetime = $protoItem->defaultLifetime; - $item->innerItem = $protoItem->innerItem; - $item->poolHash = $protoItem->poolHash; - } - - return $item; - }, - null, - CacheItem::class - ); - $this->getTagsByKey = \Closure::bind( - function ($deferred) { - $tagsByKey = array(); - foreach ($deferred as $key => $item) { - $tagsByKey[$key] = $item->tags; - } - - return $tagsByKey; - }, - null, - CacheItem::class - ); - } - - /** - * {@inheritdoc} - */ - public function invalidateTags(array $tags) - { - foreach ($tags as $k => $tag) { - if ('' !== $tag && is_string($tag)) { - $tags[$k] = $tag.static::TAGS_PREFIX; - } - } - - foreach ($this->tagsAdapter->getItems($tags) as $v) { - $v->set(1 + (int) $v->get()); - $this->tagsAdapter->saveDeferred($v); - } - - return $this->tagsAdapter->commit(); - } - - /** - * {@inheritdoc} - */ - public function hasItem($key) - { - if ($this->deferred) { - $this->commit(); - } - if (!$this->itemsAdapter->hasItem($key)) { - return false; - } - if (!$itemTags = $this->itemsAdapter->getItem(static::TAGS_PREFIX.$key)->get()) { - return true; - } - - foreach ($this->getTagVersions(array($itemTags)) as $tag => $version) { - if ($itemTags[$tag] !== $version) { - return false; - } - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function getItem($key) - { - foreach ($this->getItems(array($key)) as $item) { - return $item; - } - } - - /** - * {@inheritdoc} - */ - public function getItems(array $keys = array()) - { - if ($this->deferred) { - $this->commit(); - } - $tagKeys = array(); - - foreach ($keys as $key) { - if ('' !== $key && is_string($key)) { - $key = static::TAGS_PREFIX.$key; - $tagKeys[$key] = $key; - } - } - - try { - $items = $this->itemsAdapter->getItems($tagKeys + $keys); - } catch (InvalidArgumentException $e) { - $this->itemsAdapter->getItems($keys); // Should throw an exception - - throw $e; - } - - return $this->generateItems($items, $tagKeys); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $this->deferred = array(); - - return $this->itemsAdapter->clear(); - } - - /** - * {@inheritdoc} - */ - public function deleteItem($key) - { - return $this->deleteItems(array($key)); - } - - /** - * {@inheritdoc} - */ - public function deleteItems(array $keys) - { - foreach ($keys as $key) { - if ('' !== $key && is_string($key)) { - $keys[] = static::TAGS_PREFIX.$key; - } - } - - return $this->itemsAdapter->deleteItems($keys); - } - - /** - * {@inheritdoc} - */ - public function save(CacheItemInterface $item) - { - if (!$item instanceof CacheItem) { - return false; - } - $this->deferred[$item->getKey()] = $item; - - return $this->commit(); - } - - /** - * {@inheritdoc} - */ - public function saveDeferred(CacheItemInterface $item) - { - if (!$item instanceof CacheItem) { - return false; - } - $this->deferred[$item->getKey()] = $item; - - return true; - } - - /** - * {@inheritdoc} - */ - public function commit() - { - $ok = true; - - if ($this->deferred) { - foreach ($this->deferred as $key => $item) { - if (!$this->itemsAdapter->saveDeferred($item)) { - unset($this->deferred[$key]); - $ok = false; - } - } - - $f = $this->getTagsByKey; - $tagsByKey = $f($this->deferred); - $deletedTags = $this->deferred = array(); - $tagVersions = $this->getTagVersions($tagsByKey); - $f = $this->createCacheItem; - - foreach ($tagsByKey as $key => $tags) { - if ($tags) { - $this->itemsAdapter->saveDeferred($f(static::TAGS_PREFIX.$key, array_intersect_key($tagVersions, $tags))); - } else { - $deletedTags[] = static::TAGS_PREFIX.$key; - } - } - if ($deletedTags) { - $this->itemsAdapter->deleteItems($deletedTags); - } - } - - return $this->itemsAdapter->commit() && $ok; - } - - public function __destruct() - { - $this->commit(); - } - - private function generateItems($items, array $tagKeys) - { - $bufferedItems = $itemTags = $invalidKeys = array(); - $f = $this->createCacheItem; - - foreach ($items as $key => $item) { - if (!$tagKeys) { - yield $key => isset($invalidKeys[self::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item; - continue; - } - if (!isset($tagKeys[$key])) { - $bufferedItems[$key] = $item; - continue; - } - - unset($tagKeys[$key]); - if ($tags = $item->get()) { - $itemTags[$key] = $tags; - } - if (!$tagKeys) { - $tagVersions = $this->getTagVersions($itemTags); - - foreach ($itemTags as $key => $tags) { - foreach ($tags as $tag => $version) { - if ($tagVersions[$tag] !== $version) { - $invalidKeys[$key] = true; - continue 2; - } - } - } - $itemTags = $tagVersions = $tagKeys = null; - - foreach ($bufferedItems as $key => $item) { - yield $key => isset($invalidKeys[self::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item; - } - $bufferedItems = null; - } - } - } - - private function getTagVersions(array $tagsByKey) - { - $tagVersions = array(); - - foreach ($tagsByKey as $tags) { - $tagVersions += $tags; - } - - if ($tagVersions) { - $tags = array(); - foreach ($tagVersions as $tag => $version) { - $tagVersions[$tag] = $tag.static::TAGS_PREFIX; - $tags[$tag.static::TAGS_PREFIX] = $tag; - } - foreach ($this->tagsAdapter->getItems($tagVersions) as $tag => $version) { - $tagVersions[$tags[$tag]] = $version->get() ?: 0; - } - } - - return $tagVersions; - } -} diff --git a/lib/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php b/lib/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php deleted file mode 100644 index 340048c..0000000 --- a/lib/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Adapter; - -use Psr\Cache\InvalidArgumentException; - -/** - * Interface for invalidating cached items using tags. - * - * @author Nicolas Grekas - */ -interface TagAwareAdapterInterface extends AdapterInterface -{ - /** - * Invalidates cached items using tags. - * - * @param string[] $tags An array of tags to invalidate - * - * @return bool True on success - * - * @throws InvalidArgumentException When $tags is not valid - */ - public function invalidateTags(array $tags); -} diff --git a/lib/vendor/symfony/cache/CacheItem.php b/lib/vendor/symfony/cache/CacheItem.php deleted file mode 100644 index f3d8b83..0000000 --- a/lib/vendor/symfony/cache/CacheItem.php +++ /dev/null @@ -1,172 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache; - -use Psr\Cache\CacheItemInterface; -use Psr\Log\LoggerInterface; -use Symfony\Component\Cache\Exception\InvalidArgumentException; - -/** - * @author Nicolas Grekas - */ -final class CacheItem implements CacheItemInterface -{ - protected $key; - protected $value; - protected $isHit; - protected $expiry; - protected $defaultLifetime; - protected $tags = array(); - protected $innerItem; - protected $poolHash; - - /** - * {@inheritdoc} - */ - public function getKey() - { - return $this->key; - } - - /** - * {@inheritdoc} - */ - public function get() - { - return $this->value; - } - - /** - * {@inheritdoc} - */ - public function isHit() - { - return $this->isHit; - } - - /** - * {@inheritdoc} - */ - public function set($value) - { - $this->value = $value; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function expiresAt($expiration) - { - if (null === $expiration) { - $this->expiry = $this->defaultLifetime > 0 ? time() + $this->defaultLifetime : null; - } elseif ($expiration instanceof \DateTimeInterface) { - $this->expiry = (int) $expiration->format('U'); - } else { - throw new InvalidArgumentException(sprintf('Expiration date must implement DateTimeInterface or be null, "%s" given', is_object($expiration) ? get_class($expiration) : gettype($expiration))); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function expiresAfter($time) - { - if (null === $time) { - $this->expiry = $this->defaultLifetime > 0 ? time() + $this->defaultLifetime : null; - } elseif ($time instanceof \DateInterval) { - $this->expiry = (int) \DateTime::createFromFormat('U', time())->add($time)->format('U'); - } elseif (is_int($time)) { - $this->expiry = $time + time(); - } else { - throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', is_object($time) ? get_class($time) : gettype($time))); - } - - return $this; - } - - /** - * Adds a tag to a cache item. - * - * @param string|string[] $tags A tag or array of tags - * - * @return static - * - * @throws InvalidArgumentException When $tag is not valid. - */ - public function tag($tags) - { - if (!is_array($tags)) { - $tags = array($tags); - } - foreach ($tags as $tag) { - if (!is_string($tag)) { - throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given', is_object($tag) ? get_class($tag) : gettype($tag))); - } - if (isset($this->tags[$tag])) { - continue; - } - if (!isset($tag[0])) { - throw new InvalidArgumentException('Cache tag length must be greater than zero'); - } - if (isset($tag[strcspn($tag, '{}()/\@:')])) { - throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters {}()/\@:', $tag)); - } - $this->tags[$tag] = $tag; - } - - return $this; - } - - /** - * Validates a cache key according to PSR-6. - * - * @param string $key The key to validate - * - * @throws InvalidArgumentException When $key is not valid. - */ - public static function validateKey($key) - { - if (!is_string($key)) { - throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', is_object($key) ? get_class($key) : gettype($key))); - } - if (!isset($key[0])) { - throw new InvalidArgumentException('Cache key length must be greater than zero'); - } - if (isset($key[strcspn($key, '{}()/\@:')])) { - throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key)); - } - } - - /** - * Internal logging helper. - * - * @internal - */ - public static function log(LoggerInterface $logger = null, $message, $context = array()) - { - if ($logger) { - $logger->warning($message, $context); - } else { - $replace = array(); - foreach ($context as $k => $v) { - if (is_scalar($v)) { - $replace['{'.$k.'}'] = $v; - } - } - @trigger_error(strtr($message, $replace), E_USER_WARNING); - } - } -} diff --git a/lib/vendor/symfony/cache/DoctrineProvider.php b/lib/vendor/symfony/cache/DoctrineProvider.php deleted file mode 100644 index 5d9c2fa..0000000 --- a/lib/vendor/symfony/cache/DoctrineProvider.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache; - -use Doctrine\Common\Cache\CacheProvider; -use Psr\Cache\CacheItemPoolInterface; - -/** - * @author Nicolas Grekas - */ -class DoctrineProvider extends CacheProvider -{ - private $pool; - - public function __construct(CacheItemPoolInterface $pool) - { - $this->pool = $pool; - } - - /** - * {@inheritdoc} - */ - protected function doFetch($id) - { - $item = $this->pool->getItem(rawurlencode($id)); - - return $item->isHit() ? $item->get() : false; - } - - /** - * {@inheritdoc} - */ - protected function doContains($id) - { - return $this->pool->hasItem(rawurlencode($id)); - } - - /** - * {@inheritdoc} - */ - protected function doSave($id, $data, $lifeTime = 0) - { - $item = $this->pool->getItem(rawurlencode($id)); - - if (0 < $lifeTime) { - $item->expiresAfter($lifeTime); - } - - return $this->pool->save($item->set($data)); - } - - /** - * {@inheritdoc} - */ - protected function doDelete($id) - { - return $this->pool->deleteItem(rawurlencode($id)); - } - - /** - * {@inheritdoc} - */ - protected function doFlush() - { - $this->pool->clear(); - } - - /** - * {@inheritdoc} - */ - protected function doGetStats() - { - } -} diff --git a/lib/vendor/symfony/cache/Exception/CacheException.php b/lib/vendor/symfony/cache/Exception/CacheException.php deleted file mode 100644 index d62b3e1..0000000 --- a/lib/vendor/symfony/cache/Exception/CacheException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Exception; - -use Psr\Cache\CacheException as CacheExceptionInterface; - -class CacheException extends \Exception implements CacheExceptionInterface -{ -} diff --git a/lib/vendor/symfony/cache/Exception/InvalidArgumentException.php b/lib/vendor/symfony/cache/Exception/InvalidArgumentException.php deleted file mode 100644 index 334a3c3..0000000 --- a/lib/vendor/symfony/cache/Exception/InvalidArgumentException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Exception; - -use Psr\Cache\InvalidArgumentException as InvalidArgumentExceptionInterface; - -class InvalidArgumentException extends \InvalidArgumentException implements InvalidArgumentExceptionInterface -{ -} diff --git a/lib/vendor/symfony/cache/LICENSE b/lib/vendor/symfony/cache/LICENSE deleted file mode 100644 index 0564c5a..0000000 --- a/lib/vendor/symfony/cache/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/vendor/symfony/cache/README.md b/lib/vendor/symfony/cache/README.md deleted file mode 100644 index 604fb1d..0000000 --- a/lib/vendor/symfony/cache/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Symfony PSR-6 implementation for caching -======================================== - -This component provides an extended [PSR-6](http://www.php-fig.org/psr/psr-6/) -implementation for adding cache to your applications. It is designed to have a -low overhead so that caching is fastest. It ships with a few caching adapters -for the most widespread and suited to caching backends. It also provides a -`doctrine/cache` proxy adapter to cover more advanced caching needs and a proxy -adapter for greater interoperability between PSR-6 implementations. diff --git a/lib/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php deleted file mode 100644 index 86b16d4..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\RedisAdapter; - -abstract class AbstractRedisAdapterTest extends AdapterTestCase -{ - protected $skippedTests = array( - 'testExpiration' => 'Testing expiration slows down the test suite', - 'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite', - 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', - ); - - protected static $redis; - - public function createCachePool($defaultLifetime = 0) - { - return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); - } - - public static function setupBeforeClass() - { - if (!extension_loaded('redis')) { - self::markTestSkipped('Extension redis required.'); - } - if (!@((new \Redis())->connect(getenv('REDIS_HOST')))) { - $e = error_get_last(); - self::markTestSkipped($e['message']); - } - } - - public static function tearDownAfterClass() - { - self::$redis->flushDB(); - self::$redis = null; - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php b/lib/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php deleted file mode 100644 index c3cbd3b..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Cache\IntegrationTests\CachePoolTest; - -abstract class AdapterTestCase extends CachePoolTest -{ - protected function setUp() - { - parent::setUp(); - - if (!array_key_exists('testDeferredSaveWithoutCommit', $this->skippedTests) && defined('HHVM_VERSION')) { - $this->skippedTests['testDeferredSaveWithoutCommit'] = 'Destructors are called late on HHVM.'; - } - } - - public function testDefaultLifeTime() - { - if (isset($this->skippedTests[__FUNCTION__])) { - $this->markTestSkipped($this->skippedTests[__FUNCTION__]); - } - - $cache = $this->createCachePool(2); - - $item = $cache->getItem('key.dlt'); - $item->set('value'); - $cache->save($item); - sleep(1); - - $item = $cache->getItem('key.dlt'); - $this->assertTrue($item->isHit()); - - sleep(2); - $item = $cache->getItem('key.dlt'); - $this->assertFalse($item->isHit()); - } - - public function testNotUnserializable() - { - if (isset($this->skippedTests[__FUNCTION__])) { - $this->markTestSkipped($this->skippedTests[__FUNCTION__]); - } - - $cache = $this->createCachePool(); - - $item = $cache->getItem('foo'); - $cache->save($item->set(new NotUnserializable())); - - $item = $cache->getItem('foo'); - $this->assertFalse($item->isHit()); - - foreach ($cache->getItems(array('foo')) as $item) { - } - $cache->save($item->set(new NotUnserializable())); - - foreach ($cache->getItems(array('foo')) as $item) { - } - $this->assertFalse($item->isHit()); - } -} - -class NotUnserializable implements \Serializable -{ - public function serialize() - { - return serialize(123); - } - - public function unserialize($ser) - { - throw new \Exception(__CLASS__); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php deleted file mode 100644 index 50206bb..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\ApcuAdapter; - -class ApcuAdapterTest extends AdapterTestCase -{ - protected $skippedTests = array( - 'testExpiration' => 'Testing expiration slows down the test suite', - 'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite', - 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', - ); - - public function createCachePool($defaultLifetime = 0) - { - if (!function_exists('apcu_fetch') || !ini_get('apc.enabled') || ('cli' === PHP_SAPI && !ini_get('apc.enable_cli'))) { - $this->markTestSkipped('APCu extension is required.'); - } - if ('\\' === DIRECTORY_SEPARATOR) { - $this->markTestSkipped('Fails transiently on Windows.'); - } - - return new ApcuAdapter(str_replace('\\', '.', __CLASS__), $defaultLifetime); - } - - public function testUnserializable() - { - $pool = $this->createCachePool(); - - $item = $pool->getItem('foo'); - $item->set(function () {}); - - $this->assertFalse($pool->save($item)); - - $item = $pool->getItem('foo'); - $this->assertFalse($item->isHit()); - } - - public function testVersion() - { - $namespace = str_replace('\\', '.', __CLASS__); - - $pool1 = new ApcuAdapter($namespace, 0, 'p1'); - - $item = $pool1->getItem('foo'); - $this->assertFalse($item->isHit()); - $this->assertTrue($pool1->save($item->set('bar'))); - - $item = $pool1->getItem('foo'); - $this->assertTrue($item->isHit()); - $this->assertSame('bar', $item->get()); - - $pool2 = new ApcuAdapter($namespace, 0, 'p2'); - - $item = $pool2->getItem('foo'); - $this->assertFalse($item->isHit()); - $this->assertNull($item->get()); - - $item = $pool1->getItem('foo'); - $this->assertFalse($item->isHit()); - $this->assertNull($item->get()); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php deleted file mode 100644 index 725d790..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\ArrayAdapter; - -/** - * @group time-sensitive - */ -class ArrayAdapterTest extends AdapterTestCase -{ - protected $skippedTests = array( - 'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.', - 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.', - ); - - public function createCachePool($defaultLifetime = 0) - { - return new ArrayAdapter($defaultLifetime); - } - - public function testGetValuesHitAndMiss() - { - /** @var ArrayAdapter $cache */ - $cache = $this->createCachePool(); - - // Hit - $item = $cache->getItem('foo'); - $item->set('4711'); - $cache->save($item); - - $fooItem = $cache->getItem('foo'); - $this->assertTrue($fooItem->isHit()); - $this->assertEquals('4711', $fooItem->get()); - - // Miss (should be present as NULL in $values) - $cache->getItem('bar'); - - $values = $cache->getValues(); - - $this->assertCount(2, $values); - $this->assertArrayHasKey('foo', $values); - $this->assertSame(serialize('4711'), $values['foo']); - $this->assertArrayHasKey('bar', $values); - $this->assertNull($values['bar']); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php deleted file mode 100644 index b80913c..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\FilesystemAdapter; -use Symfony\Component\Cache\Adapter\ArrayAdapter; -use Symfony\Component\Cache\Adapter\ChainAdapter; -use Symfony\Component\Cache\Tests\Fixtures\ExternalAdapter; - -/** - * @author Kévin Dunglas - * @group time-sensitive - */ -class ChainAdapterTest extends AdapterTestCase -{ - public function createCachePool($defaultLifetime = 0) - { - return new ChainAdapter(array(new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)), $defaultLifetime); - } - - /** - * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException - * @expectedExceptionMessage At least one adapter must be specified. - */ - public function testEmptyAdaptersException() - { - new ChainAdapter(array()); - } - - /** - * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException - * @expectedExceptionMessage The class "stdClass" does not implement - */ - public function testInvalidAdapterException() - { - new ChainAdapter(array(new \stdClass())); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php deleted file mode 100644 index 93ec982..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Doctrine\Common\Cache\ArrayCache; -use Symfony\Component\Cache\Adapter\DoctrineAdapter; - -/** - * @group time-sensitive - */ -class DoctrineAdapterTest extends AdapterTestCase -{ - protected $skippedTests = array( - 'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayCache is not.', - 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayCache is not.', - 'testNotUnserializable' => 'ArrayCache does not use serialize/unserialize', - ); - - public function createCachePool($defaultLifetime = 0) - { - return new DoctrineAdapter(new ArrayCache($defaultLifetime), '', $defaultLifetime); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/FilesystemAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/FilesystemAdapterTest.php deleted file mode 100644 index 6835786..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/FilesystemAdapterTest.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\FilesystemAdapter; - -/** - * @group time-sensitive - */ -class FilesystemAdapterTest extends AdapterTestCase -{ - public function createCachePool($defaultLifetime = 0) - { - return new FilesystemAdapter('', $defaultLifetime); - } - - public static function tearDownAfterClass() - { - self::rmdir(sys_get_temp_dir().'/symfony-cache'); - } - - public static function rmdir($dir) - { - if (!file_exists($dir)) { - return; - } - if (!$dir || 0 !== strpos(dirname($dir), sys_get_temp_dir())) { - throw new \Exception(__METHOD__."() operates only on subdirs of system's temp dir"); - } - $children = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS), - \RecursiveIteratorIterator::CHILD_FIRST - ); - foreach ($children as $child) { - if ($child->isDir()) { - rmdir($child); - } else { - unlink($child); - } - } - rmdir($dir); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php deleted file mode 100644 index 2414f22..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\AbstractAdapter; - -class MaxIdLengthAdapterTest extends \PHPUnit_Framework_TestCase -{ - public function testLongKey() - { - $cache = $this->getMockBuilder(MaxIdLengthAdapter::class) - ->setConstructorArgs(array(str_repeat('-', 10))) - ->setMethods(array('doHave', 'doFetch', 'doDelete', 'doSave', 'doClear')) - ->getMock(); - - $cache->expects($this->exactly(2)) - ->method('doHave') - ->withConsecutive( - array($this->equalTo('----------:0GTYWa9n4ed8vqNlOT2iEr:')), - array($this->equalTo('----------:---------------------------------------')) - ); - - $cache->hasItem(str_repeat('-', 40)); - $cache->hasItem(str_repeat('-', 39)); - } - - /** - * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException - * @expectedExceptionMessage Namespace must be 26 chars max, 40 given ("----------------------------------------") - */ - public function testTooLongNamespace() - { - $cache = $this->getMockBuilder(MaxIdLengthAdapter::class) - ->setConstructorArgs(array(str_repeat('-', 40))) - ->getMock(); - } -} - -abstract class MaxIdLengthAdapter extends AbstractAdapter -{ - protected $maxIdLength = 50; - - public function __construct($ns) - { - parent::__construct($ns); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/NamespacedProxyAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/NamespacedProxyAdapterTest.php deleted file mode 100644 index c271403..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/NamespacedProxyAdapterTest.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\ArrayAdapter; -use Symfony\Component\Cache\Adapter\ProxyAdapter; - -/** - * @group time-sensitive - */ -class NamespacedProxyAdapterTest extends ProxyAdapterTest -{ - public function createCachePool($defaultLifetime = 0) - { - return new ProxyAdapter(new ArrayAdapter($defaultLifetime), 'foo', $defaultLifetime); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php deleted file mode 100644 index 8ce50e4..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Psr\Cache\CacheItemInterface; -use Symfony\Component\Cache\Adapter\NullAdapter; - -/** - * @group time-sensitive - */ -class NullAdapterTest extends \PHPUnit_Framework_TestCase -{ - public function createCachePool() - { - return new NullAdapter(); - } - - public function testGetItem() - { - $adapter = $this->createCachePool(); - - $item = $adapter->getItem('key'); - $this->assertFalse($item->isHit()); - $this->assertNull($item->get(), "Item's value must be null when isHit is false."); - } - - public function testHasItem() - { - $this->assertFalse($this->createCachePool()->hasItem('key')); - } - - public function testGetItems() - { - $adapter = $this->createCachePool(); - - $keys = array('foo', 'bar', 'baz', 'biz'); - - /** @var CacheItemInterface[] $items */ - $items = $adapter->getItems($keys); - $count = 0; - - foreach ($items as $key => $item) { - $itemKey = $item->getKey(); - - $this->assertEquals($itemKey, $key, 'Keys must be preserved when fetching multiple items'); - $this->assertTrue(in_array($key, $keys), 'Cache key can not change.'); - $this->assertFalse($item->isHit()); - - // Remove $key for $keys - foreach ($keys as $k => $v) { - if ($v === $key) { - unset($keys[$k]); - } - } - - ++$count; - } - - $this->assertSame(4, $count); - } - - public function testIsHit() - { - $adapter = $this->createCachePool(); - - $item = $adapter->getItem('key'); - $this->assertFalse($item->isHit()); - } - - public function testClear() - { - $this->assertTrue($this->createCachePool()->clear()); - } - - public function testDeleteItem() - { - $this->assertTrue($this->createCachePool()->deleteItem('key')); - } - - public function testDeleteItems() - { - $this->assertTrue($this->createCachePool()->deleteItems(array('key', 'foo', 'bar'))); - } - - public function testSave() - { - $adapter = $this->createCachePool(); - - $item = $adapter->getItem('key'); - $this->assertFalse($item->isHit()); - $this->assertNull($item->get(), "Item's value must be null when isHit is false."); - - $this->assertFalse($adapter->save($item)); - } - - public function testDeferredSave() - { - $adapter = $this->createCachePool(); - - $item = $adapter->getItem('key'); - $this->assertFalse($item->isHit()); - $this->assertNull($item->get(), "Item's value must be null when isHit is false."); - - $this->assertFalse($adapter->saveDeferred($item)); - } - - public function testCommit() - { - $adapter = $this->createCachePool(); - - $item = $adapter->getItem('key'); - $this->assertFalse($item->isHit()); - $this->assertNull($item->get(), "Item's value must be null when isHit is false."); - - $this->assertFalse($adapter->saveDeferred($item)); - $this->assertFalse($this->createCachePool()->commit()); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/PdoAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/PdoAdapterTest.php deleted file mode 100644 index 35d8980..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/PdoAdapterTest.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\PdoAdapter; - -/** - * @group time-sensitive - */ -class PdoAdapterTest extends AdapterTestCase -{ - protected static $dbFile; - - public static function setupBeforeClass() - { - if (!extension_loaded('pdo_sqlite')) { - throw new \PHPUnit_Framework_SkippedTestError('Extension pdo_sqlite required.'); - } - - self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); - - $pool = new PdoAdapter('sqlite:'.self::$dbFile); - $pool->createTable(); - } - - public static function tearDownAfterClass() - { - @unlink(self::$dbFile); - } - - public function createCachePool($defaultLifetime = 0) - { - return new PdoAdapter('sqlite:'.self::$dbFile, 'ns', $defaultLifetime); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php deleted file mode 100644 index fd1c179..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Doctrine\DBAL\DriverManager; -use Symfony\Component\Cache\Adapter\PdoAdapter; - -/** - * @group time-sensitive - */ -class PdoDbalAdapterTest extends AdapterTestCase -{ - protected static $dbFile; - - public static function setupBeforeClass() - { - if (!extension_loaded('pdo_sqlite')) { - throw new \PHPUnit_Framework_SkippedTestError('Extension pdo_sqlite required.'); - } - - self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); - - $pool = new PdoAdapter(DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'path' => self::$dbFile))); - $pool->createTable(); - } - - public static function tearDownAfterClass() - { - @unlink(self::$dbFile); - } - - public function createCachePool($defaultLifetime = 0) - { - return new PdoAdapter(DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'path' => self::$dbFile)), '', $defaultLifetime); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php deleted file mode 100644 index ff3351d..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Psr\Cache\CacheItemInterface; -use Symfony\Component\Cache\Adapter\NullAdapter; -use Symfony\Component\Cache\Adapter\PhpArrayAdapter; - -/** - * @group time-sensitive - */ -class PhpArrayAdapterTest extends AdapterTestCase -{ - protected $skippedTests = array( - 'testBasicUsage' => 'PhpArrayAdapter is read-only.', - 'testClear' => 'PhpArrayAdapter is read-only.', - 'testClearWithDeferredItems' => 'PhpArrayAdapter is read-only.', - 'testDeleteItem' => 'PhpArrayAdapter is read-only.', - 'testSaveExpired' => 'PhpArrayAdapter is read-only.', - 'testSaveWithoutExpire' => 'PhpArrayAdapter is read-only.', - 'testDeferredSave' => 'PhpArrayAdapter is read-only.', - 'testDeferredSaveWithoutCommit' => 'PhpArrayAdapter is read-only.', - 'testDeleteItems' => 'PhpArrayAdapter is read-only.', - 'testDeleteDeferredItem' => 'PhpArrayAdapter is read-only.', - 'testCommit' => 'PhpArrayAdapter is read-only.', - 'testSaveDeferredWhenChangingValues' => 'PhpArrayAdapter is read-only.', - 'testSaveDeferredOverwrite' => 'PhpArrayAdapter is read-only.', - 'testIsHitDeferred' => 'PhpArrayAdapter is read-only.', - - 'testExpiresAt' => 'PhpArrayAdapter does not support expiration.', - 'testExpiresAtWithNull' => 'PhpArrayAdapter does not support expiration.', - 'testExpiresAfterWithNull' => 'PhpArrayAdapter does not support expiration.', - 'testDeferredExpired' => 'PhpArrayAdapter does not support expiration.', - 'testExpiration' => 'PhpArrayAdapter does not support expiration.', - - 'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testGetItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testDeleteItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - - 'testDefaultLifeTime' => 'PhpArrayAdapter does not allow configuring a default lifetime.', - ); - - private static $file; - - public static function setupBeforeClass() - { - self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php'; - } - - protected function tearDown() - { - if (file_exists(sys_get_temp_dir().'/symfony-cache')) { - FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache'); - } - } - - public function createCachePool() - { - return new PhpArrayAdapterWrapper(self::$file, new NullAdapter()); - } - - public function testStore() - { - $arrayWithRefs = array(); - $arrayWithRefs[0] = 123; - $arrayWithRefs[1] = &$arrayWithRefs[0]; - - $object = (object) array( - 'foo' => 'bar', - 'foo2' => 'bar2', - ); - - $expected = array( - 'null' => null, - 'serializedString' => serialize($object), - 'arrayWithRefs' => $arrayWithRefs, - 'object' => $object, - 'arrayWithObject' => array('bar' => $object), - ); - - $adapter = $this->createCachePool(); - $adapter->warmUp($expected); - - foreach ($expected as $key => $value) { - $this->assertSame(serialize($value), serialize($adapter->getItem($key)->get()), 'Warm up should create a PHP file that OPCache can load in memory'); - } - } - - public function testStoredFile() - { - $expected = array( - 'integer' => 42, - 'float' => 42.42, - 'boolean' => true, - 'array_simple' => array('foo', 'bar'), - 'array_associative' => array('foo' => 'bar', 'foo2' => 'bar2'), - ); - - $adapter = $this->createCachePool(); - $adapter->warmUp($expected); - - $values = eval(substr(file_get_contents(self::$file), 6)); - - $this->assertSame($expected, $values, 'Warm up should create a PHP file that OPCache can load in memory'); - } -} - -class PhpArrayAdapterWrapper extends PhpArrayAdapter -{ - public function save(CacheItemInterface $item) - { - call_user_func(\Closure::bind(function () use ($item) { - $this->values[$item->getKey()] = $item->get(); - $this->warmUp($this->values); - $this->values = eval(substr(file_get_contents($this->file), 6)); - }, $this, PhpArrayAdapter::class)); - - return true; - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php b/lib/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php deleted file mode 100644 index 7030c0e..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\FilesystemAdapter; -use Symfony\Component\Cache\Adapter\PhpArrayAdapter; - -/** - * @group time-sensitive - */ -class PhpArrayAdapterWithFallbackTest extends AdapterTestCase -{ - protected $skippedTests = array( - 'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testGetItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testDeleteItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', - 'testDefaultLifeTime' => 'PhpArrayAdapter does not allow configuring a default lifetime.', - ); - - private static $file; - - public static function setupBeforeClass() - { - self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php'; - } - - protected function tearDown() - { - if (file_exists(sys_get_temp_dir().'/symfony-cache')) { - FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache'); - } - } - - public function createCachePool() - { - return new PhpArrayAdapter(self::$file, new FilesystemAdapter('php-array-fallback')); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php deleted file mode 100644 index 05e312c..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\PhpFilesAdapter; - -/** - * @group time-sensitive - */ -class PhpFilesAdapterTest extends AdapterTestCase -{ - protected $skippedTests = array( - 'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.', - ); - - public function createCachePool() - { - if (!PhpFilesAdapter::isSupported()) { - $this->markTestSkipped('OPcache extension is not enabled.'); - } - - return new PhpFilesAdapter('sf-cache'); - } - - public static function tearDownAfterClass() - { - FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache'); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php deleted file mode 100644 index 85ca36c..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Predis\Connection\StreamConnection; -use Symfony\Component\Cache\Adapter\RedisAdapter; - -class PredisAdapterTest extends AbstractRedisAdapterTest -{ - public static function setupBeforeClass() - { - parent::setupBeforeClass(); - self::$redis = new \Predis\Client(array('host' => getenv('REDIS_HOST'))); - } - - public function testCreateConnection() - { - $redisHost = getenv('REDIS_HOST'); - - $redis = RedisAdapter::createConnection('redis://'.$redisHost.'/1', array('class' => \Predis\Client::class, 'timeout' => 3)); - $this->assertInstanceOf(\Predis\Client::class, $redis); - - $connection = $redis->getConnection(); - $this->assertInstanceOf(StreamConnection::class, $connection); - - $params = array( - 'scheme' => 'tcp', - 'host' => $redisHost, - 'path' => '', - 'dbindex' => '1', - 'port' => 6379, - 'class' => 'Predis\Client', - 'timeout' => 3, - 'persistent' => 0, - 'persistent_id' => null, - 'read_timeout' => 0, - 'retry_interval' => 0, - 'database' => '1', - 'password' => null, - ); - $this->assertSame($params, $connection->getParameters()->toArray()); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php deleted file mode 100644 index c0174dd..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Psr\Cache\CacheItemInterface; -use Symfony\Component\Cache\Adapter\ArrayAdapter; -use Symfony\Component\Cache\Adapter\ProxyAdapter; -use Symfony\Component\Cache\CacheItem; - -/** - * @group time-sensitive - */ -class ProxyAdapterTest extends AdapterTestCase -{ - protected $skippedTests = array( - 'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.', - 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.', - ); - - public function createCachePool($defaultLifetime = 0) - { - return new ProxyAdapter(new ArrayAdapter(), '', $defaultLifetime); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage OK bar - */ - public function testProxyfiedItem() - { - $item = new CacheItem(); - $pool = new ProxyAdapter(new TestingArrayAdapter($item)); - - $proxyItem = $pool->getItem('foo'); - - $this->assertFalse($proxyItem === $item); - $pool->save($proxyItem->set('bar')); - } -} - -class TestingArrayAdapter extends ArrayAdapter -{ - private $item; - - public function __construct(CacheItemInterface $item) - { - $this->item = $item; - } - - public function getItem($key) - { - return $this->item; - } - - public function save(CacheItemInterface $item) - { - if ($item === $this->item) { - throw new \Exception('OK '.$item->get()); - } - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php deleted file mode 100644 index 301d531..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\RedisAdapter; - -class RedisAdapterTest extends AbstractRedisAdapterTest -{ - public static function setupBeforeClass() - { - parent::setupBeforeClass(); - self::$redis = new \Redis(); - self::$redis->connect(getenv('REDIS_HOST')); - } - - public function testCreateConnection() - { - $redisHost = getenv('REDIS_HOST'); - - $redis = RedisAdapter::createConnection('redis://'.$redisHost); - $this->assertInstanceOf(\Redis::class, $redis); - $this->assertTrue($redis->isConnected()); - $this->assertSame(0, $redis->getDbNum()); - - $redis = RedisAdapter::createConnection('redis://'.$redisHost.'/2'); - $this->assertSame(2, $redis->getDbNum()); - - $redis = RedisAdapter::createConnection('redis://'.$redisHost, array('timeout' => 3)); - $this->assertEquals(3, $redis->getTimeout()); - - $redis = RedisAdapter::createConnection('redis://'.$redisHost.'?timeout=4'); - $this->assertEquals(4, $redis->getTimeout()); - - $redis = RedisAdapter::createConnection('redis://'.$redisHost, array('read_timeout' => 5)); - $this->assertEquals(5, $redis->getReadTimeout()); - } - - /** - * @dataProvider provideFailedCreateConnection - * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException - * @expectedExceptionMessage Redis connection failed - */ - public function testFailedCreateConnection($dsn) - { - RedisAdapter::createConnection($dsn); - } - - public function provideFailedCreateConnection() - { - return array( - array('redis://localhost:1234'), - array('redis://foo@localhost'), - array('redis://localhost/123'), - ); - } - - /** - * @dataProvider provideInvalidCreateConnection - * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException - * @expectedExceptionMessage Invalid Redis DSN - */ - public function testInvalidCreateConnection($dsn) - { - RedisAdapter::createConnection($dsn); - } - - public function provideInvalidCreateConnection() - { - return array( - array('foo://localhost'), - array('redis://'), - ); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php deleted file mode 100644 index bef3eb8..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -class RedisArrayAdapterTest extends AbstractRedisAdapterTest -{ - public static function setupBeforeClass() - { - parent::setupBeforeClass(); - if (!class_exists('RedisArray')) { - self::markTestSkipped('The RedisArray class is required.'); - } - self::$redis = new \RedisArray(array(getenv('REDIS_HOST')), array('lazy_connect' => true)); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php b/lib/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php deleted file mode 100644 index 20b1fd7..0000000 --- a/lib/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Adapter; - -use Symfony\Component\Cache\Adapter\FilesystemAdapter; -use Symfony\Component\Cache\Adapter\TagAwareAdapter; - -/** - * @group time-sensitive - */ -class TagAwareAdapterTest extends AdapterTestCase -{ - public function createCachePool($defaultLifetime = 0) - { - return new TagAwareAdapter(new FilesystemAdapter('', $defaultLifetime)); - } - - public static function tearDownAfterClass() - { - FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache'); - } - - /** - * @expectedException \Psr\Cache\InvalidArgumentException - */ - public function testInvalidTag() - { - $pool = $this->createCachePool(); - $item = $pool->getItem('foo'); - $item->tag(':'); - } - - public function testInvalidateTags() - { - $pool = $this->createCachePool(); - - $i0 = $pool->getItem('i0'); - $i1 = $pool->getItem('i1'); - $i2 = $pool->getItem('i2'); - $i3 = $pool->getItem('i3'); - $foo = $pool->getItem('foo'); - - $pool->save($i0->tag('bar')); - $pool->save($i1->tag('foo')); - $pool->save($i2->tag('foo')->tag('bar')); - $pool->save($i3->tag('foo')->tag('baz')); - $pool->save($foo); - - $pool->invalidateTags(array('bar')); - - $this->assertFalse($pool->getItem('i0')->isHit()); - $this->assertTrue($pool->getItem('i1')->isHit()); - $this->assertFalse($pool->getItem('i2')->isHit()); - $this->assertTrue($pool->getItem('i3')->isHit()); - $this->assertTrue($pool->getItem('foo')->isHit()); - - $pool->invalidateTags(array('foo')); - - $this->assertFalse($pool->getItem('i1')->isHit()); - $this->assertFalse($pool->getItem('i3')->isHit()); - $this->assertTrue($pool->getItem('foo')->isHit()); - } - - public function testTagsAreCleanedOnSave() - { - $pool = $this->createCachePool(); - - $i = $pool->getItem('k'); - $pool->save($i->tag('foo')); - - $i = $pool->getItem('k'); - $pool->save($i->tag('bar')); - - $pool->invalidateTags(array('foo')); - $this->assertTrue($pool->getItem('k')->isHit()); - } - - public function testTagsAreCleanedOnDelete() - { - $pool = $this->createCachePool(); - - $i = $pool->getItem('k'); - $pool->save($i->tag('foo')); - $pool->deleteItem('k'); - - $pool->save($pool->getItem('k')); - $pool->invalidateTags(array('foo')); - - $this->assertTrue($pool->getItem('k')->isHit()); - } -} diff --git a/lib/vendor/symfony/cache/Tests/CacheItemTest.php b/lib/vendor/symfony/cache/Tests/CacheItemTest.php deleted file mode 100644 index 8848845..0000000 --- a/lib/vendor/symfony/cache/Tests/CacheItemTest.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests; - -use Symfony\Component\Cache\CacheItem; - -class CacheItemTest extends \PHPUnit_Framework_TestCase -{ - public function testValidKey() - { - $this->assertNull(CacheItem::validateKey('foo')); - } - - /** - * @dataProvider provideInvalidKey - * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException - * @expectedExceptionMessage Cache key - */ - public function testInvalidKey($key) - { - CacheItem::validateKey($key); - } - - public function provideInvalidKey() - { - return array( - array(''), - array('{'), - array('}'), - array('('), - array(')'), - array('/'), - array('\\'), - array('@'), - array(':'), - array(true), - array(null), - array(1), - array(1.1), - array(array(array())), - array(new \Exception('foo')), - ); - } - - public function testTag() - { - $item = new CacheItem(); - - $this->assertSame($item, $item->tag('foo')); - $this->assertSame($item, $item->tag(array('bar', 'baz'))); - - call_user_func(\Closure::bind(function () use ($item) { - $this->assertSame(array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'), $item->tags); - }, $this, CacheItem::class)); - } - - /** - * @dataProvider provideInvalidKey - * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException - * @expectedExceptionMessage Cache tag - */ - public function testInvalidTag($tag) - { - $item = new CacheItem(); - $item->tag($tag); - } -} diff --git a/lib/vendor/symfony/cache/Tests/DoctrineProviderTest.php b/lib/vendor/symfony/cache/Tests/DoctrineProviderTest.php deleted file mode 100644 index ccc5263..0000000 --- a/lib/vendor/symfony/cache/Tests/DoctrineProviderTest.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests; - -use Doctrine\Common\Cache\CacheProvider; -use Symfony\Component\Cache\Adapter\ArrayAdapter; -use Symfony\Component\Cache\DoctrineProvider; - -class DoctrineProviderTest extends \PHPUnit_Framework_TestCase -{ - public function testProvider() - { - $pool = new ArrayAdapter(); - $cache = new DoctrineProvider($pool); - - $this->assertInstanceOf(CacheProvider::class, $cache); - - $key = '{}()/\@:'; - - $this->assertTrue($cache->delete($key)); - $this->assertFalse($cache->contains($key)); - - $this->assertTrue($cache->save($key, 'bar')); - $this->assertTrue($cache->contains($key)); - $this->assertSame('bar', $cache->fetch($key)); - - $this->assertTrue($cache->delete($key)); - $this->assertFalse($cache->fetch($key)); - $this->assertTrue($cache->save($key, 'bar')); - - $cache->flushAll(); - $this->assertFalse($cache->fetch($key)); - $this->assertFalse($cache->contains($key)); - } -} diff --git a/lib/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php b/lib/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php deleted file mode 100644 index 493906e..0000000 --- a/lib/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Cache\Tests\Fixtures; - -use Psr\Cache\CacheItemInterface; -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\Adapter\ArrayAdapter; - -/** - * Adapter not implementing the {@see \Symfony\Component\Cache\Adapter\AdapterInterface}. - * - * @author Kévin Dunglas - */ -class ExternalAdapter implements CacheItemPoolInterface -{ - private $cache; - - public function __construct() - { - $this->cache = new ArrayAdapter(); - } - - public function getItem($key) - { - return $this->cache->getItem($key); - } - - public function getItems(array $keys = array()) - { - return $this->cache->getItems($keys); - } - - public function hasItem($key) - { - return $this->cache->hasItem($key); - } - - public function clear() - { - return $this->cache->clear(); - } - - public function deleteItem($key) - { - return $this->cache->deleteItem($key); - } - - public function deleteItems(array $keys) - { - return $this->cache->deleteItems($keys); - } - - public function save(CacheItemInterface $item) - { - return $this->cache->save($item); - } - - public function saveDeferred(CacheItemInterface $item) - { - return $this->cache->saveDeferred($item); - } - - public function commit() - { - return $this->cache->commit(); - } -} diff --git a/lib/vendor/symfony/cache/composer.json b/lib/vendor/symfony/cache/composer.json deleted file mode 100644 index 3746cea..0000000 --- a/lib/vendor/symfony/cache/composer.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "symfony/cache", - "type": "library", - "description": "Symfony implementation of PSR-6", - "keywords": ["caching", "psr6"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "provide": { - "psr/cache-implementation": "1.0" - }, - "require": { - "php": ">=5.5.9", - "psr/cache": "~1.0", - "psr/log": "~1.0" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/cache": "~1.6", - "doctrine/dbal": "~2.4", - "predis/predis": "~1.0" - }, - "suggest": { - "symfony/polyfill-apcu": "For using ApcuAdapter on HHVM" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Cache\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - } -} diff --git a/lib/vendor/symfony/cache/phpunit.xml.dist b/lib/vendor/symfony/cache/phpunit.xml.dist deleted file mode 100644 index 3e164e6..0000000 --- a/lib/vendor/symfony/cache/phpunit.xml.dist +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - ./vendor - - - - - - - - - Cache\IntegrationTests - Doctrine\Common\Cache - - - - - diff --git a/lib/vendor/symfony/expression-language/.gitignore b/lib/vendor/symfony/expression-language/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/lib/vendor/symfony/expression-language/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/lib/vendor/symfony/expression-language/CHANGELOG.md b/lib/vendor/symfony/expression-language/CHANGELOG.md deleted file mode 100644 index d00d17c..0000000 --- a/lib/vendor/symfony/expression-language/CHANGELOG.md +++ /dev/null @@ -1,12 +0,0 @@ -CHANGELOG -========= - -2.6.0 ------ - - * Added ExpressionFunction and ExpressionFunctionProviderInterface - -2.4.0 ------ - - * added the component diff --git a/lib/vendor/symfony/expression-language/Compiler.php b/lib/vendor/symfony/expression-language/Compiler.php deleted file mode 100644 index d9f2969..0000000 --- a/lib/vendor/symfony/expression-language/Compiler.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * Compiles a node to PHP code. - * - * @author Fabien Potencier - */ -class Compiler -{ - private $source; - private $functions; - - public function __construct(array $functions) - { - $this->functions = $functions; - } - - public function getFunction($name) - { - return $this->functions[$name]; - } - - /** - * Gets the current PHP code after compilation. - * - * @return string The PHP code - */ - public function getSource() - { - return $this->source; - } - - public function reset() - { - $this->source = ''; - - return $this; - } - - /** - * Compiles a node. - * - * @param Node\Node $node The node to compile - * - * @return Compiler The current compiler instance - */ - public function compile(Node\Node $node) - { - $node->compile($this); - - return $this; - } - - public function subcompile(Node\Node $node) - { - $current = $this->source; - $this->source = ''; - - $node->compile($this); - - $source = $this->source; - $this->source = $current; - - return $source; - } - - /** - * Adds a raw string to the compiled code. - * - * @param string $string The string - * - * @return Compiler The current compiler instance - */ - public function raw($string) - { - $this->source .= $string; - - return $this; - } - - /** - * Adds a quoted string to the compiled code. - * - * @param string $value The string - * - * @return Compiler The current compiler instance - */ - public function string($value) - { - $this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\")); - - return $this; - } - - /** - * Returns a PHP representation of a given value. - * - * @param mixed $value The value to convert - * - * @return Compiler The current compiler instance - */ - public function repr($value) - { - if (is_int($value) || is_float($value)) { - if (false !== $locale = setlocale(LC_NUMERIC, 0)) { - setlocale(LC_NUMERIC, 'C'); - } - - $this->raw($value); - - if (false !== $locale) { - setlocale(LC_NUMERIC, $locale); - } - } elseif (null === $value) { - $this->raw('null'); - } elseif (is_bool($value)) { - $this->raw($value ? 'true' : 'false'); - } elseif (is_array($value)) { - $this->raw('array('); - $first = true; - foreach ($value as $key => $value) { - if (!$first) { - $this->raw(', '); - } - $first = false; - $this->repr($key); - $this->raw(' => '); - $this->repr($value); - } - $this->raw(')'); - } else { - $this->string($value); - } - - return $this; - } -} diff --git a/lib/vendor/symfony/expression-language/Expression.php b/lib/vendor/symfony/expression-language/Expression.php deleted file mode 100644 index f5a3820..0000000 --- a/lib/vendor/symfony/expression-language/Expression.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * Represents an expression. - * - * @author Fabien Potencier - */ -class Expression -{ - protected $expression; - - /** - * Constructor. - * - * @param string $expression An expression - */ - public function __construct($expression) - { - $this->expression = (string) $expression; - } - - /** - * Gets the expression. - * - * @return string The expression - */ - public function __toString() - { - return $this->expression; - } -} diff --git a/lib/vendor/symfony/expression-language/ExpressionFunction.php b/lib/vendor/symfony/expression-language/ExpressionFunction.php deleted file mode 100644 index c42f29f..0000000 --- a/lib/vendor/symfony/expression-language/ExpressionFunction.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * Represents a function that can be used in an expression. - * - * A function is defined by two PHP callables. The callables are used - * by the language to compile and/or evaluate the function. - * - * The "compiler" function is used at compilation time and must return a - * PHP representation of the function call (it receives the function - * arguments as arguments). - * - * The "evaluator" function is used for expression evaluation and must return - * the value of the function call based on the values defined for the - * expression (it receives the values as a first argument and the function - * arguments as remaining arguments). - * - * @author Fabien Potencier - */ -class ExpressionFunction -{ - private $name; - private $compiler; - private $evaluator; - - /** - * Constructor. - * - * @param string $name The function name - * @param callable $compiler A callable able to compile the function - * @param callable $evaluator A callable able to evaluate the function - */ - public function __construct($name, callable $compiler, callable $evaluator) - { - $this->name = $name; - $this->compiler = $compiler; - $this->evaluator = $evaluator; - } - - public function getName() - { - return $this->name; - } - - public function getCompiler() - { - return $this->compiler; - } - - public function getEvaluator() - { - return $this->evaluator; - } -} diff --git a/lib/vendor/symfony/expression-language/ExpressionFunctionProviderInterface.php b/lib/vendor/symfony/expression-language/ExpressionFunctionProviderInterface.php deleted file mode 100644 index 414b013..0000000 --- a/lib/vendor/symfony/expression-language/ExpressionFunctionProviderInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * @author Fabien Potencier - */ -interface ExpressionFunctionProviderInterface -{ - /** - * @return ExpressionFunction[] An array of Function instances - */ - public function getFunctions(); -} diff --git a/lib/vendor/symfony/expression-language/ExpressionLanguage.php b/lib/vendor/symfony/expression-language/ExpressionLanguage.php deleted file mode 100644 index ec56890..0000000 --- a/lib/vendor/symfony/expression-language/ExpressionLanguage.php +++ /dev/null @@ -1,179 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\Adapter\ArrayAdapter; -use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter; -use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface; - -/** - * Allows to compile and evaluate expressions written in your own DSL. - * - * @author Fabien Potencier - */ -class ExpressionLanguage -{ - /** - * @var CacheItemPoolInterface - */ - private $cache; - private $lexer; - private $parser; - private $compiler; - - protected $functions = array(); - - /** - * @param CacheItemPoolInterface $cache - * @param ExpressionFunctionProviderInterface[] $providers - */ - public function __construct($cache = null, array $providers = array()) - { - if (null !== $cache) { - if ($cache instanceof ParserCacheInterface) { - @trigger_error(sprintf('Passing an instance of %s as constructor argument for %s is deprecated as of 3.2 and will be removed in 4.0. Pass an instance of %s instead.', ParserCacheInterface::class, self::class, CacheItemPoolInterface::class), E_USER_DEPRECATED); - $cache = new ParserCacheAdapter($cache); - } elseif (!$cache instanceof CacheItemPoolInterface) { - throw new \InvalidArgumentException(sprintf('Cache argument has to implement %s.', CacheItemPoolInterface::class)); - } - } - - $this->cache = $cache ?: new ArrayAdapter(); - $this->registerFunctions(); - foreach ($providers as $provider) { - $this->registerProvider($provider); - } - } - - /** - * Compiles an expression source code. - * - * @param Expression|string $expression The expression to compile - * @param array $names An array of valid names - * - * @return string The compiled PHP source code - */ - public function compile($expression, $names = array()) - { - return $this->getCompiler()->compile($this->parse($expression, $names)->getNodes())->getSource(); - } - - /** - * Evaluate an expression. - * - * @param Expression|string $expression The expression to compile - * @param array $values An array of values - * - * @return string The result of the evaluation of the expression - */ - public function evaluate($expression, $values = array()) - { - return $this->parse($expression, array_keys($values))->getNodes()->evaluate($this->functions, $values); - } - - /** - * Parses an expression. - * - * @param Expression|string $expression The expression to parse - * @param array $names An array of valid names - * - * @return ParsedExpression A ParsedExpression instance - */ - public function parse($expression, $names) - { - if ($expression instanceof ParsedExpression) { - return $expression; - } - - asort($names); - $cacheKeyItems = array(); - - foreach ($names as $nameKey => $name) { - $cacheKeyItems[] = is_int($nameKey) ? $name : $nameKey.':'.$name; - } - - $cacheItem = $this->cache->getItem(rawurlencode($expression.'//'.implode('|', $cacheKeyItems))); - - if (null === $parsedExpression = $cacheItem->get()) { - $nodes = $this->getParser()->parse($this->getLexer()->tokenize((string) $expression), $names); - $parsedExpression = new ParsedExpression((string) $expression, $nodes); - - $cacheItem->set($parsedExpression); - $this->cache->save($cacheItem); - } - - return $parsedExpression; - } - - /** - * Registers a function. - * - * @param string $name The function name - * @param callable $compiler A callable able to compile the function - * @param callable $evaluator A callable able to evaluate the function - * - * @see ExpressionFunction - */ - public function register($name, callable $compiler, callable $evaluator) - { - $this->functions[$name] = array('compiler' => $compiler, 'evaluator' => $evaluator); - } - - public function addFunction(ExpressionFunction $function) - { - $this->register($function->getName(), $function->getCompiler(), $function->getEvaluator()); - } - - public function registerProvider(ExpressionFunctionProviderInterface $provider) - { - foreach ($provider->getFunctions() as $function) { - $this->addFunction($function); - } - } - - protected function registerFunctions() - { - $this->register('constant', function ($constant) { - return sprintf('constant(%s)', $constant); - }, function (array $values, $constant) { - return constant($constant); - }); - } - - private function getLexer() - { - if (null === $this->lexer) { - $this->lexer = new Lexer(); - } - - return $this->lexer; - } - - private function getParser() - { - if (null === $this->parser) { - $this->parser = new Parser($this->functions); - } - - return $this->parser; - } - - private function getCompiler() - { - if (null === $this->compiler) { - $this->compiler = new Compiler($this->functions); - } - - return $this->compiler->reset(); - } -} diff --git a/lib/vendor/symfony/expression-language/LICENSE b/lib/vendor/symfony/expression-language/LICENSE deleted file mode 100644 index 12a7453..0000000 --- a/lib/vendor/symfony/expression-language/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2016 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/vendor/symfony/expression-language/Lexer.php b/lib/vendor/symfony/expression-language/Lexer.php deleted file mode 100644 index 26bb51d..0000000 --- a/lib/vendor/symfony/expression-language/Lexer.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * Lexes an expression. - * - * @author Fabien Potencier - */ -class Lexer -{ - /** - * Tokenizes an expression. - * - * @param string $expression The expression to tokenize - * - * @return TokenStream A token stream instance - * - * @throws SyntaxError - */ - public function tokenize($expression) - { - $expression = str_replace(array("\r", "\n", "\t", "\v", "\f"), ' ', $expression); - $cursor = 0; - $tokens = array(); - $brackets = array(); - $end = strlen($expression); - - while ($cursor < $end) { - if (' ' == $expression[$cursor]) { - ++$cursor; - - continue; - } - - if (preg_match('/[0-9]+(?:\.[0-9]+)?/A', $expression, $match, null, $cursor)) { - // numbers - $number = (float) $match[0]; // floats - if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { - $number = (int) $match[0]; // integers lower than the maximum - } - $tokens[] = new Token(Token::NUMBER_TYPE, $number, $cursor + 1); - $cursor += strlen($match[0]); - } elseif (false !== strpos('([{', $expression[$cursor])) { - // opening bracket - $brackets[] = array($expression[$cursor], $cursor); - - $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); - ++$cursor; - } elseif (false !== strpos(')]}', $expression[$cursor])) { - // closing bracket - if (empty($brackets)) { - throw new SyntaxError(sprintf('Unexpected "%s"', $expression[$cursor]), $cursor); - } - - list($expect, $cur) = array_pop($brackets); - if ($expression[$cursor] != strtr($expect, '([{', ')]}')) { - throw new SyntaxError(sprintf('Unclosed "%s"', $expect), $cur); - } - - $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); - ++$cursor; - } elseif (preg_match('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As', $expression, $match, null, $cursor)) { - // strings - $tokens[] = new Token(Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1)), $cursor + 1); - $cursor += strlen($match[0]); - } elseif (preg_match('/not in(?=[\s(])|\!\=\=|not(?=[\s(])|and(?=[\s(])|\=\=\=|\>\=|or(?=[\s(])|\<\=|\*\*|\.\.|in(?=[\s(])|&&|\|\||matches|\=\=|\!\=|\*|~|%|\/|\>|\||\!|\^|&|\+|\<|\-/A', $expression, $match, null, $cursor)) { - // operators - $tokens[] = new Token(Token::OPERATOR_TYPE, $match[0], $cursor + 1); - $cursor += strlen($match[0]); - } elseif (false !== strpos('.,?:', $expression[$cursor])) { - // punctuation - $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); - ++$cursor; - } elseif (preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $expression, $match, null, $cursor)) { - // names - $tokens[] = new Token(Token::NAME_TYPE, $match[0], $cursor + 1); - $cursor += strlen($match[0]); - } else { - // unlexable - throw new SyntaxError(sprintf('Unexpected character "%s"', $expression[$cursor]), $cursor); - } - } - - $tokens[] = new Token(Token::EOF_TYPE, null, $cursor + 1); - - if (!empty($brackets)) { - list($expect, $cur) = array_pop($brackets); - throw new SyntaxError(sprintf('Unclosed "%s"', $expect), $cur); - } - - return new TokenStream($tokens); - } -} diff --git a/lib/vendor/symfony/expression-language/Node/ArgumentsNode.php b/lib/vendor/symfony/expression-language/Node/ArgumentsNode.php deleted file mode 100644 index 1c78d80..0000000 --- a/lib/vendor/symfony/expression-language/Node/ArgumentsNode.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class ArgumentsNode extends ArrayNode -{ - public function compile(Compiler $compiler) - { - $this->compileArguments($compiler, false); - } - - public function toArray() - { - $array = array(); - - foreach ($this->getKeyValuePairs() as $pair) { - $array[] = $pair['value']; - $array[] = ', '; - } - array_pop($array); - - return $array; - } -} diff --git a/lib/vendor/symfony/expression-language/Node/ArrayNode.php b/lib/vendor/symfony/expression-language/Node/ArrayNode.php deleted file mode 100644 index b93a7df..0000000 --- a/lib/vendor/symfony/expression-language/Node/ArrayNode.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class ArrayNode extends Node -{ - protected $index; - - public function __construct() - { - $this->index = -1; - } - - public function addElement(Node $value, Node $key = null) - { - if (null === $key) { - $key = new ConstantNode(++$this->index); - } - - array_push($this->nodes, $key, $value); - } - - /** - * Compiles the node to PHP. - * - * @param Compiler $compiler A Compiler instance - */ - public function compile(Compiler $compiler) - { - $compiler->raw('array('); - $this->compileArguments($compiler); - $compiler->raw(')'); - } - - public function evaluate($functions, $values) - { - $result = array(); - foreach ($this->getKeyValuePairs() as $pair) { - $result[$pair['key']->evaluate($functions, $values)] = $pair['value']->evaluate($functions, $values); - } - - return $result; - } - - public function toArray() - { - $value = array(); - foreach ($this->getKeyValuePairs() as $pair) { - $value[$pair['key']->attributes['value']] = $pair['value']; - } - - $array = array(); - - if ($this->isHash($value)) { - foreach ($value as $k => $v) { - $array[] = ', '; - $array[] = new ConstantNode($k); - $array[] = ': '; - $array[] = $v; - } - $array[0] = '{'; - $array[] = '}'; - } else { - foreach ($value as $v) { - $array[] = ', '; - $array[] = $v; - } - $array[0] = '['; - $array[] = ']'; - } - - return $array; - } - - protected function getKeyValuePairs() - { - $pairs = array(); - foreach (array_chunk($this->nodes, 2) as $pair) { - $pairs[] = array('key' => $pair[0], 'value' => $pair[1]); - } - - return $pairs; - } - - protected function compileArguments(Compiler $compiler, $withKeys = true) - { - $first = true; - foreach ($this->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - if ($withKeys) { - $compiler - ->compile($pair['key']) - ->raw(' => ') - ; - } - - $compiler->compile($pair['value']); - } - } -} diff --git a/lib/vendor/symfony/expression-language/Node/BinaryNode.php b/lib/vendor/symfony/expression-language/Node/BinaryNode.php deleted file mode 100644 index 33b4c8f..0000000 --- a/lib/vendor/symfony/expression-language/Node/BinaryNode.php +++ /dev/null @@ -1,162 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class BinaryNode extends Node -{ - private static $operators = array( - '~' => '.', - 'and' => '&&', - 'or' => '||', - ); - - private static $functions = array( - '**' => 'pow', - '..' => 'range', - 'in' => 'in_array', - 'not in' => '!in_array', - ); - - public function __construct($operator, Node $left, Node $right) - { - parent::__construct( - array('left' => $left, 'right' => $right), - array('operator' => $operator) - ); - } - - public function compile(Compiler $compiler) - { - $operator = $this->attributes['operator']; - - if ('matches' == $operator) { - $compiler - ->raw('preg_match(') - ->compile($this->nodes['right']) - ->raw(', ') - ->compile($this->nodes['left']) - ->raw(')') - ; - - return; - } - - if (isset(self::$functions[$operator])) { - $compiler - ->raw(sprintf('%s(', self::$functions[$operator])) - ->compile($this->nodes['left']) - ->raw(', ') - ->compile($this->nodes['right']) - ->raw(')') - ; - - return; - } - - if (isset(self::$operators[$operator])) { - $operator = self::$operators[$operator]; - } - - $compiler - ->raw('(') - ->compile($this->nodes['left']) - ->raw(' ') - ->raw($operator) - ->raw(' ') - ->compile($this->nodes['right']) - ->raw(')') - ; - } - - public function evaluate($functions, $values) - { - $operator = $this->attributes['operator']; - $left = $this->nodes['left']->evaluate($functions, $values); - - if (isset(self::$functions[$operator])) { - $right = $this->nodes['right']->evaluate($functions, $values); - - if ('not in' === $operator) { - return !in_array($left, $right); - } - $f = self::$functions[$operator]; - - return $f($left, $right); - } - - switch ($operator) { - case 'or': - case '||': - return $left || $this->nodes['right']->evaluate($functions, $values); - case 'and': - case '&&': - return $left && $this->nodes['right']->evaluate($functions, $values); - } - - $right = $this->nodes['right']->evaluate($functions, $values); - - switch ($operator) { - case '|': - return $left | $right; - case '^': - return $left ^ $right; - case '&': - return $left & $right; - case '==': - return $left == $right; - case '===': - return $left === $right; - case '!=': - return $left != $right; - case '!==': - return $left !== $right; - case '<': - return $left < $right; - case '>': - return $left > $right; - case '>=': - return $left >= $right; - case '<=': - return $left <= $right; - case 'not in': - return !in_array($left, $right); - case 'in': - return in_array($left, $right); - case '+': - return $left + $right; - case '-': - return $left - $right; - case '~': - return $left.$right; - case '*': - return $left * $right; - case '/': - return $left / $right; - case '%': - return $left % $right; - case 'matches': - return preg_match($right, $left); - } - } - - public function toArray() - { - return array('(', $this->nodes['left'], ' '.$this->attributes['operator'].' ', $this->nodes['right'], ')'); - } -} diff --git a/lib/vendor/symfony/expression-language/Node/ConditionalNode.php b/lib/vendor/symfony/expression-language/Node/ConditionalNode.php deleted file mode 100644 index 9db0f93..0000000 --- a/lib/vendor/symfony/expression-language/Node/ConditionalNode.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class ConditionalNode extends Node -{ - public function __construct(Node $expr1, Node $expr2, Node $expr3) - { - parent::__construct( - array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3) - ); - } - - public function compile(Compiler $compiler) - { - $compiler - ->raw('((') - ->compile($this->nodes['expr1']) - ->raw(') ? (') - ->compile($this->nodes['expr2']) - ->raw(') : (') - ->compile($this->nodes['expr3']) - ->raw('))') - ; - } - - public function evaluate($functions, $values) - { - if ($this->nodes['expr1']->evaluate($functions, $values)) { - return $this->nodes['expr2']->evaluate($functions, $values); - } - - return $this->nodes['expr3']->evaluate($functions, $values); - } - - public function toArray() - { - return array('(', $this->nodes['expr1'], ' ? ', $this->nodes['expr2'], ' : ', $this->nodes['expr3'], ')'); - } -} diff --git a/lib/vendor/symfony/expression-language/Node/ConstantNode.php b/lib/vendor/symfony/expression-language/Node/ConstantNode.php deleted file mode 100644 index 733d481..0000000 --- a/lib/vendor/symfony/expression-language/Node/ConstantNode.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class ConstantNode extends Node -{ - private $isIdentifier; - - public function __construct($value, $isIdentifier = false) - { - $this->isIdentifier = $isIdentifier; - parent::__construct( - array(), - array('value' => $value) - ); - } - - public function compile(Compiler $compiler) - { - $compiler->repr($this->attributes['value']); - } - - public function evaluate($functions, $values) - { - return $this->attributes['value']; - } - - public function toArray() - { - $array = array(); - $value = $this->attributes['value']; - - if ($this->isIdentifier) { - $array[] = $value; - } elseif (true === $value) { - $array[] = 'true'; - } elseif (false === $value) { - $array[] = 'false'; - } elseif (null === $value) { - $array[] = 'null'; - } elseif (is_numeric($value)) { - $array[] = $value; - } elseif (!is_array($value)) { - $array[] = $this->dumpString($value); - } elseif ($this->isHash($value)) { - foreach ($value as $k => $v) { - $array[] = ', '; - $array[] = new self($k); - $array[] = ': '; - $array[] = new self($v); - } - $array[0] = '{'; - $array[] = '}'; - } else { - foreach ($value as $v) { - $array[] = ', '; - $array[] = new self($v); - } - $array[0] = '['; - $array[] = ']'; - } - - return $array; - } -} diff --git a/lib/vendor/symfony/expression-language/Node/FunctionNode.php b/lib/vendor/symfony/expression-language/Node/FunctionNode.php deleted file mode 100644 index 13928c8..0000000 --- a/lib/vendor/symfony/expression-language/Node/FunctionNode.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class FunctionNode extends Node -{ - public function __construct($name, Node $arguments) - { - parent::__construct( - array('arguments' => $arguments), - array('name' => $name) - ); - } - - public function compile(Compiler $compiler) - { - $arguments = array(); - foreach ($this->nodes['arguments']->nodes as $node) { - $arguments[] = $compiler->subcompile($node); - } - - $function = $compiler->getFunction($this->attributes['name']); - - $compiler->raw(call_user_func_array($function['compiler'], $arguments)); - } - - public function evaluate($functions, $values) - { - $arguments = array($values); - foreach ($this->nodes['arguments']->nodes as $node) { - $arguments[] = $node->evaluate($functions, $values); - } - - return call_user_func_array($functions[$this->attributes['name']]['evaluator'], $arguments); - } - - public function toArray() - { - $array = array(); - $array[] = $this->attributes['name']; - - foreach ($this->nodes['arguments']->nodes as $node) { - $array[] = ', '; - $array[] = $node; - } - $array[1] = '('; - $array[] = ')'; - - return $array; - } -} diff --git a/lib/vendor/symfony/expression-language/Node/GetAttrNode.php b/lib/vendor/symfony/expression-language/Node/GetAttrNode.php deleted file mode 100644 index c5c99d7..0000000 --- a/lib/vendor/symfony/expression-language/Node/GetAttrNode.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class GetAttrNode extends Node -{ - const PROPERTY_CALL = 1; - const METHOD_CALL = 2; - const ARRAY_CALL = 3; - - public function __construct(Node $node, Node $attribute, ArrayNode $arguments, $type) - { - parent::__construct( - array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments), - array('type' => $type) - ); - } - - public function compile(Compiler $compiler) - { - switch ($this->attributes['type']) { - case self::PROPERTY_CALL: - $compiler - ->compile($this->nodes['node']) - ->raw('->') - ->raw($this->nodes['attribute']->attributes['value']) - ; - break; - - case self::METHOD_CALL: - $compiler - ->compile($this->nodes['node']) - ->raw('->') - ->raw($this->nodes['attribute']->attributes['value']) - ->raw('(') - ->compile($this->nodes['arguments']) - ->raw(')') - ; - break; - - case self::ARRAY_CALL: - $compiler - ->compile($this->nodes['node']) - ->raw('[') - ->compile($this->nodes['attribute'])->raw(']') - ; - break; - } - } - - public function evaluate($functions, $values) - { - switch ($this->attributes['type']) { - case self::PROPERTY_CALL: - $obj = $this->nodes['node']->evaluate($functions, $values); - if (!is_object($obj)) { - throw new \RuntimeException('Unable to get a property on a non-object.'); - } - - $property = $this->nodes['attribute']->attributes['value']; - - return $obj->$property; - - case self::METHOD_CALL: - $obj = $this->nodes['node']->evaluate($functions, $values); - if (!is_object($obj)) { - throw new \RuntimeException('Unable to get a property on a non-object.'); - } - - return call_user_func_array(array($obj, $this->nodes['attribute']->attributes['value']), $this->nodes['arguments']->evaluate($functions, $values)); - - case self::ARRAY_CALL: - $array = $this->nodes['node']->evaluate($functions, $values); - if (!is_array($array) && !$array instanceof \ArrayAccess) { - throw new \RuntimeException('Unable to get an item on a non-array.'); - } - - return $array[$this->nodes['attribute']->evaluate($functions, $values)]; - } - } - - public function toArray() - { - switch ($this->attributes['type']) { - case self::PROPERTY_CALL: - return array($this->nodes['node'], '.', $this->nodes['attribute']); - - case self::METHOD_CALL: - return array($this->nodes['node'], '.', $this->nodes['attribute'], '(', $this->nodes['arguments'], ')'); - - case self::ARRAY_CALL: - return array($this->nodes['node'], '[', $this->nodes['attribute'], ']'); - } - } -} diff --git a/lib/vendor/symfony/expression-language/Node/NameNode.php b/lib/vendor/symfony/expression-language/Node/NameNode.php deleted file mode 100644 index 9e1462f..0000000 --- a/lib/vendor/symfony/expression-language/Node/NameNode.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class NameNode extends Node -{ - public function __construct($name) - { - parent::__construct( - array(), - array('name' => $name) - ); - } - - public function compile(Compiler $compiler) - { - $compiler->raw('$'.$this->attributes['name']); - } - - public function evaluate($functions, $values) - { - return $values[$this->attributes['name']]; - } - - public function toArray() - { - return array($this->attributes['name']); - } -} diff --git a/lib/vendor/symfony/expression-language/Node/Node.php b/lib/vendor/symfony/expression-language/Node/Node.php deleted file mode 100644 index 5e89027..0000000 --- a/lib/vendor/symfony/expression-language/Node/Node.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * Represents a node in the AST. - * - * @author Fabien Potencier - */ -class Node -{ - public $nodes = array(); - public $attributes = array(); - - /** - * Constructor. - * - * @param array $nodes An array of nodes - * @param array $attributes An array of attributes - */ - public function __construct(array $nodes = array(), array $attributes = array()) - { - $this->nodes = $nodes; - $this->attributes = $attributes; - } - - public function __toString() - { - $attributes = array(); - foreach ($this->attributes as $name => $value) { - $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); - } - - $repr = array(str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', get_class($this)).'('.implode(', ', $attributes)); - - if (count($this->nodes)) { - foreach ($this->nodes as $node) { - foreach (explode("\n", (string) $node) as $line) { - $repr[] = ' '.$line; - } - } - - $repr[] = ')'; - } else { - $repr[0] .= ')'; - } - - return implode("\n", $repr); - } - - public function compile(Compiler $compiler) - { - foreach ($this->nodes as $node) { - $node->compile($compiler); - } - } - - public function evaluate($functions, $values) - { - $results = array(); - foreach ($this->nodes as $node) { - $results[] = $node->evaluate($functions, $values); - } - - return $results; - } - - public function toArray() - { - throw new \BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', get_class($this))); - } - - public function dump() - { - $dump = ''; - - foreach ($this->toArray() as $v) { - $dump .= is_scalar($v) ? $v : $v->dump(); - } - - return $dump; - } - - protected function dumpString($value) - { - return sprintf('"%s"', addcslashes($value, "\0\t\"\\")); - } - - protected function isHash(array $value) - { - $expectedKey = 0; - - foreach ($value as $key => $val) { - if ($key !== $expectedKey++) { - return true; - } - } - - return false; - } -} diff --git a/lib/vendor/symfony/expression-language/Node/UnaryNode.php b/lib/vendor/symfony/expression-language/Node/UnaryNode.php deleted file mode 100644 index 5831032..0000000 --- a/lib/vendor/symfony/expression-language/Node/UnaryNode.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -/** - * @author Fabien Potencier - * - * @internal - */ -class UnaryNode extends Node -{ - private static $operators = array( - '!' => '!', - 'not' => '!', - '+' => '+', - '-' => '-', - ); - - public function __construct($operator, Node $node) - { - parent::__construct( - array('node' => $node), - array('operator' => $operator) - ); - } - - public function compile(Compiler $compiler) - { - $compiler - ->raw('(') - ->raw(self::$operators[$this->attributes['operator']]) - ->compile($this->nodes['node']) - ->raw(')') - ; - } - - public function evaluate($functions, $values) - { - $value = $this->nodes['node']->evaluate($functions, $values); - switch ($this->attributes['operator']) { - case 'not': - case '!': - return !$value; - case '-': - return -$value; - } - - return $value; - } - - public function toArray() - { - return array('(', $this->attributes['operator'].' ', $this->nodes['node'], ')'); - } -} diff --git a/lib/vendor/symfony/expression-language/ParsedExpression.php b/lib/vendor/symfony/expression-language/ParsedExpression.php deleted file mode 100644 index 61bf580..0000000 --- a/lib/vendor/symfony/expression-language/ParsedExpression.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -use Symfony\Component\ExpressionLanguage\Node\Node; - -/** - * Represents an already parsed expression. - * - * @author Fabien Potencier - */ -class ParsedExpression extends Expression -{ - private $nodes; - - /** - * Constructor. - * - * @param string $expression An expression - * @param Node $nodes A Node representing the expression - */ - public function __construct($expression, Node $nodes) - { - parent::__construct($expression); - - $this->nodes = $nodes; - } - - public function getNodes() - { - return $this->nodes; - } -} diff --git a/lib/vendor/symfony/expression-language/Parser.php b/lib/vendor/symfony/expression-language/Parser.php deleted file mode 100644 index f8900bf..0000000 --- a/lib/vendor/symfony/expression-language/Parser.php +++ /dev/null @@ -1,380 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * Parsers a token stream. - * - * This parser implements a "Precedence climbing" algorithm. - * - * @see http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm - * @see http://en.wikipedia.org/wiki/Operator-precedence_parser - * - * @author Fabien Potencier - */ -class Parser -{ - const OPERATOR_LEFT = 1; - const OPERATOR_RIGHT = 2; - - private $stream; - private $unaryOperators; - private $binaryOperators; - private $functions; - private $names; - - public function __construct(array $functions) - { - $this->functions = $functions; - - $this->unaryOperators = array( - 'not' => array('precedence' => 50), - '!' => array('precedence' => 50), - '-' => array('precedence' => 500), - '+' => array('precedence' => 500), - ); - $this->binaryOperators = array( - 'or' => array('precedence' => 10, 'associativity' => self::OPERATOR_LEFT), - '||' => array('precedence' => 10, 'associativity' => self::OPERATOR_LEFT), - 'and' => array('precedence' => 15, 'associativity' => self::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'associativity' => self::OPERATOR_LEFT), - '|' => array('precedence' => 16, 'associativity' => self::OPERATOR_LEFT), - '^' => array('precedence' => 17, 'associativity' => self::OPERATOR_LEFT), - '&' => array('precedence' => 18, 'associativity' => self::OPERATOR_LEFT), - '==' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '===' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '!=' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '!==' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '<' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '>' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '>=' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '<=' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - 'not in' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - 'in' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - 'matches' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '..' => array('precedence' => 25, 'associativity' => self::OPERATOR_LEFT), - '+' => array('precedence' => 30, 'associativity' => self::OPERATOR_LEFT), - '-' => array('precedence' => 30, 'associativity' => self::OPERATOR_LEFT), - '~' => array('precedence' => 40, 'associativity' => self::OPERATOR_LEFT), - '*' => array('precedence' => 60, 'associativity' => self::OPERATOR_LEFT), - '/' => array('precedence' => 60, 'associativity' => self::OPERATOR_LEFT), - '%' => array('precedence' => 60, 'associativity' => self::OPERATOR_LEFT), - '**' => array('precedence' => 200, 'associativity' => self::OPERATOR_RIGHT), - ); - } - - /** - * Converts a token stream to a node tree. - * - * The valid names is an array where the values - * are the names that the user can use in an expression. - * - * If the variable name in the compiled PHP code must be - * different, define it as the key. - * - * For instance, ['this' => 'container'] means that the - * variable 'container' can be used in the expression - * but the compiled code will use 'this'. - * - * @param TokenStream $stream A token stream instance - * @param array $names An array of valid names - * - * @return Node\Node A node tree - * - * @throws SyntaxError - */ - public function parse(TokenStream $stream, $names = array()) - { - $this->stream = $stream; - $this->names = $names; - - $node = $this->parseExpression(); - if (!$stream->isEOF()) { - throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s"', $stream->current->type, $stream->current->value), $stream->current->cursor); - } - - return $node; - } - - public function parseExpression($precedence = 0) - { - $expr = $this->getPrimary(); - $token = $this->stream->current; - while ($token->test(Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->value]) && $this->binaryOperators[$token->value]['precedence'] >= $precedence) { - $op = $this->binaryOperators[$token->value]; - $this->stream->next(); - - $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); - $expr = new Node\BinaryNode($token->value, $expr, $expr1); - - $token = $this->stream->current; - } - - if (0 === $precedence) { - return $this->parseConditionalExpression($expr); - } - - return $expr; - } - - protected function getPrimary() - { - $token = $this->stream->current; - - if ($token->test(Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->value])) { - $operator = $this->unaryOperators[$token->value]; - $this->stream->next(); - $expr = $this->parseExpression($operator['precedence']); - - return $this->parsePostfixExpression(new Node\UnaryNode($token->value, $expr)); - } - - if ($token->test(Token::PUNCTUATION_TYPE, '(')) { - $this->stream->next(); - $expr = $this->parseExpression(); - $this->stream->expect(Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); - - return $this->parsePostfixExpression($expr); - } - - return $this->parsePrimaryExpression(); - } - - protected function parseConditionalExpression($expr) - { - while ($this->stream->current->test(Token::PUNCTUATION_TYPE, '?')) { - $this->stream->next(); - if (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ':')) { - $expr2 = $this->parseExpression(); - if ($this->stream->current->test(Token::PUNCTUATION_TYPE, ':')) { - $this->stream->next(); - $expr3 = $this->parseExpression(); - } else { - $expr3 = new Node\ConstantNode(null); - } - } else { - $this->stream->next(); - $expr2 = $expr; - $expr3 = $this->parseExpression(); - } - - $expr = new Node\ConditionalNode($expr, $expr2, $expr3); - } - - return $expr; - } - - public function parsePrimaryExpression() - { - $token = $this->stream->current; - switch ($token->type) { - case Token::NAME_TYPE: - $this->stream->next(); - switch ($token->value) { - case 'true': - case 'TRUE': - return new Node\ConstantNode(true); - - case 'false': - case 'FALSE': - return new Node\ConstantNode(false); - - case 'null': - case 'NULL': - return new Node\ConstantNode(null); - - default: - if ('(' === $this->stream->current->value) { - if (false === isset($this->functions[$token->value])) { - throw new SyntaxError(sprintf('The function "%s" does not exist', $token->value), $token->cursor); - } - - $node = new Node\FunctionNode($token->value, $this->parseArguments()); - } else { - if (!in_array($token->value, $this->names, true)) { - throw new SyntaxError(sprintf('Variable "%s" is not valid', $token->value), $token->cursor); - } - - // is the name used in the compiled code different - // from the name used in the expression? - if (is_int($name = array_search($token->value, $this->names))) { - $name = $token->value; - } - - $node = new Node\NameNode($name); - } - } - break; - - case Token::NUMBER_TYPE: - case Token::STRING_TYPE: - $this->stream->next(); - - return new Node\ConstantNode($token->value); - - default: - if ($token->test(Token::PUNCTUATION_TYPE, '[')) { - $node = $this->parseArrayExpression(); - } elseif ($token->test(Token::PUNCTUATION_TYPE, '{')) { - $node = $this->parseHashExpression(); - } else { - throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s"', $token->type, $token->value), $token->cursor); - } - } - - return $this->parsePostfixExpression($node); - } - - public function parseArrayExpression() - { - $this->stream->expect(Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); - - $node = new Node\ArrayNode(); - $first = true; - while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ']')) { - if (!$first) { - $this->stream->expect(Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); - - // trailing ,? - if ($this->stream->current->test(Token::PUNCTUATION_TYPE, ']')) { - break; - } - } - $first = false; - - $node->addElement($this->parseExpression()); - } - $this->stream->expect(Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); - - return $node; - } - - public function parseHashExpression() - { - $this->stream->expect(Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); - - $node = new Node\ArrayNode(); - $first = true; - while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, '}')) { - if (!$first) { - $this->stream->expect(Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); - - // trailing ,? - if ($this->stream->current->test(Token::PUNCTUATION_TYPE, '}')) { - break; - } - } - $first = false; - - // a hash key can be: - // - // * a number -- 12 - // * a string -- 'a' - // * a name, which is equivalent to a string -- a - // * an expression, which must be enclosed in parentheses -- (1 + 2) - if ($this->stream->current->test(Token::STRING_TYPE) || $this->stream->current->test(Token::NAME_TYPE) || $this->stream->current->test(Token::NUMBER_TYPE)) { - $key = new Node\ConstantNode($this->stream->current->value); - $this->stream->next(); - } elseif ($this->stream->current->test(Token::PUNCTUATION_TYPE, '(')) { - $key = $this->parseExpression(); - } else { - $current = $this->stream->current; - - throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s"', $current->type, $current->value), $current->cursor); - } - - $this->stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); - $value = $this->parseExpression(); - - $node->addElement($value, $key); - } - $this->stream->expect(Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); - - return $node; - } - - public function parsePostfixExpression($node) - { - $token = $this->stream->current; - while ($token->type == Token::PUNCTUATION_TYPE) { - if ('.' === $token->value) { - $this->stream->next(); - $token = $this->stream->current; - $this->stream->next(); - - if ( - $token->type !== Token::NAME_TYPE - && - // Operators like "not" and "matches" are valid method or property names, - // - // In other words, besides NAME_TYPE, OPERATOR_TYPE could also be parsed as a property or method. - // This is because operators are processed by the lexer prior to names. So "not" in "foo.not()" or "matches" in "foo.matches" will be recognized as an operator first. - // But in fact, "not" and "matches" in such expressions shall be parsed as method or property names. - // - // And this ONLY works if the operator consists of valid characters for a property or method name. - // - // Other types, such as STRING_TYPE and NUMBER_TYPE, can't be parsed as property nor method names. - // - // As a result, if $token is NOT an operator OR $token->value is NOT a valid property or method name, an exception shall be thrown. - ($token->type !== Token::OPERATOR_TYPE || !preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $token->value)) - ) { - throw new SyntaxError('Expected name', $token->cursor); - } - - $arg = new Node\ConstantNode($token->value, true); - - $arguments = new Node\ArgumentsNode(); - if ($this->stream->current->test(Token::PUNCTUATION_TYPE, '(')) { - $type = Node\GetAttrNode::METHOD_CALL; - foreach ($this->parseArguments()->nodes as $n) { - $arguments->addElement($n); - } - } else { - $type = Node\GetAttrNode::PROPERTY_CALL; - } - - $node = new Node\GetAttrNode($node, $arg, $arguments, $type); - } elseif ('[' === $token->value) { - $this->stream->next(); - $arg = $this->parseExpression(); - $this->stream->expect(Token::PUNCTUATION_TYPE, ']'); - - $node = new Node\GetAttrNode($node, $arg, new Node\ArgumentsNode(), Node\GetAttrNode::ARRAY_CALL); - } else { - break; - } - - $token = $this->stream->current; - } - - return $node; - } - - /** - * Parses arguments. - */ - public function parseArguments() - { - $args = array(); - $this->stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); - while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ')')) { - if (!empty($args)) { - $this->stream->expect(Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); - } - - $args[] = $this->parseExpression(); - } - $this->stream->expect(Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); - - return new Node\Node($args); - } -} diff --git a/lib/vendor/symfony/expression-language/ParserCache/ArrayParserCache.php b/lib/vendor/symfony/expression-language/ParserCache/ArrayParserCache.php deleted file mode 100644 index 777de42..0000000 --- a/lib/vendor/symfony/expression-language/ParserCache/ArrayParserCache.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\ParserCache; - -@trigger_error('The '.__NAMESPACE__.'\ArrayParserCache class is deprecated since version 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.', E_USER_DEPRECATED); - -use Symfony\Component\ExpressionLanguage\ParsedExpression; - -/** - * @author Adrien Brault - * - * @deprecated ArrayParserCache class is deprecated since version 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead. - */ -class ArrayParserCache implements ParserCacheInterface -{ - /** - * @var array - */ - private $cache = array(); - - /** - * {@inheritdoc} - */ - public function fetch($key) - { - return isset($this->cache[$key]) ? $this->cache[$key] : null; - } - - /** - * {@inheritdoc} - */ - public function save($key, ParsedExpression $expression) - { - $this->cache[$key] = $expression; - } -} diff --git a/lib/vendor/symfony/expression-language/ParserCache/ParserCacheAdapter.php b/lib/vendor/symfony/expression-language/ParserCache/ParserCacheAdapter.php deleted file mode 100644 index 2867aa3..0000000 --- a/lib/vendor/symfony/expression-language/ParserCache/ParserCacheAdapter.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\ParserCache; - -use Psr\Cache\CacheItemInterface; -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\CacheItem; - -/** - * @author Alexandre GESLIN - * - * @internal This class should be removed in Symfony 4.0. - */ -class ParserCacheAdapter implements CacheItemPoolInterface -{ - private $pool; - private $createCacheItem; - - public function __construct(ParserCacheInterface $pool) - { - $this->pool = $pool; - - $this->createCacheItem = \Closure::bind( - function ($key, $value, $isHit) { - $item = new CacheItem(); - $item->key = $key; - $item->value = $value; - $item->isHit = $isHit; - - return $item; - }, - null, - CacheItem::class - ); - } - - /** - * {@inheritdoc} - */ - public function getItem($key) - { - $value = $this->pool->fetch($key); - $f = $this->createCacheItem; - - return $f($key, $value, null !== $value); - } - - /** - * {@inheritdoc} - */ - public function save(CacheItemInterface $item) - { - $this->pool->save($item->getKey(), $item->get()); - } - - /** - * {@inheritdoc} - */ - public function getItems(array $keys = array()) - { - throw new \BadMethodCallException('Not implemented'); - } - - /** - * {@inheritdoc} - */ - public function hasItem($key) - { - throw new \BadMethodCallException('Not implemented'); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - throw new \BadMethodCallException('Not implemented'); - } - - /** - * {@inheritdoc} - */ - public function deleteItem($key) - { - throw new \BadMethodCallException('Not implemented'); - } - - /** - * {@inheritdoc} - */ - public function deleteItems(array $keys) - { - throw new \BadMethodCallException('Not implemented'); - } - - /** - * {@inheritdoc} - */ - public function saveDeferred(CacheItemInterface $item) - { - throw new \BadMethodCallException('Not implemented'); - } - - /** - * {@inheritdoc} - */ - public function commit() - { - throw new \BadMethodCallException('Not implemented'); - } -} diff --git a/lib/vendor/symfony/expression-language/ParserCache/ParserCacheInterface.php b/lib/vendor/symfony/expression-language/ParserCache/ParserCacheInterface.php deleted file mode 100644 index 1e10cb4..0000000 --- a/lib/vendor/symfony/expression-language/ParserCache/ParserCacheInterface.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\ParserCache; - -@trigger_error('The '.__NAMESPACE__.'\ParserCacheInterface interface is deprecated since version 3.2 and will be removed in 4.0. Use Psr\Cache\CacheItemPoolInterface instead.', E_USER_DEPRECATED); - -use Symfony\Component\ExpressionLanguage\ParsedExpression; - -/** - * @author Adrien Brault - * - * @deprecated since version 3.2, to be removed in 4.0. Use Psr\Cache\CacheItemPoolInterface instead. - */ -interface ParserCacheInterface -{ - /** - * Saves an expression in the cache. - * - * @param string $key The cache key - * @param ParsedExpression $expression A ParsedExpression instance to store in the cache - */ - public function save($key, ParsedExpression $expression); - - /** - * Fetches an expression from the cache. - * - * @param string $key The cache key - * - * @return ParsedExpression|null - */ - public function fetch($key); -} diff --git a/lib/vendor/symfony/expression-language/README.md b/lib/vendor/symfony/expression-language/README.md deleted file mode 100644 index 08b310d..0000000 --- a/lib/vendor/symfony/expression-language/README.md +++ /dev/null @@ -1,15 +0,0 @@ -ExpressionLanguage Component -============================ - -The ExpressionLanguage component provides an engine that can compile and -evaluate expressions. An expression is a one-liner that returns a value -(mostly, but not limited to, Booleans). - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/expression_language/introduction.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/lib/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php b/lib/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php deleted file mode 100644 index 74a1008..0000000 --- a/lib/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$operators = array('not', '!', 'or', '||', '&&', 'and', '|', '^', '&', '==', '===', '!=', '!==', '<', '>', '>=', '<=', 'not in', 'in', '..', '+', '-', '~', '*', '/', '%', 'matches', '**'); -$operators = array_combine($operators, array_map('strlen', $operators)); -arsort($operators); - -$regex = array(); -foreach ($operators as $operator => $length) { - // an operator that ends with a character must be followed by - // a whitespace or a parenthesis - $regex[] = preg_quote($operator, '/').(ctype_alpha($operator[$length - 1]) ? '(?=[\s(])' : ''); -} - -echo '/'.implode('|', $regex).'/A'; diff --git a/lib/vendor/symfony/expression-language/SerializedParsedExpression.php b/lib/vendor/symfony/expression-language/SerializedParsedExpression.php deleted file mode 100644 index ced25db..0000000 --- a/lib/vendor/symfony/expression-language/SerializedParsedExpression.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * Represents an already parsed expression. - * - * @author Fabien Potencier - */ -class SerializedParsedExpression extends ParsedExpression -{ - private $nodes; - - /** - * Constructor. - * - * @param string $expression An expression - * @param string $nodes The serialized nodes for the expression - */ - public function __construct($expression, $nodes) - { - $this->expression = (string) $expression; - $this->nodes = $nodes; - } - - public function getNodes() - { - return unserialize($this->nodes); - } -} diff --git a/lib/vendor/symfony/expression-language/SyntaxError.php b/lib/vendor/symfony/expression-language/SyntaxError.php deleted file mode 100644 index d149c00..0000000 --- a/lib/vendor/symfony/expression-language/SyntaxError.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -class SyntaxError extends \LogicException -{ - public function __construct($message, $cursor = 0) - { - parent::__construct(sprintf('%s around position %d.', $message, $cursor)); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php b/lib/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php deleted file mode 100644 index dd2165b..0000000 --- a/lib/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php +++ /dev/null @@ -1,214 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests; - -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\ExpressionLanguage\ParsedExpression; -use Symfony\Component\ExpressionLanguage\Tests\Fixtures\TestProvider; - -class ExpressionLanguageTest extends \PHPUnit_Framework_TestCase -{ - public function testCachedParse() - { - $cacheMock = $this->getMock('Psr\Cache\CacheItemPoolInterface'); - $cacheItemMock = $this->getMock('Psr\Cache\CacheItemInterface'); - $savedParsedExpression = null; - $expressionLanguage = new ExpressionLanguage($cacheMock); - - $cacheMock - ->expects($this->exactly(2)) - ->method('getItem') - ->with('1%20%2B%201%2F%2F') - ->willReturn($cacheItemMock) - ; - - $cacheItemMock - ->expects($this->exactly(2)) - ->method('get') - ->will($this->returnCallback(function () use (&$savedParsedExpression) { - return $savedParsedExpression; - })) - ; - - $cacheItemMock - ->expects($this->exactly(1)) - ->method('set') - ->with($this->isInstanceOf(ParsedExpression::class)) - ->will($this->returnCallback(function ($parsedExpression) use (&$savedParsedExpression) { - $savedParsedExpression = $parsedExpression; - })) - ; - - $cacheMock - ->expects($this->exactly(1)) - ->method('save') - ->with($cacheItemMock) - ; - - $parsedExpression = $expressionLanguage->parse('1 + 1', array()); - $this->assertSame($savedParsedExpression, $parsedExpression); - - $parsedExpression = $expressionLanguage->parse('1 + 1', array()); - $this->assertSame($savedParsedExpression, $parsedExpression); - } - - /** - * @group legacy - */ - public function testCachedParseWithDeprecatedParserCacheInterface() - { - $cacheMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - - $cacheItemMock = $this->getMock('Psr\Cache\CacheItemInterface'); - $savedParsedExpression = null; - $expressionLanguage = new ExpressionLanguage($cacheMock); - - $cacheMock - ->expects($this->exactly(1)) - ->method('fetch') - ->with('1%20%2B%201%2F%2F') - ->willReturn($savedParsedExpression) - ; - - $cacheMock - ->expects($this->exactly(1)) - ->method('save') - ->with('1%20%2B%201%2F%2F', $this->isInstanceOf(ParsedExpression::class)) - ->will($this->returnCallback(function ($key, $expression) use (&$savedParsedExpression) { - $savedParsedExpression = $expression; - })) - ; - - $parsedExpression = $expressionLanguage->parse('1 + 1', array()); - $this->assertSame($savedParsedExpression, $parsedExpression); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Cache argument has to implement Psr\Cache\CacheItemPoolInterface. - */ - public function testWrongCacheImplementation() - { - $cacheMock = $this->getMock('Psr\Cache\CacheItemSpoolInterface'); - $expressionLanguage = new ExpressionLanguage($cacheMock); - } - - public function testConstantFunction() - { - $expressionLanguage = new ExpressionLanguage(); - $this->assertEquals(PHP_VERSION, $expressionLanguage->evaluate('constant("PHP_VERSION")')); - - $expressionLanguage = new ExpressionLanguage(); - $this->assertEquals('constant("PHP_VERSION")', $expressionLanguage->compile('constant("PHP_VERSION")')); - } - - public function testProviders() - { - $expressionLanguage = new ExpressionLanguage(null, array(new TestProvider())); - $this->assertEquals('foo', $expressionLanguage->evaluate('identity("foo")')); - $this->assertEquals('"foo"', $expressionLanguage->compile('identity("foo")')); - } - - /** - * @dataProvider shortCircuitProviderEvaluate - */ - public function testShortCircuitOperatorsEvaluate($expression, array $values, $expected) - { - $expressionLanguage = new ExpressionLanguage(); - $this->assertEquals($expected, $expressionLanguage->evaluate($expression, $values)); - } - - /** - * @dataProvider shortCircuitProviderCompile - */ - public function testShortCircuitOperatorsCompile($expression, array $names, $expected) - { - $result = null; - $expressionLanguage = new ExpressionLanguage(); - eval(sprintf('$result = %s;', $expressionLanguage->compile($expression, $names))); - $this->assertSame($expected, $result); - } - - public function shortCircuitProviderEvaluate() - { - $object = $this->getMockBuilder('stdClass')->setMethods(array('foo'))->getMock(); - $object->expects($this->never())->method('foo'); - - return array( - array('false and object.foo()', array('object' => $object), false), - array('false && object.foo()', array('object' => $object), false), - array('true || object.foo()', array('object' => $object), true), - array('true or object.foo()', array('object' => $object), true), - ); - } - - public function shortCircuitProviderCompile() - { - return array( - array('false and foo', array('foo' => 'foo'), false), - array('false && foo', array('foo' => 'foo'), false), - array('true || foo', array('foo' => 'foo'), true), - array('true or foo', array('foo' => 'foo'), true), - ); - } - - public function testCachingForOverriddenVariableNames() - { - $expressionLanguage = new ExpressionLanguage(); - $expression = 'a + b'; - $expressionLanguage->evaluate($expression, array('a' => 1, 'b' => 1)); - $result = $expressionLanguage->compile($expression, array('a', 'B' => 'b')); - $this->assertSame('($a + $B)', $result); - } - - public function testCachingWithDifferentNamesOrder() - { - $cacheMock = $this->getMock('Psr\Cache\CacheItemPoolInterface'); - $cacheItemMock = $this->getMock('Psr\Cache\CacheItemInterface'); - $expressionLanguage = new ExpressionLanguage($cacheMock); - $savedParsedExpressions = array(); - - $cacheMock - ->expects($this->exactly(2)) - ->method('getItem') - ->with('a%20%2B%20b%2F%2Fa%7CB%3Ab') - ->willReturn($cacheItemMock) - ; - - $cacheItemMock - ->expects($this->exactly(2)) - ->method('get') - ->will($this->returnCallback(function () use (&$savedParsedExpression) { - return $savedParsedExpression; - })) - ; - - $cacheItemMock - ->expects($this->exactly(1)) - ->method('set') - ->with($this->isInstanceOf(ParsedExpression::class)) - ->will($this->returnCallback(function ($parsedExpression) use (&$savedParsedExpression) { - $savedParsedExpression = $parsedExpression; - })) - ; - - $cacheMock - ->expects($this->exactly(1)) - ->method('save') - ->with($cacheItemMock) - ; - - $expression = 'a + b'; - $expressionLanguage->compile($expression, array('a', 'B' => 'b')); - $expressionLanguage->compile($expression, array('B' => 'b', 'a')); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/ExpressionTest.php b/lib/vendor/symfony/expression-language/Tests/ExpressionTest.php deleted file mode 100644 index f28c6a9..0000000 --- a/lib/vendor/symfony/expression-language/Tests/ExpressionTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests; - -use Symfony\Component\ExpressionLanguage\Expression; - -class ExpressionTest extends \PHPUnit_Framework_TestCase -{ - public function testSerialization() - { - $expression = new Expression('kernel.boot()'); - - $serializedExpression = serialize($expression); - $unserializedExpression = unserialize($serializedExpression); - - $this->assertEquals($expression, $unserializedExpression); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php b/lib/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php deleted file mode 100644 index 8b7d819..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Fixtures; - -use Symfony\Component\ExpressionLanguage\ExpressionFunction; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -class TestProvider implements ExpressionFunctionProviderInterface -{ - public function getFunctions() - { - return array( - new ExpressionFunction('identity', function ($input) { - return $input; - }, function (array $values, $input) { - return $input; - }), - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/LexerTest.php b/lib/vendor/symfony/expression-language/Tests/LexerTest.php deleted file mode 100644 index 8af5c1c..0000000 --- a/lib/vendor/symfony/expression-language/Tests/LexerTest.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests; - -use Symfony\Component\ExpressionLanguage\Lexer; -use Symfony\Component\ExpressionLanguage\Token; -use Symfony\Component\ExpressionLanguage\TokenStream; - -class LexerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getTokenizeData - */ - public function testTokenize($tokens, $expression) - { - $tokens[] = new Token('end of expression', null, strlen($expression) + 1); - $lexer = new Lexer(); - $this->assertEquals(new TokenStream($tokens), $lexer->tokenize($expression)); - } - - public function getTokenizeData() - { - return array( - array( - array(new Token('name', 'a', 3)), - ' a ', - ), - array( - array(new Token('name', 'a', 1)), - 'a', - ), - array( - array(new Token('string', 'foo', 1)), - '"foo"', - ), - array( - array(new Token('number', '3', 1)), - '3', - ), - array( - array(new Token('operator', '+', 1)), - '+', - ), - array( - array(new Token('punctuation', '.', 1)), - '.', - ), - array( - array( - new Token('punctuation', '(', 1), - new Token('number', '3', 2), - new Token('operator', '+', 4), - new Token('number', '5', 6), - new Token('punctuation', ')', 7), - new Token('operator', '~', 9), - new Token('name', 'foo', 11), - new Token('punctuation', '(', 14), - new Token('string', 'bar', 15), - new Token('punctuation', ')', 20), - new Token('punctuation', '.', 21), - new Token('name', 'baz', 22), - new Token('punctuation', '[', 25), - new Token('number', '4', 26), - new Token('punctuation', ']', 27), - ), - '(3 + 5) ~ foo("bar").baz[4]', - ), - array( - array(new Token('operator', '..', 1)), - '..', - ), - array( - array(new Token('string', '#foo', 1)), - "'#foo'", - ), - array( - array(new Token('string', '#foo', 1)), - '"#foo"', - ), - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php deleted file mode 100644 index 4ddd10a..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Compiler; - -abstract class AbstractNodeTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getEvaluateData - */ - public function testEvaluate($expected, $node, $variables = array(), $functions = array()) - { - $this->assertSame($expected, $node->evaluate($functions, $variables)); - } - - abstract public function getEvaluateData(); - - /** - * @dataProvider getCompileData - */ - public function testCompile($expected, $node, $functions = array()) - { - $compiler = new Compiler($functions); - $node->compile($compiler); - $this->assertSame($expected, $compiler->getSource()); - } - - abstract public function getCompileData(); - - /** - * @dataProvider getDumpData - */ - public function testDump($expected, $node) - { - $this->assertSame($expected, $node->dump()); - } - - abstract public function getDumpData(); -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php deleted file mode 100644 index 60a6d1c..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\ArgumentsNode; - -class ArgumentsNodeTest extends ArrayNodeTest -{ - public function getCompileData() - { - return array( - array('"a", "b"', $this->getArrayNode()), - ); - } - - public function getDumpData() - { - return array( - array('"a", "b"', $this->getArrayNode()), - ); - } - - protected function createArrayNode() - { - return new ArgumentsNode(); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php deleted file mode 100644 index 11a35d4..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\ArrayNode; -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; - -class ArrayNodeTest extends AbstractNodeTest -{ - public function testSerialization() - { - $node = $this->createArrayNode(); - $node->addElement(new ConstantNode('foo')); - - $serializedNode = serialize($node); - $unserializedNode = unserialize($serializedNode); - - $this->assertEquals($node, $unserializedNode); - $this->assertNotEquals($this->createArrayNode(), $unserializedNode); - } - - public function getEvaluateData() - { - return array( - array(array('b' => 'a', 'b'), $this->getArrayNode()), - ); - } - - public function getCompileData() - { - return array( - array('array("b" => "a", 0 => "b")', $this->getArrayNode()), - ); - } - - public function getDumpData() - { - yield array('{"b": "a", 0: "b"}', $this->getArrayNode()); - - $array = $this->createArrayNode(); - $array->addElement(new ConstantNode('c'), new ConstantNode('a"b')); - $array->addElement(new ConstantNode('d'), new ConstantNode('a\b')); - yield array('{"a\\"b": "c", "a\\\\b": "d"}', $array); - - $array = $this->createArrayNode(); - $array->addElement(new ConstantNode('c')); - $array->addElement(new ConstantNode('d')); - yield array('["c", "d"]', $array); - } - - protected function getArrayNode() - { - $array = $this->createArrayNode(); - $array->addElement(new ConstantNode('a'), new ConstantNode('b')); - $array->addElement(new ConstantNode('b')); - - return $array; - } - - protected function createArrayNode() - { - return new ArrayNode(); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php deleted file mode 100644 index 258d276..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php +++ /dev/null @@ -1,166 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\BinaryNode; -use Symfony\Component\ExpressionLanguage\Node\ArrayNode; -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; - -class BinaryNodeTest extends AbstractNodeTest -{ - public function getEvaluateData() - { - $array = new ArrayNode(); - $array->addElement(new ConstantNode('a')); - $array->addElement(new ConstantNode('b')); - - return array( - array(true, new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))), - array(true, new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))), - array(false, new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))), - array(false, new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))), - - array(0, new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))), - array(6, new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))), - array(6, new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))), - - array(true, new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))), - array(true, new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))), - array(true, new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))), - - array(false, new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))), - array(false, new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))), - array(true, new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))), - - array(true, new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))), - array(false, new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))), - - array(false, new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))), - array(true, new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))), - - array(-1, new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))), - array(3, new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))), - array(4, new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))), - array(1, new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))), - array(1, new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))), - array(25, new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))), - array('ab', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))), - - array(true, new BinaryNode('in', new ConstantNode('a'), $array)), - array(false, new BinaryNode('in', new ConstantNode('c'), $array)), - array(true, new BinaryNode('not in', new ConstantNode('c'), $array)), - array(false, new BinaryNode('not in', new ConstantNode('a'), $array)), - - array(array(1, 2, 3), new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))), - - array(1, new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+$/'))), - ); - } - - public function getCompileData() - { - $array = new ArrayNode(); - $array->addElement(new ConstantNode('a')); - $array->addElement(new ConstantNode('b')); - - return array( - array('(true || false)', new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))), - array('(true || false)', new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))), - array('(true && false)', new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))), - array('(true && false)', new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))), - - array('(2 & 4)', new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))), - array('(2 | 4)', new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))), - array('(2 ^ 4)', new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))), - - array('(1 < 2)', new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))), - array('(1 <= 2)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))), - array('(1 <= 1)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))), - - array('(1 > 2)', new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))), - array('(1 >= 2)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))), - array('(1 >= 1)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))), - - array('(true === true)', new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))), - array('(true !== true)', new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))), - - array('(2 == 1)', new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))), - array('(2 != 1)', new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))), - - array('(1 - 2)', new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))), - array('(1 + 2)', new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))), - array('(2 * 2)', new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))), - array('(2 / 2)', new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))), - array('(5 % 2)', new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))), - array('pow(5, 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))), - array('("a" . "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))), - - array('in_array("a", array(0 => "a", 1 => "b"))', new BinaryNode('in', new ConstantNode('a'), $array)), - array('in_array("c", array(0 => "a", 1 => "b"))', new BinaryNode('in', new ConstantNode('c'), $array)), - array('!in_array("c", array(0 => "a", 1 => "b"))', new BinaryNode('not in', new ConstantNode('c'), $array)), - array('!in_array("a", array(0 => "a", 1 => "b"))', new BinaryNode('not in', new ConstantNode('a'), $array)), - - array('range(1, 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))), - - array('preg_match("/^[a-z]+/i\$/", "abc")', new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+/i$/'))), - ); - } - - public function getDumpData() - { - $array = new ArrayNode(); - $array->addElement(new ConstantNode('a')); - $array->addElement(new ConstantNode('b')); - - return array( - array('(true or false)', new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))), - array('(true || false)', new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))), - array('(true and false)', new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))), - array('(true && false)', new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))), - - array('(2 & 4)', new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))), - array('(2 | 4)', new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))), - array('(2 ^ 4)', new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))), - - array('(1 < 2)', new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))), - array('(1 <= 2)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))), - array('(1 <= 1)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))), - - array('(1 > 2)', new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))), - array('(1 >= 2)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))), - array('(1 >= 1)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))), - - array('(true === true)', new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))), - array('(true !== true)', new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))), - - array('(2 == 1)', new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))), - array('(2 != 1)', new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))), - - array('(1 - 2)', new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))), - array('(1 + 2)', new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))), - array('(2 * 2)', new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))), - array('(2 / 2)', new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))), - array('(5 % 2)', new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))), - array('(5 ** 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))), - array('("a" ~ "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))), - - array('("a" in ["a", "b"])', new BinaryNode('in', new ConstantNode('a'), $array)), - array('("c" in ["a", "b"])', new BinaryNode('in', new ConstantNode('c'), $array)), - array('("c" not in ["a", "b"])', new BinaryNode('not in', new ConstantNode('c'), $array)), - array('("a" not in ["a", "b"])', new BinaryNode('not in', new ConstantNode('a'), $array)), - - array('(1 .. 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))), - - array('("abc" matches "/^[a-z]+/i$/")', new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+/i$/'))), - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php deleted file mode 100644 index cbf9e8d..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\ConditionalNode; -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; - -class ConditionalNodeTest extends AbstractNodeTest -{ - public function getEvaluateData() - { - return array( - array(1, new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))), - array(2, new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))), - ); - } - - public function getCompileData() - { - return array( - array('((true) ? (1) : (2))', new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))), - array('((false) ? (1) : (2))', new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))), - ); - } - - public function getDumpData() - { - return array( - array('(true ? 1 : 2)', new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))), - array('(false ? 1 : 2)', new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))), - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php deleted file mode 100644 index af79a91..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; - -class ConstantNodeTest extends AbstractNodeTest -{ - public function getEvaluateData() - { - return array( - array(false, new ConstantNode(false)), - array(true, new ConstantNode(true)), - array(null, new ConstantNode(null)), - array(3, new ConstantNode(3)), - array(3.3, new ConstantNode(3.3)), - array('foo', new ConstantNode('foo')), - array(array(1, 'b' => 'a'), new ConstantNode(array(1, 'b' => 'a'))), - ); - } - - public function getCompileData() - { - return array( - array('false', new ConstantNode(false)), - array('true', new ConstantNode(true)), - array('null', new ConstantNode(null)), - array('3', new ConstantNode(3)), - array('3.3', new ConstantNode(3.3)), - array('"foo"', new ConstantNode('foo')), - array('array(0 => 1, "b" => "a")', new ConstantNode(array(1, 'b' => 'a'))), - ); - } - - public function getDumpData() - { - return array( - array('false', new ConstantNode(false)), - array('true', new ConstantNode(true)), - array('null', new ConstantNode(null)), - array('3', new ConstantNode(3)), - array('3.3', new ConstantNode(3.3)), - array('"foo"', new ConstantNode('foo')), - array('foo', new ConstantNode('foo', true)), - array('{0: 1, "b": "a", 1: true}', new ConstantNode(array(1, 'b' => 'a', true))), - array('{"a\\"b": "c", "a\\\\b": "d"}', new ConstantNode(array('a"b' => 'c', 'a\\b' => 'd'))), - array('["c", "d"]', new ConstantNode(array('c', 'd'))), - array('{"a": ["b"]}', new ConstantNode(array('a' => array('b')))), - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php deleted file mode 100644 index 8d6f92a..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\FunctionNode; -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; -use Symfony\Component\ExpressionLanguage\Node\Node; - -class FunctionNodeTest extends AbstractNodeTest -{ - public function getEvaluateData() - { - return array( - array('bar', new FunctionNode('foo', new Node(array(new ConstantNode('bar')))), array(), array('foo' => $this->getCallables())), - ); - } - - public function getCompileData() - { - return array( - array('foo("bar")', new FunctionNode('foo', new Node(array(new ConstantNode('bar')))), array('foo' => $this->getCallables())), - ); - } - - public function getDumpData() - { - return array( - array('foo("bar")', new FunctionNode('foo', new Node(array(new ConstantNode('bar')))), array('foo' => $this->getCallables())), - ); - } - - protected function getCallables() - { - return array( - 'compiler' => function ($arg) { - return sprintf('foo(%s)', $arg); - }, - 'evaluator' => function ($variables, $arg) { - return $arg; - }, - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php deleted file mode 100644 index cf7cd7a..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\ArrayNode; -use Symfony\Component\ExpressionLanguage\Node\NameNode; -use Symfony\Component\ExpressionLanguage\Node\GetAttrNode; -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; - -class GetAttrNodeTest extends AbstractNodeTest -{ - public function getEvaluateData() - { - return array( - array('b', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), array('foo' => array('b' => 'a', 'b'))), - array('a', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), array('foo' => array('b' => 'a', 'b'))), - - array('bar', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), array('foo' => new Obj())), - - array('baz', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), array('foo' => new Obj())), - array('a', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), array('foo' => array('b' => 'a', 'b'), 'index' => 'b')), - ); - } - - public function getCompileData() - { - return array( - array('$foo[0]', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - array('$foo["b"]', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - - array('$foo->foo', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), array('foo' => new Obj())), - - array('$foo->foo(array("b" => "a", 0 => "b"))', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), array('foo' => new Obj())), - array('$foo[$index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - ); - } - - public function getDumpData() - { - return array( - array('foo[0]', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - array('foo["b"]', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - - array('foo.foo', new GetAttrNode(new NameNode('foo'), new NameNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), array('foo' => new Obj())), - - array('foo.foo({"b": "a", 0: "b"})', new GetAttrNode(new NameNode('foo'), new NameNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), array('foo' => new Obj())), - array('foo[index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - ); - } - - protected function getArrayNode() - { - $array = new ArrayNode(); - $array->addElement(new ConstantNode('a'), new ConstantNode('b')); - $array->addElement(new ConstantNode('b')); - - return $array; - } -} - -class Obj -{ - public $foo = 'bar'; - - public function foo() - { - return 'baz'; - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php deleted file mode 100644 index 5fa2c37..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\NameNode; - -class NameNodeTest extends AbstractNodeTest -{ - public function getEvaluateData() - { - return array( - array('bar', new NameNode('foo'), array('foo' => 'bar')), - ); - } - - public function getCompileData() - { - return array( - array('$foo', new NameNode('foo')), - ); - } - - public function getDumpData() - { - return array( - array('foo', new NameNode('foo')), - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/NodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/NodeTest.php deleted file mode 100644 index 6901329..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/NodeTest.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\Node; -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; - -class NodeTest extends \PHPUnit_Framework_TestCase -{ - public function testToString() - { - $node = new Node(array(new ConstantNode('foo'))); - - $this->assertEquals(<<<'EOF' -Node( - ConstantNode(value: 'foo') -) -EOF - , (string) $node); - } - - public function testSerialization() - { - $node = new Node(array('foo' => 'bar'), array('bar' => 'foo')); - - $serializedNode = serialize($node); - $unserializedNode = unserialize($serializedNode); - - $this->assertEquals($node, $unserializedNode); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php b/lib/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php deleted file mode 100644 index ae2e3ee..0000000 --- a/lib/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests\Node; - -use Symfony\Component\ExpressionLanguage\Node\UnaryNode; -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; - -class UnaryNodeTest extends AbstractNodeTest -{ - public function getEvaluateData() - { - return array( - array(-1, new UnaryNode('-', new ConstantNode(1))), - array(3, new UnaryNode('+', new ConstantNode(3))), - array(false, new UnaryNode('!', new ConstantNode(true))), - array(false, new UnaryNode('not', new ConstantNode(true))), - ); - } - - public function getCompileData() - { - return array( - array('(-1)', new UnaryNode('-', new ConstantNode(1))), - array('(+3)', new UnaryNode('+', new ConstantNode(3))), - array('(!true)', new UnaryNode('!', new ConstantNode(true))), - array('(!true)', new UnaryNode('not', new ConstantNode(true))), - ); - } - - public function getDumpData() - { - return array( - array('(- 1)', new UnaryNode('-', new ConstantNode(1))), - array('(+ 3)', new UnaryNode('+', new ConstantNode(3))), - array('(! true)', new UnaryNode('!', new ConstantNode(true))), - array('(not true)', new UnaryNode('not', new ConstantNode(true))), - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/ParsedExpressionTest.php b/lib/vendor/symfony/expression-language/Tests/ParsedExpressionTest.php deleted file mode 100644 index 18bde02..0000000 --- a/lib/vendor/symfony/expression-language/Tests/ParsedExpressionTest.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests; - -use Symfony\Component\ExpressionLanguage\Node\ConstantNode; -use Symfony\Component\ExpressionLanguage\ParsedExpression; - -class ParsedExpressionTest extends \PHPUnit_Framework_TestCase -{ - public function testSerialization() - { - $expression = new ParsedExpression('25', new ConstantNode('25')); - - $serializedExpression = serialize($expression); - $unserializedExpression = unserialize($serializedExpression); - - $this->assertEquals($expression, $unserializedExpression); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/ParserCache/ParserCacheAdapterTest.php b/lib/vendor/symfony/expression-language/Tests/ParserCache/ParserCacheAdapterTest.php deleted file mode 100644 index 5c15c32..0000000 --- a/lib/vendor/symfony/expression-language/Tests/ParserCache/ParserCacheAdapterTest.php +++ /dev/null @@ -1,139 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests; - -use Symfony\Component\ExpressionLanguage\ParsedExpression; -use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheAdapter; -use Symfony\Component\ExpressionLanguage\Node\Node; - -/** - * @group legacy - */ -class ParserCacheAdapterTest extends \PHPUnit_Framework_TestCase -{ - public function testGetItem() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - - $key = 'key'; - $value = 'value'; - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - - $poolMock - ->expects($this->once()) - ->method('fetch') - ->with($key) - ->willReturn($value) - ; - - $cacheItem = $parserCacheAdapter->getItem($key); - - $this->assertEquals($cacheItem->get(), $value); - $this->assertEquals($cacheItem->isHit(), true); - } - - public function testSave() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - $cacheItemMock = $this->getMock('Psr\Cache\CacheItemInterface'); - $key = 'key'; - $value = new ParsedExpression('1 + 1', new Node(array(), array())); - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - - $poolMock - ->expects($this->once()) - ->method('save') - ->with($key, $value) - ; - - $cacheItemMock - ->expects($this->once()) - ->method('getKey') - ->willReturn($key) - ; - - $cacheItemMock - ->expects($this->once()) - ->method('get') - ->willReturn($value) - ; - - $cacheItem = $parserCacheAdapter->save($cacheItemMock); - } - - public function testGetItems() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - $this->setExpectedException(\BadMethodCallException::class); - - $parserCacheAdapter->getItems(); - } - - public function testHasItem() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - $key = 'key'; - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - $this->setExpectedException(\BadMethodCallException::class); - - $parserCacheAdapter->hasItem($key); - } - - public function testClear() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - $this->setExpectedException(\BadMethodCallException::class); - - $parserCacheAdapter->clear(); - } - - public function testDeleteItem() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - $key = 'key'; - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - $this->setExpectedException(\BadMethodCallException::class); - - $parserCacheAdapter->deleteItem($key); - } - - public function testDeleteItems() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - $keys = array('key'); - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - $this->setExpectedException(\BadMethodCallException::class); - - $parserCacheAdapter->deleteItems($keys); - } - - public function testSaveDeferred() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - $cacheItemMock = $this->getMock('Psr\Cache\CacheItemInterface'); - $this->setExpectedException(\BadMethodCallException::class); - - $parserCacheAdapter->saveDeferred($cacheItemMock); - } - - public function testCommit() - { - $poolMock = $this->getMock('Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface'); - $parserCacheAdapter = new ParserCacheAdapter($poolMock); - $this->setExpectedException(\BadMethodCallException::class); - - $parserCacheAdapter->commit(); - } -} diff --git a/lib/vendor/symfony/expression-language/Tests/ParserTest.php b/lib/vendor/symfony/expression-language/Tests/ParserTest.php deleted file mode 100644 index ae9b291..0000000 --- a/lib/vendor/symfony/expression-language/Tests/ParserTest.php +++ /dev/null @@ -1,197 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage\Tests; - -use Symfony\Component\ExpressionLanguage\Parser; -use Symfony\Component\ExpressionLanguage\Lexer; -use Symfony\Component\ExpressionLanguage\Node; - -class ParserTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError - * @expectedExceptionMessage Variable "foo" is not valid around position 1. - */ - public function testParseWithInvalidName() - { - $lexer = new Lexer(); - $parser = new Parser(array()); - $parser->parse($lexer->tokenize('foo')); - } - - /** - * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError - * @expectedExceptionMessage Variable "foo" is not valid around position 1. - */ - public function testParseWithZeroInNames() - { - $lexer = new Lexer(); - $parser = new Parser(array()); - $parser->parse($lexer->tokenize('foo'), array(0)); - } - - /** - * @dataProvider getParseData - */ - public function testParse($node, $expression, $names = array()) - { - $lexer = new Lexer(); - $parser = new Parser(array()); - $this->assertEquals($node, $parser->parse($lexer->tokenize($expression), $names)); - } - - public function getParseData() - { - $arguments = new Node\ArgumentsNode(); - $arguments->addElement(new Node\ConstantNode('arg1')); - $arguments->addElement(new Node\ConstantNode(2)); - $arguments->addElement(new Node\ConstantNode(true)); - - return array( - array( - new Node\NameNode('a'), - 'a', - array('a'), - ), - array( - new Node\ConstantNode('a'), - '"a"', - ), - array( - new Node\ConstantNode(3), - '3', - ), - array( - new Node\ConstantNode(false), - 'false', - ), - array( - new Node\ConstantNode(true), - 'true', - ), - array( - new Node\ConstantNode(null), - 'null', - ), - array( - new Node\UnaryNode('-', new Node\ConstantNode(3)), - '-3', - ), - array( - new Node\BinaryNode('-', new Node\ConstantNode(3), new Node\ConstantNode(3)), - '3 - 3', - ), - array( - new Node\BinaryNode('*', - new Node\BinaryNode('-', new Node\ConstantNode(3), new Node\ConstantNode(3)), - new Node\ConstantNode(2) - ), - '(3 - 3) * 2', - ), - array( - new Node\GetAttrNode(new Node\NameNode('foo'), new Node\ConstantNode('bar', true), new Node\ArgumentsNode(), Node\GetAttrNode::PROPERTY_CALL), - 'foo.bar', - array('foo'), - ), - array( - new Node\GetAttrNode(new Node\NameNode('foo'), new Node\ConstantNode('bar', true), new Node\ArgumentsNode(), Node\GetAttrNode::METHOD_CALL), - 'foo.bar()', - array('foo'), - ), - array( - new Node\GetAttrNode(new Node\NameNode('foo'), new Node\ConstantNode('not', true), new Node\ArgumentsNode(), Node\GetAttrNode::METHOD_CALL), - 'foo.not()', - array('foo'), - ), - array( - new Node\GetAttrNode( - new Node\NameNode('foo'), - new Node\ConstantNode('bar', true), - $arguments, - Node\GetAttrNode::METHOD_CALL - ), - 'foo.bar("arg1", 2, true)', - array('foo'), - ), - array( - new Node\GetAttrNode(new Node\NameNode('foo'), new Node\ConstantNode(3), new Node\ArgumentsNode(), Node\GetAttrNode::ARRAY_CALL), - 'foo[3]', - array('foo'), - ), - array( - new Node\ConditionalNode(new Node\ConstantNode(true), new Node\ConstantNode(true), new Node\ConstantNode(false)), - 'true ? true : false', - ), - array( - new Node\BinaryNode('matches', new Node\ConstantNode('foo'), new Node\ConstantNode('/foo/')), - '"foo" matches "/foo/"', - ), - - // chained calls - array( - $this->createGetAttrNode( - $this->createGetAttrNode( - $this->createGetAttrNode( - $this->createGetAttrNode(new Node\NameNode('foo'), 'bar', Node\GetAttrNode::METHOD_CALL), - 'foo', Node\GetAttrNode::METHOD_CALL), - 'baz', Node\GetAttrNode::PROPERTY_CALL), - '3', Node\GetAttrNode::ARRAY_CALL), - 'foo.bar().foo().baz[3]', - array('foo'), - ), - - array( - new Node\NameNode('foo'), - 'bar', - array('foo' => 'bar'), - ), - ); - } - - private function createGetAttrNode($node, $item, $type) - { - return new Node\GetAttrNode($node, new Node\ConstantNode($item, Node\GetAttrNode::ARRAY_CALL !== $type), new Node\ArgumentsNode(), $type); - } - - /** - * @dataProvider getInvalidPostfixData - * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError - */ - public function testParseWithInvalidPostfixData($expr, $names = array()) - { - $lexer = new Lexer(); - $parser = new Parser(array()); - $parser->parse($lexer->tokenize($expr), $names); - } - - public function getInvalidPostfixData() - { - return array( - array( - 'foo."#"', - array('foo'), - ), - array( - 'foo."bar"', - array('foo'), - ), - array( - 'foo.**', - array('foo'), - ), - array( - 'foo.123', - array('foo'), - ), - ); - } -} diff --git a/lib/vendor/symfony/expression-language/Token.php b/lib/vendor/symfony/expression-language/Token.php deleted file mode 100644 index bb83d50..0000000 --- a/lib/vendor/symfony/expression-language/Token.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * Represents a Token. - * - * @author Fabien Potencier - */ -class Token -{ - public $value; - public $type; - public $cursor; - - const EOF_TYPE = 'end of expression'; - const NAME_TYPE = 'name'; - const NUMBER_TYPE = 'number'; - const STRING_TYPE = 'string'; - const OPERATOR_TYPE = 'operator'; - const PUNCTUATION_TYPE = 'punctuation'; - - /** - * Constructor. - * - * @param int $type The type of the token - * @param string $value The token value - * @param int $cursor The cursor position in the source - */ - public function __construct($type, $value, $cursor) - { - $this->type = $type; - $this->value = $value; - $this->cursor = $cursor; - } - - /** - * Returns a string representation of the token. - * - * @return string A string representation of the token - */ - public function __toString() - { - return sprintf('%3d %-11s %s', $this->cursor, strtoupper($this->type), $this->value); - } - - /** - * Tests the current token for a type and/or a value. - * - * @param array|int $type The type to test - * @param string|null $value The token value - * - * @return bool - */ - public function test($type, $value = null) - { - return $this->type === $type && (null === $value || $this->value == $value); - } -} diff --git a/lib/vendor/symfony/expression-language/TokenStream.php b/lib/vendor/symfony/expression-language/TokenStream.php deleted file mode 100644 index 6c4af74..0000000 --- a/lib/vendor/symfony/expression-language/TokenStream.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ExpressionLanguage; - -/** - * Represents a token stream. - * - * @author Fabien Potencier - */ -class TokenStream -{ - public $current; - - private $tokens; - private $position = 0; - - /** - * Constructor. - * - * @param array $tokens An array of tokens - */ - public function __construct(array $tokens) - { - $this->tokens = $tokens; - $this->current = $tokens[0]; - } - - /** - * Returns a string representation of the token stream. - * - * @return string - */ - public function __toString() - { - return implode("\n", $this->tokens); - } - - /** - * Sets the pointer to the next token and returns the old one. - */ - public function next() - { - if (!isset($this->tokens[$this->position])) { - throw new SyntaxError('Unexpected end of expression', $this->current->cursor); - } - - ++$this->position; - - $this->current = $this->tokens[$this->position]; - } - - /** - * Tests a token. - * - * @param array|int $type The type to test - * @param string|null $value The token value - * @param string|null $message The syntax error message - */ - public function expect($type, $value = null, $message = null) - { - $token = $this->current; - if (!$token->test($type, $value)) { - throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s)', $message ? $message.'. ' : '', $token->type, $token->value, $type, $value ? sprintf(' with value "%s"', $value) : ''), $token->cursor); - } - $this->next(); - } - - /** - * Checks if end of stream was reached. - * - * @return bool - */ - public function isEOF() - { - return $this->current->type === Token::EOF_TYPE; - } -} diff --git a/lib/vendor/symfony/expression-language/composer.json b/lib/vendor/symfony/expression-language/composer.json deleted file mode 100644 index fc7e3c3..0000000 --- a/lib/vendor/symfony/expression-language/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "symfony/expression-language", - "type": "library", - "description": "Symfony ExpressionLanguage Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.5.9", - "symfony/cache": "~3.1" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\ExpressionLanguage\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - } -} diff --git a/lib/vendor/symfony/expression-language/phpunit.xml.dist b/lib/vendor/symfony/expression-language/phpunit.xml.dist deleted file mode 100644 index 1837706..0000000 --- a/lib/vendor/symfony/expression-language/phpunit.xml.dist +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - ./vendor - - - -