diff --git a/core/composer.json b/core/composer.json new file mode 100644 index 0000000..213e68a --- /dev/null +++ b/core/composer.json @@ -0,0 +1,14 @@ +{ + "require": { + "symfony/event-dispatcher": "2.1.x-dev", + "symfony/http-foundation": "2.1.x-dev", + "symfony/http-kernel": "2.1.x-dev", + "symfony/routing": "2.1.x-dev" + }, + "autoload": { + "psr-0": { + "Drupal\\Core": "lib/", + "Drupal\\Component": "lib/" + } + } +} diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 2664a42..6dea8bb 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2133,23 +2133,7 @@ function _drupal_bootstrap_configuration() { drupal_settings_initialize(); // Include and activate the class loader. - $loader = drupal_classloader(); - - // Register explicit vendor namespaces. - $loader->registerNamespaces(array( - // All Symfony-borrowed code lives in /core/vendor/Symfony. - 'Symfony' => DRUPAL_ROOT . '/core/vendor', - )); - // Register the Drupal namespace for classes in core as a fallback. - // This allows to register additional namespaces within the Drupal namespace - // (e.g., for modules) and avoids an additional file_exists() on the Drupal - // core namespace, since the class loader can already determine the best - // namespace match based on a string comparison. It further allows modules to - // register/overload namespaces in Drupal core. - $loader->registerNamespaceFallbacks(array( - // All Drupal-namespaced code in core lives in /core/lib/Drupal. - 'Drupal' => DRUPAL_ROOT . '/core/lib', - )); + drupal_classloader(); } /** @@ -2857,41 +2841,33 @@ function drupal_get_complete_schema($rebuild = FALSE) { * Initializes and returns the class loader. * * The class loader is responsible for lazy-loading all PSR-0 compatible - * classes, interfaces, and traits (PHP 5.4 and later). Its only dependencies - * are DRUPAL_ROOT and variable_get(). Otherwise it may be called as early as - * possible. + * classes, interfaces, and traits (PHP 5.4 and later). Its only dependency is + * DRUPAL_ROOT, otherwise it may be called as early as possible. Calling this + * function will register Drupal\Core, Drupal\Components and Symfony's provided + * components. * - * @return Symfony\Component\ClassLoader\UniversalClassLoader - * A UniversalClassLoader class instance (or extension thereof). + * Example: + * @code + * // Register MyModule's PSR-0 class namespace. + * $loader = drupal_classloader(); + * $path = drupal_get_path('module', 'mymodule') . '/lib/'; + * $loader->add("Drupal\\MyModule", $path); + * @endcode + * + * @return Composer\Autoload\ClassLoader + * Returns the ClassLoader object that was used to register the initial + * namespaces. This allows registration of additional namespaces later on. */ function drupal_classloader() { - // Include the Symfony ClassLoader for loading PSR-0-compatible classes. - require_once DRUPAL_ROOT . '/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php'; - - // By default, use the UniversalClassLoader which is best for development, - // as it does not break when code is moved on the file system. However, as it - // is slow, allow to use the APC class loader in production. static $loader; if (!isset($loader)) { - // @todo Use a cleaner way than variable_get() to switch autoloaders. - switch (variable_get('autoloader_mode', 'default')) { - case 'apc': - if (function_exists('apc_store')) { - require_once DRUPAL_ROOT . '/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; - $loader = new ApcUniversalClassLoader('drupal.' . $GLOBALS['drupal_hash_salt']); - break; - } - // Fall through to the default loader if APC was not loaded, so that the - // site does not fail completely. - case 'dev': - case 'default': - default: - $loader = new UniversalClassLoader(); - break; - } - $loader->register(); + // Drupal Core's classes are auto-loaded by autoload.php. The ClassLoader + // instance used to register the initial namespaces is returned. This file + // is auto-generated by Composer during the build process of composer.json. + $loader = require DRUPAL_ROOT . '/core/vendor/.composer/autoload.php'; } + return $loader; } diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 493246c..707ba50 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -229,23 +229,7 @@ function install_begin_request(&$install_state) { // Ensure that the class loader is available so that we can leverage classes // as part of the install routine. - $loader = drupal_classloader(); - - // Register explicit vendor namespaces. - $loader->registerNamespaces(array( - // All Symfony-borrowed code lives in /core/includes/Symfony. - 'Symfony' => DRUPAL_ROOT . '/core/vendor', - )); - // Register the Drupal namespace for classes in core as a fallback. - // This allows to register additional namespaces within the Drupal namespace - // (e.g., for modules) and avoids an additional file_exists() on the Drupal - // core namespace, since the class loader can already determine the best - // namespace match based on a string comparison. It further allows modules to - // register/overload namespaces in Drupal core. - $loader->registerNamespaceFallbacks(array( - // All Drupal-namespaced code in core lives in /core/includes/Drupal. - 'Drupal' => DRUPAL_ROOT . '/core/lib', - )); + drupal_classloader(); if (!$install_state['interactive']) { drupal_override_server_variables($install_state['server']); diff --git a/core/vendor/.composer/ClassLoader.php b/core/vendor/.composer/ClassLoader.php new file mode 100644 index 0000000..94fc76a --- /dev/null +++ b/core/vendor/.composer/ClassLoader.php @@ -0,0 +1,203 @@ + + * 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 an PSR-0 class loader + * + * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md + * + * $loader = new ComposerClassLoader(); + * + * // 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 + */ +class ClassLoader +{ + private $prefixes = array(); + private $fallbackDirs = array(); + private $useIncludePath = false; + private $classMap = array(); + + public function getPrefixes() + { + return $this->prefixes; + } + + public function getFallbackDirs() + { + return $this->fallbackDirs; + } + + 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 classes + * + * @param string $prefix The classes prefix + * @param array|string $paths The location(s) of the classes + */ + public function add($prefix, $paths) + { + if (!$prefix) { + foreach ((array) $paths as $path) { + $this->fallbackDirs[] = $path; + } + return; + } + if (isset($this->prefixes[$prefix])) { + $this->prefixes[$prefix] = array_merge( + $this->prefixes[$prefix], + (array) $paths + ); + } else { + $this->prefixes[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include for class files. + * + * @param Boolean $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 Boolean + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Registers this instance as an autoloader. + * + * @param Boolean $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 Boolean|null True, if loaded + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + require $file; + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|null The path, if found + */ + public function findFile($class) + { + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR; + $className = substr($class, $pos + 1); + } else { + // PEAR-like class name + $classPath = null; + $className = $class; + } + + $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + + foreach ($this->prefixes as $prefix => $dirs) { + foreach ($dirs as $dir) { + if (0 === strpos($class, $prefix)) { + if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { + return $dir . DIRECTORY_SEPARATOR . $classPath; + } + } + } + } + + foreach ($this->fallbackDirs as $dir) { + if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { + return $dir . DIRECTORY_SEPARATOR . $classPath; + } + } + + if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) { + return $file; + } + } +} diff --git a/core/vendor/.composer/autoload.php b/core/vendor/.composer/autoload.php new file mode 100644 index 0000000..1427f02 --- /dev/null +++ b/core/vendor/.composer/autoload.php @@ -0,0 +1,25 @@ + $path) { + $loader->add($namespace, $path); + } + + $classMap = require __DIR__.'/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + + $loader->register(); + + return $loader; +}); diff --git a/core/vendor/.composer/autoload_classmap.php b/core/vendor/.composer/autoload_classmap.php new file mode 100644 index 0000000..4a9177d --- /dev/null +++ b/core/vendor/.composer/autoload_classmap.php @@ -0,0 +1,9 @@ + $vendorDir . '/symfony/routing/', + 'Symfony\\Component\\HttpKernel' => $vendorDir . '/symfony/http-kernel/', + 'Symfony\\Component\\HttpFoundation' => $vendorDir . '/symfony/http-foundation/', + 'Symfony\\Component\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/', + 'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stub', + 'Drupal\\Core' => $baseDir . '/lib/', + 'Drupal\\Component' => $baseDir . '/lib/', +); diff --git a/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php b/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php deleted file mode 100644 index 1295d0a..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.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\ClassLoader; - -/** - * ApcUniversalClassLoader implements a "universal" autoloader cached in APC for PHP 5.3. - * - * It is able to load classes that use either: - * - * * The technical interoperability standards for PHP 5.3 namespaces and - * class names (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md); - * - * * The PEAR naming convention for classes (http://pear.php.net/). - * - * Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be - * looked for in a list of locations to ease the vendoring of a sub-set of - * classes for large projects. - * - * Example usage: - * - * require 'vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; - * require 'vendor/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; - * - * use Symfony\Component\ClassLoader\ApcUniversalClassLoader; - * - * $loader = new ApcUniversalClassLoader('apc.prefix.'); - * - * // register classes with namespaces - * $loader->registerNamespaces(array( - * 'Symfony\Component' => __DIR__.'/component', - * 'Symfony' => __DIR__.'/framework', - * 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'), - * )); - * - * // register a library using the PEAR naming convention - * $loader->registerPrefixes(array( - * 'Swift_' => __DIR__.'/Swift', - * )); - * - * // activate the autoloader - * $loader->register(); - * - * 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. - * - * @author Fabien Potencier - * @author Kris Wallsmith - * - * @api - */ -class ApcUniversalClassLoader extends UniversalClassLoader -{ - private $prefix; - - /** - * Constructor. - * - * @param string $prefix A prefix to create a namespace in APC - * - * @api - */ - public function __construct($prefix) - { - if (!extension_loaded('apc')) { - throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.'); - } - - $this->prefix = $prefix; - } - - /** - * Finds a file by class name while caching lookups to APC. - * - * @param string $class A class name to resolve to file - */ - public function findFile($class) - { - if (false === $file = apc_fetch($this->prefix.$class)) { - apc_store($this->prefix.$class, $file = parent::findFile($class)); - } - - return $file; - } -} diff --git a/core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php deleted file mode 100644 index da777f2..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ /dev/null @@ -1,222 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ClassLoader; - -/** - * ClassCollectionLoader. - * - * @author Fabien Potencier - */ -class ClassCollectionLoader -{ - static private $loaded; - - /** - * Loads a list of classes and caches them in one big file. - * - * @param array $classes An array of classes to load - * @param string $cacheDir A cache directory - * @param string $name The cache name prefix - * @param Boolean $autoReload Whether to flush the cache when the cache is stale or not - * @param Boolean $adaptive Whether to remove already declared classes or not - * @param string $extension File extension of the resulting file - * - * @throws \InvalidArgumentException When class can't be loaded - */ - static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php') - { - // each $name can only be loaded once per PHP process - if (isset(self::$loaded[$name])) { - return; - } - - self::$loaded[$name] = true; - - if ($adaptive) { - // don't include already declared classes - $classes = array_diff($classes, get_declared_classes(), get_declared_interfaces()); - - // the cache is different depending on which classes are already declared - $name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5); - } - - $cache = $cacheDir.'/'.$name.$extension; - - // auto-reload - $reload = false; - if ($autoReload) { - $metadata = $cacheDir.'/'.$name.$extension.'.meta'; - if (!file_exists($metadata) || !file_exists($cache)) { - $reload = true; - } else { - $time = filemtime($cache); - $meta = unserialize(file_get_contents($metadata)); - - if ($meta[1] != $classes) { - $reload = true; - } else { - foreach ($meta[0] as $resource) { - if (!file_exists($resource) || filemtime($resource) > $time) { - $reload = true; - - break; - } - } - } - } - } - - if (!$reload && file_exists($cache)) { - require_once $cache; - - return; - } - - $files = array(); - $content = ''; - foreach ($classes as $class) { - if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) { - throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); - } - - $r = new \ReflectionClass($class); - $files[] = $r->getFileName(); - - $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName())); - - // add namespace declaration for global code - if (!$r->inNamespace()) { - $c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n"; - } else { - $c = self::fixNamespaceDeclarations(' - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ClassLoader; - -/** - * Checks that the class is actually declared in the included file. - * - * @author Fabien Potencier - */ -class DebugUniversalClassLoader extends UniversalClassLoader -{ - /** - * Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones. - */ - static public function enable() - { - if (!is_array($functions = spl_autoload_functions())) { - return; - } - - foreach ($functions as $function) { - spl_autoload_unregister($function); - } - - foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof UniversalClassLoader) { - $loader = new static(); - $loader->registerNamespaceFallbacks($function[0]->getNamespaceFallbacks()); - $loader->registerPrefixFallbacks($function[0]->getPrefixFallbacks()); - $loader->registerNamespaces($function[0]->getNamespaces()); - $loader->registerPrefixes($function[0]->getPrefixes()); - - $function[0] = $loader; - } - - spl_autoload_register($function); - } - } - - /** - * {@inheritDoc} - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - require $file; - - if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) { - throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); - } - } - } -} diff --git a/core/vendor/Symfony/Component/ClassLoader/LICENSE b/core/vendor/Symfony/Component/ClassLoader/LICENSE deleted file mode 100644 index 89df448..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2011 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/core/vendor/Symfony/Component/ClassLoader/MapClassLoader.php b/core/vendor/Symfony/Component/ClassLoader/MapClassLoader.php deleted file mode 100644 index cf17d42..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/MapClassLoader.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\ClassLoader; - -/** - * A class loader that uses a mapping file to look up paths. - * - * @author Fabien Potencier - */ -class MapClassLoader -{ - private $map = array(); - - /** - * Constructor. - * - * @param array $map A map where keys are classes and values the absolute file path - */ - public function __construct(array $map) - { - $this->map = $map; - } - - /** - * Registers this instance as an autoloader. - * - * @param Boolean $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - */ - public function loadClass($class) - { - if ('\\' === $class[0]) { - $class = substr($class, 1); - } - - if (isset($this->map[$class])) { - require $this->map[$class]; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|null The path, if found - */ - public function findFile($class) - { - if ('\\' === $class[0]) { - $class = substr($class, 1); - } - - if (isset($this->map[$class])) { - return $this->map[$class]; - } - } -} diff --git a/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php b/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php deleted file mode 100644 index babf950..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php +++ /dev/null @@ -1,265 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\ClassLoader; - -/** - * UniversalClassLoader implements a "universal" autoloader for PHP 5.3. - * - * It is able to load classes that use either: - * - * * The technical interoperability standards for PHP 5.3 namespaces and - * class names (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md); - * - * * The PEAR naming convention for classes (http://pear.php.net/). - * - * Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be - * looked for in a list of locations to ease the vendoring of a sub-set of - * classes for large projects. - * - * Example usage: - * - * $loader = new UniversalClassLoader(); - * - * // register classes with namespaces - * $loader->registerNamespaces(array( - * 'Symfony\Component' => __DIR__.'/component', - * 'Symfony' => __DIR__.'/framework', - * 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'), - * )); - * - * // register a library using the PEAR naming convention - * $loader->registerPrefixes(array( - * 'Swift_' => __DIR__.'/Swift', - * )); - * - * // activate the autoloader - * $loader->register(); - * - * 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. - * - * @author Fabien Potencier - * - * @api - */ -class UniversalClassLoader -{ - private $namespaces = array(); - private $prefixes = array(); - private $namespaceFallbacks = array(); - private $prefixFallbacks = array(); - - /** - * Gets the configured namespaces. - * - * @return array A hash with namespaces as keys and directories as values - */ - public function getNamespaces() - { - return $this->namespaces; - } - - /** - * Gets the configured class prefixes. - * - * @return array A hash with class prefixes as keys and directories as values - */ - public function getPrefixes() - { - return $this->prefixes; - } - - /** - * Gets the directory(ies) to use as a fallback for namespaces. - * - * @return array An array of directories - */ - public function getNamespaceFallbacks() - { - return $this->namespaceFallbacks; - } - - /** - * Gets the directory(ies) to use as a fallback for class prefixes. - * - * @return array An array of directories - */ - public function getPrefixFallbacks() - { - return $this->prefixFallbacks; - } - - /** - * Registers the directory to use as a fallback for namespaces. - * - * @param array $dirs An array of directories - * - * @api - */ - public function registerNamespaceFallbacks(array $dirs) - { - $this->namespaceFallbacks = $dirs; - } - - /** - * Registers the directory to use as a fallback for class prefixes. - * - * @param array $dirs An array of directories - * - * @api - */ - public function registerPrefixFallbacks(array $dirs) - { - $this->prefixFallbacks = $dirs; - } - - /** - * Registers an array of namespaces - * - * @param array $namespaces An array of namespaces (namespaces as keys and locations as values) - * - * @api - */ - public function registerNamespaces(array $namespaces) - { - foreach ($namespaces as $namespace => $locations) { - $this->namespaces[$namespace] = (array) $locations; - } - } - - /** - * Registers a namespace. - * - * @param string $namespace The namespace - * @param array|string $paths The location(s) of the namespace - * - * @api - */ - public function registerNamespace($namespace, $paths) - { - $this->namespaces[$namespace] = (array) $paths; - } - - /** - * Registers an array of classes using the PEAR naming convention. - * - * @param array $classes An array of classes (prefixes as keys and locations as values) - * - * @api - */ - public function registerPrefixes(array $classes) - { - foreach ($classes as $prefix => $locations) { - $this->prefixes[$prefix] = (array) $locations; - } - } - - /** - * Registers a set of classes using the PEAR naming convention. - * - * @param string $prefix The classes prefix - * @param array|string $paths The location(s) of the classes - * - * @api - */ - public function registerPrefix($prefix, $paths) - { - $this->prefixes[$prefix] = (array) $paths; - } - - /** - * Registers this instance as an autoloader. - * - * @param Boolean $prepend Whether to prepend the autoloader or not - * - * @api - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - require $file; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|null The path, if found - */ - public function findFile($class) - { - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $namespace = substr($class, 0, $pos); - foreach ($this->namespaces as $ns => $dirs) { - if (0 !== strpos($namespace, $ns)) { - continue; - } - - foreach ($dirs as $dir) { - $className = substr($class, $pos + 1); - $file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - - foreach ($this->namespaceFallbacks as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } else { - // PEAR-like class name - foreach ($this->prefixes as $prefix => $dirs) { - if (0 !== strpos($class, $prefix)) { - continue; - } - - foreach ($dirs as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - - foreach ($this->prefixFallbacks as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - } -} diff --git a/core/vendor/Symfony/Component/ClassLoader/composer.json b/core/vendor/Symfony/Component/ClassLoader/composer.json deleted file mode 100644 index f8bde98..0000000 --- a/core/vendor/Symfony/Component/ClassLoader/composer.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "symfony/class-loader", - "type": "library", - "description": "Symfony ClassLoader Component", - "keywords": [], - "homepage": "http://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.2" - }, - "autoload": { - "psr-0": { "Symfony\\Component\\ClassLoader": "" } - }, - "target-dir": "Symfony/Component/ClassLoader" -} diff --git a/core/vendor/Symfony/Component/EventDispatcher/Event.php b/core/vendor/Symfony/Component/EventDispatcher/Event.php deleted file mode 100644 index fc2c0d4..0000000 --- a/core/vendor/Symfony/Component/EventDispatcher/Event.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\EventDispatcher; - -/** - * Event is the base class for classes containing event data. - * - * This class contains no event data. It is used by events that do not pass - * state information to an event handler when an event is raised. - * - * You can call the method stopPropagation() to abort the execution of - * further listeners in your event listener. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * - * @api - */ -class Event -{ - /** - * @var Boolean Whether no further event listeners should be triggered - */ - private $propagationStopped = false; - - /** - * @var EventDispatcher Dispatcher that dispatched this event - */ - private $dispatcher; - - /** - * @var string This event's name - */ - private $name; - - /** - * Returns whether further event listeners should be triggered. - * - * @see Event::stopPropagation - * @return Boolean Whether propagation was already stopped for this event. - * - * @api - */ - public function isPropagationStopped() - { - return $this->propagationStopped; - } - - /** - * Stops the propagation of the event to further event listeners. - * - * If multiple event listeners are connected to the same event, no - * further event listener will be triggered once any trigger calls - * stopPropagation(). - * - * @api - */ - public function stopPropagation() - { - $this->propagationStopped = true; - } - - /** - * Stores the EventDispatcher that dispatches this Event - * - * @param EventDispatcher $dispatcher - * - * @api - */ - public function setDispatcher(EventDispatcher $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - /** - * Returns the EventDispatcher that dispatches this Event - * - * @return EventDispatcher - * - * @api - */ - public function getDispatcher() - { - return $this->dispatcher; - } - - /** - * Gets the event's name. - * - * @return string - * - * @api - */ - public function getName() - { - return $this->name; - } - - /** - * Sets the event's name property. - * - * @param string $name The event name. - * - * @api - */ - public function setName($name) - { - $this->name = $name; - } -} diff --git a/core/vendor/Symfony/Component/EventDispatcher/EventDispatcher.php b/core/vendor/Symfony/Component/EventDispatcher/EventDispatcher.php deleted file mode 100644 index 0c98301..0000000 --- a/core/vendor/Symfony/Component/EventDispatcher/EventDispatcher.php +++ /dev/null @@ -1,183 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * The EventDispatcherInterface is the central point of Symfony's event listener system. - * - * Listeners are registered on the manager and events are dispatched through the - * manager. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Fabien Potencier - * @author Jordi Boggiano - * @author Jordan Alliot - * - * @api - */ -class EventDispatcher implements EventDispatcherInterface -{ - private $listeners = array(); - private $sorted = array(); - - /** - * @see EventDispatcherInterface::dispatch - * - * @api - */ - public function dispatch($eventName, Event $event = null) - { - if (!isset($this->listeners[$eventName])) { - return; - } - - if (null === $event) { - $event = new Event(); - } - - $event->setDispatcher($this); - $event->setName($eventName); - - $this->doDispatch($this->getListeners($eventName), $eventName, $event); - } - - /** - * @see EventDispatcherInterface::getListeners - */ - public function getListeners($eventName = null) - { - if (null !== $eventName) { - if (!isset($this->sorted[$eventName])) { - $this->sortListeners($eventName); - } - - return $this->sorted[$eventName]; - } - - foreach (array_keys($this->listeners) as $eventName) { - if (!isset($this->sorted[$eventName])) { - $this->sortListeners($eventName); - } - } - - return $this->sorted; - } - - /** - * @see EventDispatcherInterface::hasListeners - */ - public function hasListeners($eventName = null) - { - return (Boolean) count($this->getListeners($eventName)); - } - - /** - * @see EventDispatcherInterface::addListener - * - * @api - */ - public function addListener($eventName, $listener, $priority = 0) - { - $this->listeners[$eventName][$priority][] = $listener; - unset($this->sorted[$eventName]); - } - - /** - * @see EventDispatcherInterface::removeListener - */ - public function removeListener($eventName, $listener) - { - if (!isset($this->listeners[$eventName])) { - return; - } - - foreach ($this->listeners[$eventName] as $priority => $listeners) { - if (false !== ($key = array_search($listener, $listeners))) { - unset($this->listeners[$eventName][$priority][$key], $this->sorted[$eventName]); - } - } - } - - /** - * @see EventDispatcherInterface::addSubscriber - * - * @api - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (is_string($params)) { - $this->addListener($eventName, array($subscriber, $params)); - } elseif (is_string($params[0])) { - $this->addListener($eventName, array($subscriber, $params[0]), $params[1]); - } else { - foreach ($params as $listener) { - $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0); - } - } - } - } - - /** - * @see EventDispatcherInterface::removeSubscriber - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (is_array($params) && is_array($params[0])) { - foreach ($params as $listener) { - $this->removeListener($eventName, array($subscriber, $listener[0])); - } - } else { - $this->removeListener($eventName, array($subscriber, is_string($params) ? $params : $params[0])); - } - } - } - - /** - * Triggers the listeners of an event. - * - * This method can be overridden to add functionality that is executed - * for each listener. - * - * @param array[callback] $listeners The event listeners. - * @param string $eventName The name of the event to dispatch. - * @param Event $event The event object to pass to the event handlers/listeners. - */ - protected function doDispatch($listeners, $eventName, Event $event) - { - foreach ($listeners as $listener) { - call_user_func($listener, $event); - if ($event->isPropagationStopped()) { - break; - } - } - } - - /** - * Sorts the internal list of listeners for the given event by priority. - * - * @param string $eventName The name of the event. - */ - private function sortListeners($eventName) - { - $this->sorted[$eventName] = array(); - - if (isset($this->listeners[$eventName])) { - krsort($this->listeners[$eventName]); - $this->sorted[$eventName] = call_user_func_array('array_merge', $this->listeners[$eventName]); - } - } -} diff --git a/core/vendor/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/core/vendor/Symfony/Component/EventDispatcher/EventDispatcherInterface.php deleted file mode 100644 index 25ebbdc..0000000 --- a/core/vendor/Symfony/Component/EventDispatcher/EventDispatcherInterface.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * The EventDispatcherInterface is the central point of Symfony's event listener system. - * Listeners are registered on the manager and events are dispatched through the - * manager. - * - * @author Bernhard Schussek - * - * @api - */ -interface EventDispatcherInterface -{ - /** - * Dispatches an event to all registered listeners. - * - * @param string $eventName The name of the event to dispatch. The name of - * the event is the name of the method that is - * invoked on listeners. - * @param Event $event The event to pass to the event handlers/listeners. - * If not supplied, an empty Event instance is created. - * - * @api - */ - function dispatch($eventName, Event $event = null); - - /** - * Adds an event listener that listens on the specified events. - * - * @param string $eventName The event to listen on - * @param callable $listener The listener - * @param integer $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - * - * @api - */ - function addListener($eventName, $listener, $priority = 0); - - /** - * Adds an event subscriber. The subscriber is asked for all the events he is - * interested in and added as a listener for these events. - * - * @param EventSubscriberInterface $subscriber The subscriber. - * - * @api - */ - function addSubscriber(EventSubscriberInterface $subscriber); - - /** - * Removes an event listener from the specified events. - * - * @param string|array $eventName The event(s) to remove a listener from. - * @param object $listener The listener object to remove. - */ - function removeListener($eventName, $listener); - - /** - * Removes an event subscriber. - * - * @param EventSubscriberInterface $subscriber The subscriber. - */ - function removeSubscriber(EventSubscriberInterface $subscriber); - - /** - * Gets the listeners of a specific event or all listeners. - * - * @param string $eventName The name of the event. - * - * @return array The event listeners for the specified event, or all event - * listeners by event name. - */ - function getListeners($eventName = null); - - /** - * Checks whether an event has any registered listeners. - * - * @param string $eventName The name of the event. - * - * @return Boolean TRUE if the specified event has any listeners, FALSE - * otherwise. - */ - function hasListeners($eventName = null); -} diff --git a/core/vendor/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/core/vendor/Symfony/Component/EventDispatcher/EventSubscriberInterface.php deleted file mode 100644 index 1e85b98..0000000 --- a/core/vendor/Symfony/Component/EventDispatcher/EventSubscriberInterface.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * An EventSubscriber knows himself what events he is interested in. - * If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes - * {@link getSubscribedEvents} and registers the subscriber as a listener for all - * returned events. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * - * @api - */ -interface EventSubscriberInterface -{ - /** - * Returns an array of event names this subscriber wants to listen to. - * - * The array keys are event names and the value can be: - * - * * The method name to call (priority defaults to 0) - * * An array composed of the method name to call and the priority - * * An array of arrays composed of the method names to call and respective - * priorities, or 0 if unset - * - * For instance: - * - * * array('eventName' => 'methodName') - * * array('eventName' => array('methodName', $priority)) - * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) - * - * @return array The event names to listen to - * - * @api - */ - static function getSubscribedEvents(); -} diff --git a/core/vendor/Symfony/Component/EventDispatcher/LICENSE b/core/vendor/Symfony/Component/EventDispatcher/LICENSE deleted file mode 100644 index 89df448..0000000 --- a/core/vendor/Symfony/Component/EventDispatcher/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2011 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/core/vendor/Symfony/Component/EventDispatcher/README.md b/core/vendor/Symfony/Component/EventDispatcher/README.md deleted file mode 100644 index 9427d75..0000000 --- a/core/vendor/Symfony/Component/EventDispatcher/README.md +++ /dev/null @@ -1,23 +0,0 @@ -EventDispatcher Component -========================= - -EventDispatcher implements a lightweight version of the Observer design -pattern. - - use Symfony\Component\EventDispatcher\EventDispatcher; - use Symfony\Component\EventDispatcher\Event; - - $dispatcher = new EventDispatcher(); - - $dispatcher->addListener('event_name', function (Event $event) { - // ... - }); - - $dispatcher->dispatch('event_name'); - -Resources ---------- - -Unit tests: - -https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/EventDispatcher diff --git a/core/vendor/Symfony/Component/EventDispatcher/composer.json b/core/vendor/Symfony/Component/EventDispatcher/composer.json deleted file mode 100644 index b9ea291..0000000 --- a/core/vendor/Symfony/Component/EventDispatcher/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "symfony/event-dispatcher", - "type": "library", - "description": "Symfony EventDispatcher Component", - "keywords": [], - "homepage": "http://symfony.com", - "version": "2.1.0", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.2" - }, - "autoload": { - "psr-0": { "Symfony\\Component\\EventDispatcher": "" } - }, - "target-dir": "Symfony/Component/EventDispatcher" -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php b/core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php deleted file mode 100644 index ca8f8ee..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Request represents an HTTP request from an Apache server. - * - * @author Fabien Potencier - */ -class ApacheRequest extends Request -{ - /** - * {@inheritdoc} - */ - protected function prepareRequestUri() - { - return $this->server->get('REQUEST_URI'); - } - - /** - * {@inheritdoc} - */ - protected function prepareBaseUrl() - { - $baseUrl = $this->server->get('SCRIPT_NAME'); - - if (false === strpos($this->server->get('REQUEST_URI'), $baseUrl)) { - // assume mod_rewrite - return rtrim(dirname($baseUrl), '/\\'); - } - - return $baseUrl; - } - - /** - * {@inheritdoc} - */ - protected function preparePathInfo() - { - return $this->server->get('PATH_INFO') ?: substr($this->prepareRequestUri(), strlen($this->prepareBaseUrl())) ?: '/'; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Cookie.php b/core/vendor/Symfony/Component/HttpFoundation/Cookie.php deleted file mode 100644 index 0511162..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Cookie.php +++ /dev/null @@ -1,203 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Represents a cookie - * - * @author Johannes M. Schmitt - * - * @api - */ -class Cookie -{ - protected $name; - protected $value; - protected $domain; - protected $expire; - protected $path; - protected $secure; - protected $httpOnly; - - /** - * Constructor. - * - * @param string $name The name of the cookie - * @param string $value The value of the cookie - * @param integer|string|\DateTime $expire The time the cookie expires - * @param string $path The path on the server in which the cookie will be available on - * @param string $domain The domain that the cookie is available to - * @param Boolean $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client - * @param Boolean $httpOnly Whether the cookie will be made accessible only through the HTTP protocol - * - * @api - */ - public function __construct($name, $value = null, $expire = 0, $path = '/', $domain = null, $secure = false, $httpOnly = true) - { - // from PHP source code - if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { - throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name)); - } - - if (empty($name)) { - throw new \InvalidArgumentException('The cookie name cannot be empty.'); - } - - // convert expiration time to a Unix timestamp - if ($expire instanceof \DateTime) { - $expire = $expire->format('U'); - } elseif (!is_numeric($expire)) { - $expire = strtotime($expire); - - if (false === $expire || -1 === $expire) { - throw new \InvalidArgumentException('The cookie expiration time is not valid.'); - } - } - - $this->name = $name; - $this->value = $value; - $this->domain = $domain; - $this->expire = $expire; - $this->path = empty($path) ? '/' : $path; - $this->secure = (Boolean) $secure; - $this->httpOnly = (Boolean) $httpOnly; - } - - public function __toString() - { - $str = urlencode($this->getName()).'='; - - if ('' === (string) $this->getValue()) { - $str .= 'deleted; expires='.gmdate("D, d-M-Y H:i:s T", time() - 31536001); - } else { - $str .= urlencode($this->getValue()); - - if ($this->getExpiresTime() !== 0) { - $str .= '; expires='.gmdate("D, d-M-Y H:i:s T", $this->getExpiresTime()); - } - } - - if ('/' !== $this->path) { - $str .= '; path='.$this->path; - } - - if (null !== $this->getDomain()) { - $str .= '; domain='.$this->getDomain(); - } - - if (true === $this->isSecure()) { - $str .= '; secure'; - } - - if (true === $this->isHttpOnly()) { - $str .= '; httponly'; - } - - return $str; - } - - /** - * Gets the name of the cookie. - * - * @return string - * - * @api - */ - public function getName() - { - return $this->name; - } - - /** - * Gets the value of the cookie. - * - * @return string - * - * @api - */ - public function getValue() - { - return $this->value; - } - - /** - * Gets the domain that the cookie is available to. - * - * @return string - * - * @api - */ - public function getDomain() - { - return $this->domain; - } - - /** - * Gets the time the cookie expires. - * - * @return integer - * - * @api - */ - public function getExpiresTime() - { - return $this->expire; - } - - /** - * Gets the path on the server in which the cookie will be available on. - * - * @return string - * - * @api - */ - public function getPath() - { - return $this->path; - } - - /** - * Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client. - * - * @return Boolean - * - * @api - */ - public function isSecure() - { - return $this->secure; - } - - /** - * Checks whether the cookie will be made accessible only through the HTTP protocol. - * - * @return Boolean - * - * @api - */ - public function isHttpOnly() - { - return $this->httpOnly; - } - - /** - * Whether this cookie is about to be cleared - * - * @return Boolean - * - * @api - */ - public function isCleared() - { - return $this->expire < time(); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php b/core/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php deleted file mode 100644 index 9c7fe68..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when the access on a file was denied. - * - * @author Bernhard Schussek - */ -class AccessDeniedException extends FileException -{ - /** - * Constructor. - * - * @param string $path The path to the accessed file - */ - public function __construct($path) - { - parent::__construct(sprintf('The file %s could not be accessed', $path)); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php b/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php deleted file mode 100644 index 43c6cc8..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when an error occurred in the component File - * - * @author Bernhard Schussek - */ -class FileException extends \RuntimeException -{ -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php b/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php deleted file mode 100644 index 5b1aef8..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when a file was not found - * - * @author Bernhard Schussek - */ -class FileNotFoundException extends FileException -{ - /** - * Constructor. - * - * @param string $path The path to the file that was not found - */ - public function __construct($path) - { - parent::__construct(sprintf('The file "%s" does not exist', $path)); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php b/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php deleted file mode 100644 index 0444b87..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.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\HttpFoundation\File\Exception; - -class UnexpectedTypeException extends FileException -{ - public function __construct($value, $expectedType) - { - parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, is_object($value) ? get_class($value) : gettype($value))); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php b/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php deleted file mode 100644 index 694e864..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when an error occurred during file upload - * - * @author Bernhard Schussek - */ -class UploadException extends FileException -{ -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/File.php b/core/vendor/Symfony/Component/HttpFoundation/File/File.php deleted file mode 100644 index 58bc6f4..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/File.php +++ /dev/null @@ -1,546 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File; - -use Symfony\Component\HttpFoundation\File\Exception\FileException; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; - -/** - * A file in the file system. - * - * @author Bernhard Schussek - * - * @api - */ -class File extends \SplFileInfo -{ - /** - * A map of mime types and their default extensions. - * - * @var array - */ - static protected $defaultExtensions = array( - 'application/andrew-inset' => 'ez', - 'application/appledouble' => 'base64', - 'application/applefile' => 'base64', - 'application/commonground' => 'dp', - 'application/cprplayer' => 'pqi', - 'application/dsptype' => 'tsp', - 'application/excel' => 'xls', - 'application/font-tdpfr' => 'pfr', - 'application/futuresplash' => 'spl', - 'application/hstu' => 'stk', - 'application/hyperstudio' => 'stk', - 'application/javascript' => 'js', - 'application/mac-binhex40' => 'hqx', - 'application/mac-compactpro' => 'cpt', - 'application/mbed' => 'mbd', - 'application/mirage' => 'mfp', - 'application/msword' => 'doc', - 'application/ocsp-request' => 'orq', - 'application/ocsp-response' => 'ors', - 'application/octet-stream' => 'bin', - 'application/oda' => 'oda', - 'application/ogg' => 'ogg', - 'application/pdf' => 'pdf', - 'application/x-pdf' => 'pdf', - 'application/pgp-encrypted' => '7bit', - 'application/pgp-keys' => '7bit', - 'application/pgp-signature' => 'sig', - 'application/pkcs10' => 'p10', - 'application/pkcs7-mime' => 'p7m', - 'application/pkcs7-signature' => 'p7s', - 'application/pkix-cert' => 'cer', - 'application/pkix-crl' => 'crl', - 'application/pkix-pkipath' => 'pkipath', - 'application/pkixcmp' => 'pki', - 'application/postscript' => 'ps', - 'application/presentations' => 'shw', - 'application/prs.cww' => 'cw', - 'application/prs.nprend' => 'rnd', - 'application/quest' => 'qrt', - 'application/rtf' => 'rtf', - 'application/sgml-open-catalog' => 'soc', - 'application/sieve' => 'siv', - 'application/smil' => 'smi', - 'application/toolbook' => 'tbk', - 'application/vnd.3gpp.pic-bw-large' => 'plb', - 'application/vnd.3gpp.pic-bw-small' => 'psb', - 'application/vnd.3gpp.pic-bw-var' => 'pvb', - 'application/vnd.3gpp.sms' => 'sms', - 'application/vnd.acucorp' => 'atc', - 'application/vnd.adobe.xfdf' => 'xfdf', - 'application/vnd.amiga.amu' => 'ami', - 'application/vnd.blueice.multipass' => 'mpm', - 'application/vnd.cinderella' => 'cdy', - 'application/vnd.cosmocaller' => 'cmc', - 'application/vnd.criticaltools.wbs+xml' => 'wbs', - 'application/vnd.curl' => 'curl', - 'application/vnd.data-vision.rdz' => 'rdz', - 'application/vnd.dreamfactory' => 'dfac', - 'application/vnd.fsc.weblaunch' => 'fsc', - 'application/vnd.genomatix.tuxedo' => 'txd', - 'application/vnd.hbci' => 'hbci', - 'application/vnd.hhe.lesson-player' => 'les', - 'application/vnd.hp-hpgl' => 'plt', - 'application/vnd.ibm.electronic-media' => 'emm', - 'application/vnd.ibm.rights-management' => 'irm', - 'application/vnd.ibm.secure-container' => 'sc', - 'application/vnd.ipunplugged.rcprofile' => 'rcprofile', - 'application/vnd.irepository.package+xml' => 'irp', - 'application/vnd.jisp' => 'jisp', - 'application/vnd.kde.karbon' => 'karbon', - 'application/vnd.kde.kchart' => 'chrt', - 'application/vnd.kde.kformula' => 'kfo', - 'application/vnd.kde.kivio' => 'flw', - 'application/vnd.kde.kontour' => 'kon', - 'application/vnd.kde.kpresenter' => 'kpr', - 'application/vnd.kde.kspread' => 'ksp', - 'application/vnd.kde.kword' => 'kwd', - 'application/vnd.kenameapp' => 'htke', - 'application/vnd.kidspiration' => 'kia', - 'application/vnd.kinar' => 'kne', - 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', - 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', - 'application/vnd.lotus-1-2-3' => 'wks', - 'application/vnd.mcd' => 'mcd', - 'application/vnd.mfmp' => 'mfm', - 'application/vnd.micrografx.flo' => 'flo', - 'application/vnd.micrografx.igx' => 'igx', - 'application/vnd.mif' => 'mif', - 'application/vnd.mophun.application' => 'mpn', - 'application/vnd.mophun.certificate' => 'mpc', - 'application/vnd.mozilla.xul+xml' => 'xul', - 'application/vnd.ms-artgalry' => 'cil', - 'application/vnd.ms-asf' => 'asf', - 'application/vnd.ms-excel' => 'xls', - 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', - 'application/vnd.ms-lrm' => 'lrm', - 'application/vnd.ms-powerpoint' => 'ppt', - 'application/vnd.ms-project' => 'mpp', - 'application/vnd.ms-tnef' => 'base64', - 'application/vnd.ms-works' => 'base64', - 'application/vnd.ms-wpl' => 'wpl', - 'application/vnd.mseq' => 'mseq', - 'application/vnd.nervana' => 'ent', - 'application/vnd.nokia.radio-preset' => 'rpst', - 'application/vnd.nokia.radio-presets' => 'rpss', - 'application/vnd.oasis.opendocument.text' => 'odt', - 'application/vnd.oasis.opendocument.text-template' => 'ott', - 'application/vnd.oasis.opendocument.text-web' => 'oth', - 'application/vnd.oasis.opendocument.text-master' => 'odm', - 'application/vnd.oasis.opendocument.graphics' => 'odg', - 'application/vnd.oasis.opendocument.graphics-template' => 'otg', - 'application/vnd.oasis.opendocument.presentation' => 'odp', - 'application/vnd.oasis.opendocument.presentation-template' => 'otp', - 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', - 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', - 'application/vnd.oasis.opendocument.chart' => 'odc', - 'application/vnd.oasis.opendocument.formula' => 'odf', - 'application/vnd.oasis.opendocument.database' => 'odb', - 'application/vnd.oasis.opendocument.image' => 'odi', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', - 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', - 'application/vnd.palm' => 'prc', - 'application/vnd.picsel' => 'efif', - 'application/vnd.pvi.ptid1' => 'pti', - 'application/vnd.quark.quarkxpress' => 'qxd', - 'application/vnd.sealed.doc' => 'sdoc', - 'application/vnd.sealed.eml' => 'seml', - 'application/vnd.sealed.mht' => 'smht', - 'application/vnd.sealed.ppt' => 'sppt', - 'application/vnd.sealed.xls' => 'sxls', - 'application/vnd.sealedmedia.softseal.html' => 'stml', - 'application/vnd.sealedmedia.softseal.pdf' => 'spdf', - 'application/vnd.seemail' => 'see', - 'application/vnd.smaf' => 'mmf', - 'application/vnd.sun.xml.calc' => 'sxc', - 'application/vnd.sun.xml.calc.template' => 'stc', - 'application/vnd.sun.xml.draw' => 'sxd', - 'application/vnd.sun.xml.draw.template' => 'std', - 'application/vnd.sun.xml.impress' => 'sxi', - 'application/vnd.sun.xml.impress.template' => 'sti', - 'application/vnd.sun.xml.math' => 'sxm', - 'application/vnd.sun.xml.writer' => 'sxw', - 'application/vnd.sun.xml.writer.global' => 'sxg', - 'application/vnd.sun.xml.writer.template' => 'stw', - 'application/vnd.sus-calendar' => 'sus', - 'application/vnd.vidsoft.vidconference' => 'vsc', - 'application/vnd.visio' => 'vsd', - 'application/vnd.visionary' => 'vis', - 'application/vnd.wap.sic' => 'sic', - 'application/vnd.wap.slc' => 'slc', - 'application/vnd.wap.wbxml' => 'wbxml', - 'application/vnd.wap.wmlc' => 'wmlc', - 'application/vnd.wap.wmlscriptc' => 'wmlsc', - 'application/vnd.webturbo' => 'wtb', - 'application/vnd.wordperfect' => 'wpd', - 'application/vnd.wqd' => 'wqd', - 'application/vnd.wv.csp+wbxml' => 'wv', - 'application/vnd.wv.csp+xml' => '8bit', - 'application/vnd.wv.ssp+xml' => '8bit', - 'application/vnd.yamaha.hv-dic' => 'hvd', - 'application/vnd.yamaha.hv-script' => 'hvs', - 'application/vnd.yamaha.hv-voice' => 'hvp', - 'application/vnd.yamaha.smaf-audio' => 'saf', - 'application/vnd.yamaha.smaf-phrase' => 'spf', - 'application/vocaltec-media-desc' => 'vmd', - 'application/vocaltec-media-file' => 'vmf', - 'application/vocaltec-talker' => 'vtk', - 'application/watcherinfo+xml' => 'wif', - 'application/wordperfect5.1' => 'wp5', - 'application/x-123' => 'wk', - 'application/x-7th_level_event' => '7ls', - 'application/x-authorware-bin' => 'aab', - 'application/x-authorware-map' => 'aam', - 'application/x-authorware-seg' => 'aas', - 'application/x-bcpio' => 'bcpio', - 'application/x-bleeper' => 'bleep', - 'application/x-bzip2' => 'bz2', - 'application/x-cdlink' => 'vcd', - 'application/x-chat' => 'chat', - 'application/x-chess-pgn' => 'pgn', - 'application/x-compress' => 'z', - 'application/x-cpio' => 'cpio', - 'application/x-cprplayer' => 'pqf', - 'application/x-csh' => 'csh', - 'application/x-cu-seeme' => 'csm', - 'application/x-cult3d-object' => 'co', - 'application/x-debian-package' => 'deb', - 'application/x-director' => 'dcr', - 'application/x-dvi' => 'dvi', - 'application/x-envoy' => 'evy', - 'application/x-futuresplash' => 'spl', - 'application/x-gtar' => 'gtar', - 'application/x-gzip' => 'gz', - 'application/x-hdf' => 'hdf', - 'application/x-hep' => 'hep', - 'application/x-html+ruby' => 'rhtml', - 'application/x-httpd-miva' => 'mv', - 'application/x-httpd-php' => 'phtml', - 'application/x-ica' => 'ica', - 'application/x-imagemap' => 'imagemap', - 'application/x-ipix' => 'ipx', - 'application/x-ipscript' => 'ips', - 'application/x-java-archive' => 'jar', - 'application/x-java-jnlp-file' => 'jnlp', - 'application/x-java-serialized-object' => 'ser', - 'application/x-java-vm' => 'class', - 'application/x-javascript' => 'js', - 'application/x-koan' => 'skp', - 'application/x-latex' => 'latex', - 'application/x-mac-compactpro' => 'cpt', - 'application/x-maker' => 'frm', - 'application/x-mathcad' => 'mcd', - 'application/x-midi' => 'mid', - 'application/x-mif' => 'mif', - 'application/x-msaccess' => 'mda', - 'application/x-msdos-program' => 'com', - 'application/x-msdownload' => 'base64', - 'application/x-msexcel' => 'xls', - 'application/x-msword' => 'doc', - 'application/x-netcdf' => 'nc', - 'application/x-ns-proxy-autoconfig' => 'pac', - 'application/x-pagemaker' => 'pm5', - 'application/x-perl' => 'pl', - 'application/x-pn-realmedia' => 'rp', - 'application/x-python' => 'py', - 'application/x-quicktimeplayer' => 'qtl', - 'application/x-rar-compressed' => 'rar', - 'application/x-ruby' => 'rb', - 'application/x-sh' => 'sh', - 'application/x-shar' => 'shar', - 'application/x-shockwave-flash' => 'swf', - 'application/x-sprite' => 'spr', - 'application/x-spss' => 'sav', - 'application/x-spt' => 'spt', - 'application/x-stuffit' => 'sit', - 'application/x-sv4cpio' => 'sv4cpio', - 'application/x-sv4crc' => 'sv4crc', - 'application/x-tar' => 'tar', - 'application/x-tcl' => 'tcl', - 'application/x-tex' => 'tex', - 'application/x-texinfo' => 'texinfo', - 'application/x-troff' => 't', - 'application/x-troff-man' => 'man', - 'application/x-troff-me' => 'me', - 'application/x-troff-ms' => 'ms', - 'application/x-twinvq' => 'vqf', - 'application/x-twinvq-plugin' => 'vqe', - 'application/x-ustar' => 'ustar', - 'application/x-vmsbackup' => 'bck', - 'application/x-wais-source' => 'src', - 'application/x-wingz' => 'wz', - 'application/x-word' => 'base64', - 'application/x-wordperfect6.1' => 'wp6', - 'application/x-x509-ca-cert' => 'crt', - 'application/x-zip-compressed' => 'zip', - 'application/xhtml+xml' => 'xhtml', - 'application/zip' => 'zip', - 'audio/3gpp' => '3gpp', - 'audio/amr' => 'amr', - 'audio/amr-wb' => 'awb', - 'audio/basic' => 'au', - 'audio/evrc' => 'evc', - 'audio/l16' => 'l16', - 'audio/midi' => 'mid', - 'audio/mpeg' => 'mp3', - 'audio/prs.sid' => 'sid', - 'audio/qcelp' => 'qcp', - 'audio/smv' => 'smv', - 'audio/vnd.audiokoz' => 'koz', - 'audio/vnd.digital-winds' => 'eol', - 'audio/vnd.everad.plj' => 'plj', - 'audio/vnd.lucent.voice' => 'lvp', - 'audio/vnd.nokia.mobile-xmf' => 'mxmf', - 'audio/vnd.nortel.vbk' => 'vbk', - 'audio/vnd.nuera.ecelp4800' => 'ecelp4800', - 'audio/vnd.nuera.ecelp7470' => 'ecelp7470', - 'audio/vnd.nuera.ecelp9600' => 'ecelp9600', - 'audio/vnd.sealedmedia.softseal.mpeg' => 'smp3', - 'audio/voxware' => 'vox', - 'audio/x-aiff' => 'aif', - 'audio/x-mid' => 'mid', - 'audio/x-midi' => 'mid', - 'audio/x-mpeg' => 'mp2', - 'audio/x-mpegurl' => 'mpu', - 'audio/x-pn-realaudio' => 'rm', - 'audio/x-pn-realaudio-plugin' => 'rpm', - 'audio/x-realaudio' => 'ra', - 'audio/x-wav' => 'wav', - 'chemical/x-csml' => 'csm', - 'chemical/x-embl-dl-nucleotide' => 'emb', - 'chemical/x-gaussian-cube' => 'cube', - 'chemical/x-gaussian-input' => 'gau', - 'chemical/x-jcamp-dx' => 'jdx', - 'chemical/x-mdl-molfile' => 'mol', - 'chemical/x-mdl-rxnfile' => 'rxn', - 'chemical/x-mdl-tgf' => 'tgf', - 'chemical/x-mopac-input' => 'mop', - 'chemical/x-pdb' => 'pdb', - 'chemical/x-rasmol' => 'scr', - 'chemical/x-xyz' => 'xyz', - 'drawing/dwf' => 'dwf', - 'drawing/x-dwf' => 'dwf', - 'i-world/i-vrml' => 'ivr', - 'image/bmp' => 'bmp', - 'image/cewavelet' => 'wif', - 'image/cis-cod' => 'cod', - 'image/fif' => 'fif', - 'image/gif' => 'gif', - 'image/ief' => 'ief', - 'image/jp2' => 'jp2', - 'image/jpeg' => 'jpg', - 'image/jpm' => 'jpm', - 'image/jpx' => 'jpf', - 'image/pict' => 'pic', - 'image/pjpeg' => 'jpg', - 'image/png' => 'png', - 'image/targa' => 'tga', - 'image/tiff' => 'tif', - 'image/vn-svf' => 'svf', - 'image/vnd.dgn' => 'dgn', - 'image/vnd.djvu' => 'djvu', - 'image/vnd.dwg' => 'dwg', - 'image/vnd.glocalgraphics.pgb' => 'pgb', - 'image/vnd.microsoft.icon' => 'ico', - 'image/vnd.ms-modi' => 'mdi', - 'image/vnd.sealed.png' => 'spng', - 'image/vnd.sealedmedia.softseal.gif' => 'sgif', - 'image/vnd.sealedmedia.softseal.jpg' => 'sjpg', - 'image/vnd.wap.wbmp' => 'wbmp', - 'image/x-bmp' => 'bmp', - 'image/x-cmu-raster' => 'ras', - 'image/x-freehand' => 'fh4', - 'image/x-png' => 'png', - 'image/x-portable-anymap' => 'pnm', - 'image/x-portable-bitmap' => 'pbm', - 'image/x-portable-graymap' => 'pgm', - 'image/x-portable-pixmap' => 'ppm', - 'image/x-rgb' => 'rgb', - 'image/x-xbitmap' => 'xbm', - 'image/x-xpixmap' => 'xpm', - 'image/x-xwindowdump' => 'xwd', - 'message/external-body' => '8bit', - 'message/news' => '8bit', - 'message/partial' => '8bit', - 'message/rfc822' => '8bit', - 'model/iges' => 'igs', - 'model/mesh' => 'msh', - 'model/vnd.parasolid.transmit.binary' => 'x_b', - 'model/vnd.parasolid.transmit.text' => 'x_t', - 'model/vrml' => 'wrl', - 'multipart/alternative' => '8bit', - 'multipart/appledouble' => '8bit', - 'multipart/digest' => '8bit', - 'multipart/mixed' => '8bit', - 'multipart/parallel' => '8bit', - 'text/comma-separated-values' => 'csv', - 'text/css' => 'css', - 'text/html' => 'html', - 'text/plain' => 'txt', - 'text/prs.fallenstein.rst' => 'rst', - 'text/richtext' => 'rtx', - 'text/rtf' => 'rtf', - 'text/sgml' => 'sgml', - 'text/tab-separated-values' => 'tsv', - 'text/vnd.net2phone.commcenter.command' => 'ccc', - 'text/vnd.sun.j2me.app-descriptor' => 'jad', - 'text/vnd.wap.si' => 'si', - 'text/vnd.wap.sl' => 'sl', - 'text/vnd.wap.wml' => 'wml', - 'text/vnd.wap.wmlscript' => 'wmls', - 'text/x-hdml' => 'hdml', - 'text/x-setext' => 'etx', - 'text/x-sgml' => 'sgml', - 'text/x-speech' => 'talk', - 'text/x-vcalendar' => 'vcs', - 'text/x-vcard' => 'vcf', - 'text/xml' => 'xml', - 'ulead/vrml' => 'uvr', - 'video/3gpp' => '3gp', - 'video/dl' => 'dl', - 'video/gl' => 'gl', - 'video/mj2' => 'mj2', - 'video/mpeg' => 'mpeg', - 'video/quicktime' => 'mov', - 'video/vdo' => 'vdo', - 'video/vivo' => 'viv', - 'video/vnd.fvt' => 'fvt', - 'video/vnd.mpegurl' => 'mxu', - 'video/vnd.nokia.interleaved-multimedia' => 'nim', - 'video/vnd.objectvideo' => 'mp4', - 'video/vnd.sealed.mpeg1' => 's11', - 'video/vnd.sealed.mpeg4' => 'smpg', - 'video/vnd.sealed.swf' => 'sswf', - 'video/vnd.sealedmedia.softseal.mov' => 'smov', - 'video/vnd.vivo' => 'vivo', - 'video/x-fli' => 'fli', - 'video/x-flv' => 'flv', - 'video/x-ms-asf' => 'asf', - 'video/x-ms-wmv' => 'wmv', - 'video/x-msvideo' => 'avi', - 'video/x-sgi-movie' => 'movie', - 'x-chemical/x-pdb' => 'pdb', - 'x-chemical/x-xyz' => 'xyz', - 'x-conference/x-cooltalk' => 'ice', - 'x-drawing/dwf' => 'dwf', - 'x-world/x-d96' => 'd', - 'x-world/x-svr' => 'svr', - 'x-world/x-vream' => 'vrw', - 'x-world/x-vrml' => 'wrl', - ); - - /** - * Constructs a new file from the given path. - * - * @param string $path The path to the file - * @param Boolean $checkPath Whether to check the path or not - * - * @throws FileNotFoundException If the given path is not a file - * - * @api - */ - public function __construct($path, $checkPath = true) - { - if ($checkPath && !is_file($path)) { - throw new FileNotFoundException($path); - } - - parent::__construct($path); - } - - /** - * Returns the extension based on the mime type. - * - * If the mime type is unknown, returns null. - * - * @return string|null The guessed extension or null if it cannot be guessed - * - * @api - */ - public function guessExtension() - { - $type = $this->getMimeType(); - - return isset(static::$defaultExtensions[$type]) ? static::$defaultExtensions[$type] : null; - } - - /** - * Returns the mime type of the file. - * - * The mime type is guessed using the functions finfo(), mime_content_type() - * and the system binary "file" (in this order), depending on which of those - * is available on the current operating system. - * - * @return string|null The guessed mime type (i.e. "application/pdf") - * - * @api - */ - public function getMimeType() - { - $guesser = MimeTypeGuesser::getInstance(); - - return $guesser->guess($this->getPathname()); - } - - /** - * Returns the extension of the file. - * - * \SplFileInfo::getExtension() is not available before PHP 5.3.6 - * - * @return string The extension - * - * @api - */ - public function getExtension() - { - return pathinfo($this->getBasename(), PATHINFO_EXTENSION); - } - - /** - * Moves the file to a new location. - * - * @param string $directory The destination folder - * @param string $name The new file name - * - * @return File A File object representing the new file - * - * @throws FileException if the target file could not be created - * - * @api - */ - public function move($directory, $name = null) - { - if (!is_dir($directory)) { - if (false === @mkdir($directory, 0777, true)) { - throw new FileException(sprintf('Unable to create the "%s" directory', $directory)); - } - } elseif (!is_writable($directory)) { - throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); - } - - $target = $directory.DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : basename($name)); - - if (!@rename($this->getPathname(), $target)) { - $error = error_get_last(); - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); - } - - chmod($target, 0666); - - return new File($target); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ContentTypeMimeTypeGuesser.php b/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ContentTypeMimeTypeGuesser.php deleted file mode 100644 index fb900b2..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ContentTypeMimeTypeGuesser.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type using the PHP function mime_content_type(). - * - * @author Bernhard Schussek - */ -class ContentTypeMimeTypeGuesser implements MimeTypeGuesserInterface -{ - /** - * Returns whether this guesser is supported on the current OS/PHP setup - * - * @return Boolean - */ - static public function isSupported() - { - return function_exists('mime_content_type'); - } - - /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!self::isSupported()) { - return null; - } - - $type = mime_content_type($path); - - // remove charset (added as of PHP 5.3) - if (false !== $pos = strpos($type, ';')) { - $type = substr($type, 0, $pos); - } - - return $type; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php deleted file mode 100644 index 1b869f2..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type with the binary "file" (only available on *nix) - * - * @author Bernhard Schussek - */ -class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface -{ - /** - * Returns whether this guesser is supported on the current OS - * - * @return Boolean - */ - static public function isSupported() - { - return !strstr(PHP_OS, 'WIN'); - } - /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!self::isSupported()) { - return null; - } - - ob_start(); - - // need to use --mime instead of -i. see #6641 - passthru(sprintf('file -b --mime %s 2>/dev/null', escapeshellarg($path)), $return); - if ($return > 0) { - ob_end_clean(); - - return null; - } - - $type = trim(ob_get_clean()); - - if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-]+)#i', $type, $match)) { - // it's not a type, but an error message - return null; - } - - return $match[1]; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php deleted file mode 100644 index 45d5a08..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type using the PECL extension FileInfo - * - * @author Bernhard Schussek - */ -class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface -{ - /** - * Returns whether this guesser is supported on the current OS/PHP setup - * - * @return Boolean - */ - static public function isSupported() - { - return function_exists('finfo_open'); - } - - /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!self::isSupported()) { - return null; - } - - if (!$finfo = new \finfo(FILEINFO_MIME_TYPE)) { - return null; - } - - return $finfo->file($path); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php deleted file mode 100644 index 9601618..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * A singleton mime type guesser. - * - * By default, all mime type guessers provided by the framework are installed - * (if available on the current OS/PHP setup). You can register custom - * guessers by calling the register() method on the singleton instance. - * - * - * $guesser = MimeTypeGuesser::getInstance(); - * $guesser->register(new MyCustomMimeTypeGuesser()); - * - * - * The last registered guesser is preferred over previously registered ones. - * - * @author Bernhard Schussek - */ -class MimeTypeGuesser implements MimeTypeGuesserInterface -{ - /** - * The singleton instance - * @var MimeTypeGuesser - */ - static private $instance = null; - - /** - * All registered MimeTypeGuesserInterface instances - * @var array - */ - protected $guessers = array(); - - /** - * Returns the singleton instance - * - * @return MimeTypeGuesser - */ - static public function getInstance() - { - if (null === self::$instance) { - self::$instance = new self(); - } - - return self::$instance; - } - - /** - * Registers all natively provided mime type guessers - */ - private function __construct() - { - if (FileBinaryMimeTypeGuesser::isSupported()) { - $this->register(new FileBinaryMimeTypeGuesser()); - } - - if (ContentTypeMimeTypeGuesser::isSupported()) { - $this->register(new ContentTypeMimeTypeGuesser()); - } - - if (FileinfoMimeTypeGuesser::isSupported()) { - $this->register(new FileinfoMimeTypeGuesser()); - } - } - - /** - * Registers a new mime type guesser - * - * When guessing, this guesser is preferred over previously registered ones. - * - * @param MimeTypeGuesserInterface $guesser - */ - public function register(MimeTypeGuesserInterface $guesser) - { - array_unshift($this->guessers, $guesser); - } - - /** - * Tries to guess the mime type of the given file - * - * The file is passed to each registered mime type guesser in reverse order - * of their registration (last registered is queried first). Once a guesser - * returns a value that is not NULL, this method terminates and returns the - * value. - * - * @param string $path The path to the file - * - * @return string The mime type or NULL, if none could be guessed - * - * @throws FileException If the file does not exist - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!$this->guessers) { - throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)'); - } - - foreach ($this->guessers as $guesser) { - if (null !== $mimeType = $guesser->guess($path)) { - return $mimeType; - } - } - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php b/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php deleted file mode 100644 index 66178bb..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.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\HttpFoundation\File\MimeType; - -/** - * Guesses the mime type of a file - * - * @author Bernhard Schussek - */ -interface MimeTypeGuesserInterface -{ - /** - * Guesses the mime type of the file with the given path. - * - * @param string $path The path to the file - * - * @return string The mime type or NULL, if none could be guessed - * - * @throws FileNotFoundException If the file does not exist - * @throws AccessDeniedException If the file could not be read - */ - function guess($path); -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php b/core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php deleted file mode 100644 index 4e51c50..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ /dev/null @@ -1,223 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File; - -use Symfony\Component\HttpFoundation\File\Exception\FileException; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; - -/** - * A file uploaded through a form. - * - * @author Bernhard Schussek - * @author Florian Eckerstorfer - * @author Fabien Potencier - * - * @api - */ -class UploadedFile extends File -{ - /** - * Whether the test mode is activated. - * - * Local files are used in test mode hence the code should not enforce HTTP uploads. - * - * @var Boolean - */ - private $test = false; - - /** - * The original name of the uploaded file. - * - * @var string - */ - private $originalName; - - /** - * The mime type provided by the uploader. - * - * @var string - */ - private $mimeType; - - /** - * The file size provided by the uploader. - * - * @var string - */ - private $size; - - /** - * The UPLOAD_ERR_XXX constant provided by the uploader. - * - * @var integer - */ - private $error; - - /** - * Accepts the information of the uploaded file as provided by the PHP global $_FILES. - * - * The file object is only created when the uploaded file is valid (i.e. when the - * isValid() method returns true). Otherwise the only methods that could be called - * on an UploadedFile instance are: - * - * * getClientOriginalName, - * * getClientMimeType, - * * isValid, - * * getError. - * - * Calling any other method on an non-valid instance will cause an unpredictable result. - * - * @param string $path The full temporary path to the file - * @param string $originalName The original file name - * @param string $mimeType The type of the file as provided by PHP - * @param integer $size The file size - * @param integer $error The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constants) - * @param Boolean $test Whether the test mode is active - * - * @throws FileException If file_uploads is disabled - * @throws FileNotFoundException If the file does not exist - * - * @api - */ - public function __construct($path, $originalName, $mimeType = null, $size = null, $error = null, $test = false) - { - if (!ini_get('file_uploads')) { - throw new FileException(sprintf('Unable to create UploadedFile because "file_uploads" is disabled in your php.ini file (%s)', get_cfg_var('cfg_file_path'))); - } - - $this->originalName = basename($originalName); - $this->mimeType = $mimeType ?: 'application/octet-stream'; - $this->size = $size; - $this->error = $error ?: UPLOAD_ERR_OK; - $this->test = (Boolean) $test; - - parent::__construct($path, UPLOAD_ERR_OK === $this->error); - } - - /** - * Returns the original file name. - * - * It is extracted from the request from which the file has been uploaded. - * Then is should not be considered as a safe value. - * - * @return string|null The original name - * - * @api - */ - public function getClientOriginalName() - { - return $this->originalName; - } - - /** - * Returns the file mime type. - * - * It is extracted from the request from which the file has been uploaded. - * Then is should not be considered as a safe value. - * - * @return string|null The mime type - * - * @api - */ - public function getClientMimeType() - { - return $this->mimeType; - } - - /** - * Returns the file size. - * - * It is extracted from the request from which the file has been uploaded. - * Then is should not be considered as a safe value. - * - * @return integer|null The file size - * - * @api - */ - public function getClientSize() - { - return $this->size; - } - - /** - * Returns the upload error. - * - * If the upload was successful, the constant UPLOAD_ERR_OK is returned. - * Otherwise one of the other UPLOAD_ERR_XXX constants is returned. - * - * @return integer The upload error - * - * @api - */ - public function getError() - { - return $this->error; - } - - /** - * Returns whether the file was uploaded successfully. - * - * @return Boolean True if no error occurred during uploading - * - * @api - */ - public function isValid() - { - return $this->error === UPLOAD_ERR_OK; - } - - /** - * Moves the file to a new location. - * - * @param string $directory The destination folder - * @param string $name The new file name - * - * @return File A File object representing the new file - * - * @throws FileException if the file has not been uploaded via Http - * - * @api - */ - public function move($directory, $name = null) - { - if ($this->isValid() && ($this->test || is_uploaded_file($this->getPathname()))) { - return parent::move($directory, $name); - } - - throw new FileException(sprintf('The file "%s" has not been uploaded via Http', $this->getPathname())); - } - - /** - * Returns the maximum size of an uploaded file as configured in php.ini - * - * @return type The maximum size of an uploaded file in bytes - */ - static public function getMaxFilesize() - { - $max = trim(ini_get('upload_max_filesize')); - - if ('' === $max) { - return PHP_INT_MAX; - } - - switch (strtolower(substr($max, -1))) { - case 'g': - $max *= 1024; - case 'm': - $max *= 1024; - case 'k': - $max *= 1024; - } - - return (integer) $max; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/FileBag.php b/core/vendor/Symfony/Component/HttpFoundation/FileBag.php deleted file mode 100644 index 702ab84..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/FileBag.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\HttpFoundation\File\UploadedFile; - -/** - * FileBag is a container for HTTP headers. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - * - * @api - */ -class FileBag extends ParameterBag -{ - static private $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); - - /** - * Constructor. - * - * @param array $parameters An array of HTTP files - * - * @api - */ - public function __construct(array $parameters = array()) - { - $this->replace($parameters); - } - - /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::replace() - * - * @api - */ - public function replace(array $files = array()) - { - $this->parameters = array(); - $this->add($files); - } - - /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::set() - * - * @api - */ - public function set($key, $value) - { - if (is_array($value) || $value instanceof UploadedFile) { - parent::set($key, $this->convertFileInformation($value)); - } else { - throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); - } - } - - /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::add() - * - * @api - */ - public function add(array $files = array()) - { - foreach ($files as $key => $file) { - $this->set($key, $file); - } - } - - /** - * Converts uploaded files to UploadedFile instances. - * - * @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information - * - * @return array A (multi-dimensional) array of UploadedFile instances - */ - protected function convertFileInformation($file) - { - if ($file instanceof UploadedFile) { - return $file; - } - - $file = $this->fixPhpFilesArray($file); - if (is_array($file)) { - $keys = array_keys($file); - sort($keys); - - if ($keys == self::$fileKeys) { - if (UPLOAD_ERR_NO_FILE == $file['error']) { - $file = null; - } else { - $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); - } - } else { - $file = array_map(array($this, 'convertFileInformation'), $file); - } - } - - return $file; - } - - /** - * Fixes a malformed PHP $_FILES array. - * - * PHP has a bug that the format of the $_FILES array differs, depending on - * whether the uploaded file fields had normal field names or array-like - * field names ("normal" vs. "parent[child]"). - * - * This method fixes the array to look like the "normal" $_FILES array. - * - * It's safe to pass an already converted array, in which case this method - * just returns the original array unmodified. - * - * @param array $data - * - * @return array - */ - protected function fixPhpFilesArray($data) - { - if (!is_array($data)) { - return $data; - } - - $keys = array_keys($data); - sort($keys); - - if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) { - return $data; - } - - $files = $data; - foreach (self::$fileKeys as $k) { - unset($files[$k]); - } - - foreach (array_keys($data['name']) as $key) { - $files[$key] = $this->fixPhpFilesArray(array( - 'error' => $data['error'][$key], - 'name' => $data['name'][$key], - 'type' => $data['type'][$key], - 'tmp_name' => $data['tmp_name'][$key], - 'size' => $data['size'][$key] - )); - } - - return $files; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/HeaderBag.php b/core/vendor/Symfony/Component/HttpFoundation/HeaderBag.php deleted file mode 100644 index f614b09..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/HeaderBag.php +++ /dev/null @@ -1,306 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * HeaderBag is a container for HTTP headers. - * - * @author Fabien Potencier - * - * @api - */ -class HeaderBag -{ - protected $headers; - protected $cacheControl; - - /** - * Constructor. - * - * @param array $headers An array of HTTP headers - * - * @api - */ - public function __construct(array $headers = array()) - { - $this->cacheControl = array(); - $this->headers = array(); - foreach ($headers as $key => $values) { - $this->set($key, $values); - } - } - - /** - * Returns the headers as a string. - * - * @return string The headers - */ - public function __toString() - { - if (!$this->headers) { - return ''; - } - - $beautifier = function ($name) { - return preg_replace_callback('/\-(.)/', function ($match) { return '-'.strtoupper($match[1]); }, ucfirst($name)); - }; - - $max = max(array_map('strlen', array_keys($this->headers))) + 1; - $content = ''; - ksort($this->headers); - foreach ($this->headers as $name => $values) { - foreach ($values as $value) { - $content .= sprintf("%-{$max}s %s\r\n", $beautifier($name).':', $value); - } - } - - return $content; - } - - /** - * Returns the headers. - * - * @return array An array of headers - * - * @api - */ - public function all() - { - return $this->headers; - } - - /** - * Returns the parameter keys. - * - * @return array An array of parameter keys - * - * @api - */ - public function keys() - { - return array_keys($this->headers); - } - - /** - * Replaces the current HTTP headers by a new set. - * - * @param array $headers An array of HTTP headers - * - * @api - */ - public function replace(array $headers = array()) - { - $this->headers = array(); - $this->add($headers); - } - - /** - * Adds new headers the current HTTP headers set. - * - * @param array $headers An array of HTTP headers - * - * @api - */ - public function add(array $headers) - { - foreach ($headers as $key => $values) { - $this->set($key, $values); - } - } - - /** - * Returns a header value by name. - * - * @param string $key The header name - * @param mixed $default The default value - * @param Boolean $first Whether to return the first value or all header values - * - * @return string|array The first header value if $first is true, an array of values otherwise - * - * @api - */ - public function get($key, $default = null, $first = true) - { - $key = strtr(strtolower($key), '_', '-'); - - if (!array_key_exists($key, $this->headers)) { - if (null === $default) { - return $first ? null : array(); - } - - return $first ? $default : array($default); - } - - if ($first) { - return count($this->headers[$key]) ? $this->headers[$key][0] : $default; - } - - return $this->headers[$key]; - } - - /** - * Sets a header by name. - * - * @param string $key The key - * @param string|array $values The value or an array of values - * @param Boolean $replace Whether to replace the actual value of not (true by default) - * - * @api - */ - public function set($key, $values, $replace = true) - { - $key = strtr(strtolower($key), '_', '-'); - - $values = (array) $values; - - if (true === $replace || !isset($this->headers[$key])) { - $this->headers[$key] = $values; - } else { - $this->headers[$key] = array_merge($this->headers[$key], $values); - } - - if ('cache-control' === $key) { - $this->cacheControl = $this->parseCacheControl($values[0]); - } - } - - /** - * Returns true if the HTTP header is defined. - * - * @param string $key The HTTP header - * - * @return Boolean true if the parameter exists, false otherwise - * - * @api - */ - public function has($key) - { - return array_key_exists(strtr(strtolower($key), '_', '-'), $this->headers); - } - - /** - * Returns true if the given HTTP header contains the given value. - * - * @param string $key The HTTP header name - * @param string $value The HTTP value - * - * @return Boolean true if the value is contained in the header, false otherwise - * - * @api - */ - public function contains($key, $value) - { - return in_array($value, $this->get($key, null, false)); - } - - /** - * Removes a header. - * - * @param string $key The HTTP header name - * - * @api - */ - public function remove($key) - { - $key = strtr(strtolower($key), '_', '-'); - - unset($this->headers[$key]); - - if ('cache-control' === $key) { - $this->cacheControl = array(); - } - } - - /** - * Returns the HTTP header value converted to a date. - * - * @param string $key The parameter key - * @param \DateTime $default The default value - * - * @return \DateTime The filtered value - * - * @api - */ - public function getDate($key, \DateTime $default = null) - { - if (null === $value = $this->get($key)) { - return $default; - } - - if (false === $date = \DateTime::createFromFormat(DATE_RFC2822, $value)) { - throw new \RuntimeException(sprintf('The %s HTTP header is not parseable (%s).', $key, $value)); - } - - return $date; - } - - public function addCacheControlDirective($key, $value = true) - { - $this->cacheControl[$key] = $value; - - $this->set('Cache-Control', $this->getCacheControlHeader()); - } - - public function hasCacheControlDirective($key) - { - return array_key_exists($key, $this->cacheControl); - } - - public function getCacheControlDirective($key) - { - return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null; - } - - public function removeCacheControlDirective($key) - { - unset($this->cacheControl[$key]); - - $this->set('Cache-Control', $this->getCacheControlHeader()); - } - - protected function getCacheControlHeader() - { - $parts = array(); - ksort($this->cacheControl); - foreach ($this->cacheControl as $key => $value) { - if (true === $value) { - $parts[] = $key; - } else { - if (preg_match('#[^a-zA-Z0-9._-]#', $value)) { - $value = '"'.$value.'"'; - } - - $parts[] = "$key=$value"; - } - } - - return implode(', ', $parts); - } - - /** - * Parses a Cache-Control HTTP header. - * - * @param string $header The value of the Cache-Control HTTP header - * - * @return array An array representing the attribute values - */ - protected function parseCacheControl($header) - { - $cacheControl = array(); - preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $cacheControl[strtolower($match[1])] = isset($match[2]) && $match[2] ? $match[2] : (isset($match[3]) ? $match[3] : true); - } - - return $cacheControl; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/LICENSE b/core/vendor/Symfony/Component/HttpFoundation/LICENSE deleted file mode 100644 index 89df448..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2011 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/core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php b/core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php deleted file mode 100644 index e5d237c..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php +++ /dev/null @@ -1,245 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ParameterBag is a container for key/value pairs. - * - * @author Fabien Potencier - * - * @api - */ -class ParameterBag -{ - protected $parameters; - - /** - * Constructor. - * - * @param array $parameters An array of parameters - * - * @api - */ - public function __construct(array $parameters = array()) - { - $this->parameters = $parameters; - } - - /** - * Returns the parameters. - * - * @return array An array of parameters - * - * @api - */ - public function all() - { - return $this->parameters; - } - - /** - * Returns the parameter keys. - * - * @return array An array of parameter keys - * - * @api - */ - public function keys() - { - return array_keys($this->parameters); - } - - /** - * Replaces the current parameters by a new set. - * - * @param array $parameters An array of parameters - * - * @api - */ - public function replace(array $parameters = array()) - { - $this->parameters = $parameters; - } - - /** - * Adds parameters. - * - * @param array $parameters An array of parameters - * - * @api - */ - public function add(array $parameters = array()) - { - $this->parameters = array_replace($this->parameters, $parameters); - } - - /** - * Returns a parameter by name. - * - * @param string $path The key - * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items - * - * @api - */ - public function get($path, $default = null, $deep = false) - { - if (!$deep || false === $pos = strpos($path, '[')) { - return array_key_exists($path, $this->parameters) ? $this->parameters[$path] : $default; - } - - $root = substr($path, 0, $pos); - if (!array_key_exists($root, $this->parameters)) { - return $default; - } - - $value = $this->parameters[$root]; - $currentKey = null; - for ($i=$pos,$c=strlen($path); $i<$c; $i++) { - $char = $path[$i]; - - if ('[' === $char) { - if (null !== $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "[" at position %d.', $i)); - } - - $currentKey = ''; - } elseif (']' === $char) { - if (null === $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i)); - } - - if (!is_array($value) || !array_key_exists($currentKey, $value)) { - return $default; - } - - $value = $value[$currentKey]; - $currentKey = null; - } else { - if (null === $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "%s" at position %d.', $char, $i)); - } - - $currentKey .= $char; - } - } - - if (null !== $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); - } - - return $value; - } - - /** - * Sets a parameter by name. - * - * @param string $key The key - * @param mixed $value The value - * - * @api - */ - public function set($key, $value) - { - $this->parameters[$key] = $value; - } - - /** - * Returns true if the parameter is defined. - * - * @param string $key The key - * - * @return Boolean true if the parameter exists, false otherwise - * - * @api - */ - public function has($key) - { - return array_key_exists($key, $this->parameters); - } - - /** - * Removes a parameter. - * - * @param string $key The key - * - * @api - */ - public function remove($key) - { - unset($this->parameters[$key]); - } - - /** - * Returns the alphabetic characters of the parameter value. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items - * - * @return string The filtered value - * - * @api - */ - public function getAlpha($key, $default = '', $deep = false) - { - return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default, $deep)); - } - - /** - * Returns the alphabetic characters and digits of the parameter value. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items - * - * @return string The filtered value - * - * @api - */ - public function getAlnum($key, $default = '', $deep = false) - { - return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default, $deep)); - } - - /** - * Returns the digits of the parameter value. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items - * - * @return string The filtered value - * - * @api - */ - public function getDigits($key, $default = '', $deep = false) - { - return preg_replace('/[^[:digit:]]/', '', $this->get($key, $default, $deep)); - } - - /** - * Returns the parameter value converted to integer. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items - * - * @return string The filtered value - * - * @api - */ - public function getInt($key, $default = 0, $deep = false) - { - return (int) $this->get($key, $default, $deep); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php b/core/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php deleted file mode 100644 index 3318b12..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/RedirectResponse.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\HttpFoundation; - -/** - * RedirectResponse represents an HTTP response doing a redirect. - * - * @author Fabien Potencier - * - * @api - */ -class RedirectResponse extends Response -{ - /** - * Creates a redirect response so that it conforms to the rules defined for a redirect status code. - * - * @param string $url The URL to redirect to - * @param integer $status The status code (302 by default) - * - * @see http://tools.ietf.org/html/rfc2616#section-10.3 - * - * @api - */ - public function __construct($url, $status = 302) - { - if (empty($url)) { - throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); - } - - parent::__construct( - sprintf(' - - - - - - Redirecting to %1$s - - - Redirecting to %1$s. - -', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')), - $status, - array('Location' => $url) - ); - - if (!$this->isRedirect()) { - throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); - } - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Request.php b/core/vendor/Symfony/Component/HttpFoundation/Request.php deleted file mode 100644 index 3a20ed9..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Request.php +++ /dev/null @@ -1,1243 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Request represents an HTTP request. - * - * @author Fabien Potencier - * - * @api - */ -class Request -{ - static protected $trustProxy = false; - - /** - * @var \Symfony\Component\HttpFoundation\ParameterBag - * - * @api - */ - public $attributes; - - /** - * @var \Symfony\Component\HttpFoundation\ParameterBag - * - * @api - */ - public $request; - - /** - * @var \Symfony\Component\HttpFoundation\ParameterBag - * - * @api - */ - public $query; - - /** - * @var \Symfony\Component\HttpFoundation\ServerBag - * - * @api - */ - public $server; - - /** - * @var \Symfony\Component\HttpFoundation\FileBag - * - * @api - */ - public $files; - - /** - * @var \Symfony\Component\HttpFoundation\ParameterBag - * - * @api - */ - public $cookies; - - /** - * @var \Symfony\Component\HttpFoundation\HeaderBag - * - * @api - */ - public $headers; - - protected $content; - protected $languages; - protected $charsets; - protected $acceptableContentTypes; - protected $pathInfo; - protected $requestUri; - protected $baseUrl; - protected $basePath; - protected $method; - protected $format; - protected $session; - - static protected $formats; - - /** - * Constructor. - * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * @param string $content The raw body data - * - * @api - */ - public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) - { - $this->initialize($query, $request, $attributes, $cookies, $files, $server, $content); - } - - /** - * Sets the parameters for this request. - * - * This method also re-initializes all properties. - * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * @param string $content The raw body data - * - * @api - */ - public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) - { - $this->request = new ParameterBag($request); - $this->query = new ParameterBag($query); - $this->attributes = new ParameterBag($attributes); - $this->cookies = new ParameterBag($cookies); - $this->files = new FileBag($files); - $this->server = new ServerBag($server); - $this->headers = new HeaderBag($this->server->getHeaders()); - - $this->content = $content; - $this->languages = null; - $this->charsets = null; - $this->acceptableContentTypes = null; - $this->pathInfo = null; - $this->requestUri = null; - $this->baseUrl = null; - $this->basePath = null; - $this->method = null; - $this->format = null; - } - - /** - * Creates a new request with values from PHP's super globals. - * - * @return Request A new request - * - * @api - */ - static public function createFromGlobals() - { - $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); - - if (0 === strpos($request->server->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') - && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE')) - ) { - parse_str($request->getContent(), $data); - $request->request = new ParameterBag($data); - } - - return $request; - } - - /** - * Creates a Request based on a given URI and configuration. - * - * @param string $uri The URI - * @param string $method The HTTP method - * @param array $parameters The request (GET) or query (POST) parameters - * @param array $cookies The request cookies ($_COOKIE) - * @param array $files The request files ($_FILES) - * @param array $server The server parameters ($_SERVER) - * @param string $content The raw body data - * - * @return Request A Request instance - * - * @api - */ - static public function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) - { - $defaults = array( - 'SERVER_NAME' => 'localhost', - 'SERVER_PORT' => 80, - 'HTTP_HOST' => 'localhost', - 'HTTP_USER_AGENT' => 'Symfony/2.X', - 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', - 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', - 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', - 'REMOTE_ADDR' => '127.0.0.1', - 'SCRIPT_NAME' => '', - 'SCRIPT_FILENAME' => '', - 'SERVER_PROTOCOL' => 'HTTP/1.1', - 'REQUEST_TIME' => time(), - ); - - $components = parse_url($uri); - if (isset($components['host'])) { - $defaults['SERVER_NAME'] = $components['host']; - $defaults['HTTP_HOST'] = $components['host']; - } - - if (isset($components['scheme'])) { - if ('https' === $components['scheme']) { - $defaults['HTTPS'] = 'on'; - $defaults['SERVER_PORT'] = 443; - } - } - - if (isset($components['port'])) { - $defaults['SERVER_PORT'] = $components['port']; - $defaults['HTTP_HOST'] = $defaults['HTTP_HOST'].':'.$components['port']; - } - - if (!isset($components['path'])) { - $components['path'] = ''; - } - - if (in_array(strtoupper($method), array('POST', 'PUT', 'DELETE'))) { - $request = $parameters; - $query = array(); - $defaults['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; - } else { - $request = array(); - $query = $parameters; - if (false !== $pos = strpos($uri, '?')) { - $qs = substr($uri, $pos + 1); - parse_str($qs, $params); - - $query = array_merge($params, $query); - } - } - - $queryString = isset($components['query']) ? html_entity_decode($components['query']) : ''; - parse_str($queryString, $qs); - if (is_array($qs)) { - $query = array_replace($qs, $query); - } - - $uri = $components['path'].($queryString ? '?'.$queryString : ''); - - $server = array_replace($defaults, $server, array( - 'REQUEST_METHOD' => strtoupper($method), - 'PATH_INFO' => '', - 'REQUEST_URI' => $uri, - 'QUERY_STRING' => $queryString, - )); - - return new static($query, $request, array(), $cookies, $files, $server, $content); - } - - /** - * Clones a request and overrides some of its parameters. - * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * - * @api - */ - public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) - { - $dup = clone $this; - if ($query !== null) { - $dup->query = new ParameterBag($query); - } - if ($request !== null) { - $dup->request = new ParameterBag($request); - } - if ($attributes !== null) { - $dup->attributes = new ParameterBag($attributes); - } - if ($cookies !== null) { - $dup->cookies = new ParameterBag($cookies); - } - if ($files !== null) { - $dup->files = new FileBag($files); - } - if ($server !== null) { - $dup->server = new ServerBag($server); - $dup->headers = new HeaderBag($dup->server->getHeaders()); - } - $dup->languages = null; - $dup->charsets = null; - $dup->acceptableContentTypes = null; - $dup->pathInfo = null; - $dup->requestUri = null; - $dup->baseUrl = null; - $dup->basePath = null; - $dup->method = null; - $dup->format = null; - - return $dup; - } - - /** - * Clones the current request. - * - * Note that the session is not cloned as duplicated requests - * are most of the time sub-requests of the main one. - */ - public function __clone() - { - $this->query = clone $this->query; - $this->request = clone $this->request; - $this->attributes = clone $this->attributes; - $this->cookies = clone $this->cookies; - $this->files = clone $this->files; - $this->server = clone $this->server; - $this->headers = clone $this->headers; - } - - /** - * Returns the request as a string. - * - * @return string The request - */ - public function __toString() - { - return - sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n". - $this->headers."\r\n". - $this->getContent(); - } - - /** - * Overrides the PHP global variables according to this request instance. - * - * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE, and $_FILES. - * - * @api - */ - public function overrideGlobals() - { - $_GET = $this->query->all(); - $_POST = $this->request->all(); - $_SERVER = $this->server->all(); - $_COOKIE = $this->cookies->all(); - // FIXME: populate $_FILES - - foreach ($this->headers->all() as $key => $value) { - $key = strtoupper(str_replace('-', '_', $key)); - if (in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) { - $_SERVER[$key] = implode(', ', $value); - } else { - $_SERVER['HTTP_'.$key] = implode(', ', $value); - } - } - - // FIXME: should read variables_order and request_order - // to know which globals to merge and in which order - $_REQUEST = array_merge($_GET, $_POST); - } - - /** - * Trusts $_SERVER entries coming from proxies. - * - * You should only call this method if your application - * is hosted behind a reverse proxy that you manage. - * - * @api - */ - static public function trustProxyData() - { - self::$trustProxy = true; - } - - /** - * Gets a "parameter" value. - * - * This method is mainly useful for libraries that want to provide some flexibility. - * - * Order of precedence: GET, PATH, POST, COOKIE - * Avoid using this method in controllers: - * * slow - * * prefer to get from a "named" source - * - * @param string $key the key - * @param mixed $default the default value - * @param type $deep is parameter deep in multidimensional array - * - * @return mixed - */ - public function get($key, $default = null, $deep = false) - { - return $this->query->get($key, $this->attributes->get($key, $this->request->get($key, $default, $deep), $deep), $deep); - } - - /** - * Gets the Session. - * - * @return Session|null The session - * - * @api - */ - public function getSession() - { - return $this->session; - } - - /** - * Whether the request contains a Session which was started in one of the - * previous requests. - * - * @return boolean - * - * @api - */ - public function hasPreviousSession() - { - // the check for $this->session avoids malicious users trying to fake a session cookie with proper name - return $this->cookies->has(session_name()) && null !== $this->session; - } - - /** - * Whether the request contains a Session object. - * - * @return boolean - * - * @api - */ - public function hasSession() - { - return null !== $this->session; - } - - /** - * Sets the Session. - * - * @param Session $session The Session - * - * @api - */ - public function setSession(Session $session) - { - $this->session = $session; - } - - /** - * Returns the client IP address. - * - * @param Boolean $proxy Whether the current request has been made behind a proxy or not - * - * @return string The client IP address - * - * @api - */ - public function getClientIp($proxy = false) - { - if ($proxy) { - if ($this->server->has('HTTP_CLIENT_IP')) { - return $this->server->get('HTTP_CLIENT_IP'); - } elseif (self::$trustProxy && $this->server->has('HTTP_X_FORWARDED_FOR')) { - $clientIp = explode(',', $this->server->get('HTTP_X_FORWARDED_FOR'), 2); - - return isset($clientIp[0]) ? trim($clientIp[0]) : ''; - } - } - - return $this->server->get('REMOTE_ADDR'); - } - - /** - * Returns current script name. - * - * @return string - * - * @api - */ - public function getScriptName() - { - return $this->server->get('SCRIPT_NAME', $this->server->get('ORIG_SCRIPT_NAME', '')); - } - - /** - * Returns the path being requested relative to the executed script. - * - * The path info always starts with a /. - * - * Suppose this request is instantiated from /mysite on localhost: - * - * * http://localhost/mysite returns an empty string - * * http://localhost/mysite/about returns '/about' - * * http://localhost/mysite/about?var=1 returns '/about' - * - * @return string - * - * @api - */ - public function getPathInfo() - { - if (null === $this->pathInfo) { - $this->pathInfo = $this->preparePathInfo(); - } - - return $this->pathInfo; - } - - /** - * Returns the root path from which this request is executed. - * - * Suppose that an index.php file instantiates this request object: - * - * * http://localhost/index.php returns an empty string - * * http://localhost/index.php/page returns an empty string - * * http://localhost/web/index.php return '/web' - * - * @return string - * - * @api - */ - public function getBasePath() - { - if (null === $this->basePath) { - $this->basePath = $this->prepareBasePath(); - } - - return $this->basePath; - } - - /** - * Returns the root url from which this request is executed. - * - * The base URL never ends with a /. - * - * This is similar to getBasePath(), except that it also includes the - * script filename (e.g. index.php) if one exists. - * - * @return string - * - * @api - */ - public function getBaseUrl() - { - if (null === $this->baseUrl) { - $this->baseUrl = $this->prepareBaseUrl(); - } - - return $this->baseUrl; - } - - /** - * Gets the request's scheme. - * - * @return string - * - * @api - */ - public function getScheme() - { - return $this->isSecure() ? 'https' : 'http'; - } - - /** - * Returns the port on which the request is made. - * - * @return string - * - * @api - */ - public function getPort() - { - if (self::$trustProxy && $this->headers->has('X-Forwarded-Port')) { - return $this->headers->get('X-Forwarded-Port'); - } else { - return $this->server->get('SERVER_PORT'); - } - } - - /** - * Returns the HTTP host being requested. - * - * The port name will be appended to the host if it's non-standard. - * - * @return string - * - * @api - */ - public function getHttpHost() - { - $scheme = $this->getScheme(); - $port = $this->getPort(); - - if (('http' == $scheme && $port == 80) || ('https' == $scheme && $port == 443)) { - return $this->getHost(); - } - - return $this->getHost().':'.$port; - } - - /** - * Returns the requested URI. - * - * @return string - * - * @api - */ - public function getRequestUri() - { - if (null === $this->requestUri) { - $this->requestUri = $this->prepareRequestUri(); - } - - return $this->requestUri; - } - - /** - * Generates a normalized URI for the Request. - * - * @return string A normalized URI for the Request - * - * @see getQueryString() - * - * @api - */ - public function getUri() - { - $qs = $this->getQueryString(); - if (null !== $qs) { - $qs = '?'.$qs; - } - - return $this->getScheme().'://'.$this->getHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; - } - - /** - * Generates a normalized URI for the given path. - * - * @param string $path A path to use instead of the current one - * - * @return string The normalized URI for the path - * - * @api - */ - public function getUriForPath($path) - { - return $this->getScheme().'://'.$this->getHttpHost().$this->getBaseUrl().$path; - } - - /** - * Generates the normalized query string for the Request. - * - * It builds a normalized query string, where keys/value pairs are alphabetized - * and have consistent escaping. - * - * @return string|null A normalized query string for the Request - * - * @api - */ - public function getQueryString() - { - if (!$qs = $this->server->get('QUERY_STRING')) { - return null; - } - - $parts = array(); - $order = array(); - - foreach (explode('&', $qs) as $segment) { - if (false === strpos($segment, '=')) { - $parts[] = $segment; - $order[] = $segment; - } else { - $tmp = explode('=', rawurldecode($segment), 2); - $parts[] = rawurlencode($tmp[0]).'='.rawurlencode($tmp[1]); - $order[] = $tmp[0]; - } - } - array_multisort($order, SORT_ASC, $parts); - - return implode('&', $parts); - } - - /** - * Checks whether the request is secure or not. - * - * @return Boolean - * - * @api - */ - public function isSecure() - { - return ( - (strtolower($this->server->get('HTTPS')) == 'on' || $this->server->get('HTTPS') == 1) - || - (self::$trustProxy && strtolower($this->headers->get('SSL_HTTPS')) == 'on' || $this->headers->get('SSL_HTTPS') == 1) - || - (self::$trustProxy && strtolower($this->headers->get('X_FORWARDED_PROTO')) == 'https') - ); - } - - /** - * Returns the host name. - * - * @return string - * - * @api - */ - public function getHost() - { - if (self::$trustProxy && $host = $this->headers->get('X_FORWARDED_HOST')) { - $elements = explode(',', $host); - - $host = trim($elements[count($elements) - 1]); - } else { - if (!$host = $this->headers->get('HOST')) { - if (!$host = $this->server->get('SERVER_NAME')) { - $host = $this->server->get('SERVER_ADDR', ''); - } - } - } - - // Remove port number from host - $host = preg_replace('/:\d+$/', '', $host); - - return trim($host); - } - - /** - * Sets the request method. - * - * @param string $method - * - * @api - */ - public function setMethod($method) - { - $this->method = null; - $this->server->set('REQUEST_METHOD', $method); - } - - /** - * Gets the request method. - * - * The method is always an uppercased string. - * - * @return string The request method - * - * @api - */ - public function getMethod() - { - if (null === $this->method) { - $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); - if ('POST' === $this->method) { - $this->method = strtoupper($this->headers->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', 'POST'))); - } - } - - return $this->method; - } - - /** - * Gets the mime type associated with the format. - * - * @param string $format The format - * - * @return string The associated mime type (null if not found) - * - * @api - */ - public function getMimeType($format) - { - if (null === static::$formats) { - static::initializeFormats(); - } - - return isset(static::$formats[$format]) ? static::$formats[$format][0] : null; - } - - /** - * Gets the format associated with the mime type. - * - * @param string $mimeType The associated mime type - * - * @return string The format (null if not found) - * - * @api - */ - public function getFormat($mimeType) - { - if (false !== $pos = strpos($mimeType, ';')) { - $mimeType = substr($mimeType, 0, $pos); - } - - if (null === static::$formats) { - static::initializeFormats(); - } - - foreach (static::$formats as $format => $mimeTypes) { - if (in_array($mimeType, (array) $mimeTypes)) { - return $format; - } - } - - return null; - } - - /** - * Associates a format with mime types. - * - * @param string $format The format - * @param string|array $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type) - * - * @api - */ - public function setFormat($format, $mimeTypes) - { - if (null === static::$formats) { - static::initializeFormats(); - } - - static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes); - } - - /** - * Gets the request format. - * - * Here is the process to determine the format: - * - * * format defined by the user (with setRequestFormat()) - * * _format request parameter - * * $default - * - * @param string $default The default format - * - * @return string The request format - * - * @api - */ - public function getRequestFormat($default = 'html') - { - if (null === $this->format) { - $this->format = $this->get('_format', $default); - } - - return $this->format; - } - - /** - * Sets the request format. - * - * @param string $format The request format. - * - * @api - */ - public function setRequestFormat($format) - { - $this->format = $format; - } - - public function setLocale($locale) - { - if (!$this->hasSession()) { - throw new \LogicException('Forward compatibility for Request::setLocale() requires the session to be set.'); - } - - $this->session->setLocale($locale); - } - - public function getLocale() - { - if (!$this->hasSession()) { - throw new \LogicException('Forward compatibility for Request::getLocale() requires the session to be set.'); - } - - return $this->session->getLocale(); - } - - /** - * Checks whether the method is safe or not. - * - * @return Boolean - * - * @api - */ - public function isMethodSafe() - { - return in_array($this->getMethod(), array('GET', 'HEAD')); - } - - /** - * Returns the request body content. - * - * @param Boolean $asResource If true, a resource will be returned - * - * @return string|resource The request body content or a resource to read the body stream. - */ - public function getContent($asResource = false) - { - if (false === $this->content || (true === $asResource && null !== $this->content)) { - throw new \LogicException('getContent() can only be called once when using the resource return type.'); - } - - if (true === $asResource) { - $this->content = false; - - return fopen('php://input', 'rb'); - } - - if (null === $this->content) { - $this->content = file_get_contents('php://input'); - } - - return $this->content; - } - - /** - * Gets the Etags. - * - * @return array The entity tags - */ - public function getETags() - { - return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY); - } - - public function isNoCache() - { - return $this->headers->hasCacheControlDirective('no-cache') || 'no-cache' == $this->headers->get('Pragma'); - } - - /** - * Returns the preferred language. - * - * @param array $locales An array of ordered available locales - * - * @return string|null The preferred locale - * - * @api - */ - public function getPreferredLanguage(array $locales = null) - { - $preferredLanguages = $this->getLanguages(); - - if (empty($locales)) { - return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null; - } - - if (!$preferredLanguages) { - return $locales[0]; - } - - $preferredLanguages = array_values(array_intersect($preferredLanguages, $locales)); - - return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0]; - } - - /** - * Gets a list of languages acceptable by the client browser. - * - * @return array Languages ordered in the user browser preferences - * - * @api - */ - public function getLanguages() - { - if (null !== $this->languages) { - return $this->languages; - } - - $languages = $this->splitHttpAcceptHeader($this->headers->get('Accept-Language')); - $this->languages = array(); - foreach ($languages as $lang => $q) { - if (strstr($lang, '-')) { - $codes = explode('-', $lang); - if ($codes[0] == 'i') { - // Language not listed in ISO 639 that are not variants - // of any listed language, which can be registered with the - // i-prefix, such as i-cherokee - if (count($codes) > 1) { - $lang = $codes[1]; - } - } else { - for ($i = 0, $max = count($codes); $i < $max; $i++) { - if ($i == 0) { - $lang = strtolower($codes[0]); - } else { - $lang .= '_'.strtoupper($codes[$i]); - } - } - } - } - - $this->languages[] = $lang; - } - - return $this->languages; - } - - /** - * Gets a list of charsets acceptable by the client browser. - * - * @return array List of charsets in preferable order - * - * @api - */ - public function getCharsets() - { - if (null !== $this->charsets) { - return $this->charsets; - } - - return $this->charsets = array_keys($this->splitHttpAcceptHeader($this->headers->get('Accept-Charset'))); - } - - /** - * Gets a list of content types acceptable by the client browser - * - * @return array List of content types in preferable order - * - * @api - */ - public function getAcceptableContentTypes() - { - if (null !== $this->acceptableContentTypes) { - return $this->acceptableContentTypes; - } - - return $this->acceptableContentTypes = array_keys($this->splitHttpAcceptHeader($this->headers->get('Accept'))); - } - - /** - * Returns true if the request is a XMLHttpRequest. - * - * It works if your JavaScript library set an X-Requested-With HTTP header. - * It is known to work with Prototype, Mootools, jQuery. - * - * @return Boolean true if the request is an XMLHttpRequest, false otherwise - * - * @api - */ - public function isXmlHttpRequest() - { - return 'XMLHttpRequest' == $this->headers->get('X-Requested-With'); - } - - /** - * Splits an Accept-* HTTP header. - * - * @param string $header Header to split - * - * @return array Array indexed by the values of the Accept-* header in preferred order - */ - public function splitHttpAcceptHeader($header) - { - if (!$header) { - return array(); - } - - $values = array(); - foreach (array_filter(explode(',', $header)) as $value) { - // Cut off any q-value that might come after a semi-colon - if (preg_match('/;\s*(q=.*$)/', $value, $match)) { - $q = (float) substr(trim($match[1]), 2); - $value = trim(substr($value, 0, -strlen($match[0]))); - } else { - $q = 1; - } - - if (0 < $q) { - $values[trim($value)] = $q; - } - } - - arsort($values); - reset($values); - - return $values; - } - - /* - * The following methods are derived from code of the Zend Framework (1.10dev - 2010-01-24) - * - * Code subject to the new BSD license (http://framework.zend.com/license/new-bsd). - * - * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - */ - - protected function prepareRequestUri() - { - $requestUri = ''; - - if ($this->headers->has('X_REWRITE_URL') && false !== stripos(PHP_OS, 'WIN')) { - // check this first so IIS will catch - $requestUri = $this->headers->get('X_REWRITE_URL'); - } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') { - // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem) - $requestUri = $this->server->get('UNENCODED_URL'); - } elseif ($this->server->has('REQUEST_URI')) { - $requestUri = $this->server->get('REQUEST_URI'); - // HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path - $schemeAndHttpHost = $this->getScheme().'://'.$this->getHttpHost(); - if (strpos($requestUri, $schemeAndHttpHost) === 0) { - $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); - } - } elseif ($this->server->has('ORIG_PATH_INFO')) { - // IIS 5.0, PHP as CGI - $requestUri = $this->server->get('ORIG_PATH_INFO'); - if ($this->server->get('QUERY_STRING')) { - $requestUri .= '?'.$this->server->get('QUERY_STRING'); - } - } - - return $requestUri; - } - - protected function prepareBaseUrl() - { - $filename = basename($this->server->get('SCRIPT_FILENAME')); - - if (basename($this->server->get('SCRIPT_NAME')) === $filename) { - $baseUrl = $this->server->get('SCRIPT_NAME'); - } elseif (basename($this->server->get('PHP_SELF')) === $filename) { - $baseUrl = $this->server->get('PHP_SELF'); - } elseif (basename($this->server->get('ORIG_SCRIPT_NAME')) === $filename) { - $baseUrl = $this->server->get('ORIG_SCRIPT_NAME'); // 1and1 shared hosting compatibility - } else { - // Backtrack up the script_filename to find the portion matching - // php_self - $path = $this->server->get('PHP_SELF', ''); - $file = $this->server->get('SCRIPT_FILENAME', ''); - $segs = explode('/', trim($file, '/')); - $segs = array_reverse($segs); - $index = 0; - $last = count($segs); - $baseUrl = ''; - do { - $seg = $segs[$index]; - $baseUrl = '/'.$seg.$baseUrl; - ++$index; - } while (($last > $index) && (false !== ($pos = strpos($path, $baseUrl))) && (0 != $pos)); - } - - // Does the baseUrl have anything in common with the request_uri? - $requestUri = $this->getRequestUri(); - - if ($baseUrl && 0 === strpos($requestUri, $baseUrl)) { - // full $baseUrl matches - return $baseUrl; - } - - if ($baseUrl && 0 === strpos($requestUri, dirname($baseUrl))) { - // directory portion of $baseUrl matches - return rtrim(dirname($baseUrl), '/'); - } - - $truncatedRequestUri = $requestUri; - if (($pos = strpos($requestUri, '?')) !== false) { - $truncatedRequestUri = substr($requestUri, 0, $pos); - } - - $basename = basename($baseUrl); - if (empty($basename) || !strpos($truncatedRequestUri, $basename)) { - // no match whatsoever; set it blank - return ''; - } - - // If using mod_rewrite or ISAPI_Rewrite strip the script filename - // out of baseUrl. $pos !== 0 makes sure it is not matching a value - // from PATH_INFO or QUERY_STRING - if ((strlen($requestUri) >= strlen($baseUrl)) && ((false !== ($pos = strpos($requestUri, $baseUrl))) && ($pos !== 0))) { - $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl)); - } - - return rtrim($baseUrl, '/'); - } - - /** - * Prepares base path. - * - * @return string base path - */ - protected function prepareBasePath() - { - $filename = basename($this->server->get('SCRIPT_FILENAME')); - $baseUrl = $this->getBaseUrl(); - if (empty($baseUrl)) { - return ''; - } - - if (basename($baseUrl) === $filename) { - $basePath = dirname($baseUrl); - } else { - $basePath = $baseUrl; - } - - if ('\\' === DIRECTORY_SEPARATOR) { - $basePath = str_replace('\\', '/', $basePath); - } - - return rtrim($basePath, '/'); - } - - /** - * Prepares path info. - * - * @return string path info - */ - protected function preparePathInfo() - { - $baseUrl = $this->getBaseUrl(); - - if (null === ($requestUri = $this->getRequestUri())) { - return '/'; - } - - $pathInfo = '/'; - - // Remove the query string from REQUEST_URI - if ($pos = strpos($requestUri, '?')) { - $requestUri = substr($requestUri, 0, $pos); - } - - if ((null !== $baseUrl) && (false === ($pathInfo = substr(urldecode($requestUri), strlen(urldecode($baseUrl)))))) { - // If substr() returns false then PATH_INFO is set to an empty string - return '/'; - } elseif (null === $baseUrl) { - return $requestUri; - } - - return (string) $pathInfo; - } - - /** - * Initializes HTTP request formats. - */ - static protected function initializeFormats() - { - static::$formats = array( - 'html' => array('text/html', 'application/xhtml+xml'), - 'txt' => array('text/plain'), - 'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'), - 'css' => array('text/css'), - 'json' => array('application/json', 'application/x-json'), - 'xml' => array('text/xml', 'application/xml', 'application/x-xml'), - 'rdf' => array('application/rdf+xml'), - 'atom' => array('application/atom+xml'), - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php b/core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php deleted file mode 100644 index e82b3e1..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php +++ /dev/null @@ -1,177 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * RequestMatcher compares a pre-defined set of checks against a Request instance. - * - * @author Fabien Potencier - * - * @api - */ -class RequestMatcher implements RequestMatcherInterface -{ - private $path; - private $host; - private $methods; - private $ip; - private $attributes; - - public function __construct($path = null, $host = null, $methods = null, $ip = null, array $attributes = array()) - { - $this->path = $path; - $this->host = $host; - $this->methods = $methods; - $this->ip = $ip; - $this->attributes = $attributes; - } - - /** - * Adds a check for the URL host name. - * - * @param string $regexp A Regexp - */ - public function matchHost($regexp) - { - $this->host = $regexp; - } - - /** - * Adds a check for the URL path info. - * - * @param string $regexp A Regexp - */ - public function matchPath($regexp) - { - $this->path = $regexp; - } - - /** - * Adds a check for the client IP. - * - * @param string $ip A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 - */ - public function matchIp($ip) - { - $this->ip = $ip; - } - - /** - * Adds a check for the HTTP method. - * - * @param string|array $method An HTTP method or an array of HTTP methods - */ - public function matchMethod($method) - { - $this->methods = array_map('strtoupper', is_array($method) ? $method : array($method)); - } - - /** - * Adds a check for request attribute. - * - * @param string $key The request attribute name - * @param string $regexp A Regexp - */ - public function matchAttribute($key, $regexp) - { - $this->attributes[$key] = $regexp; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function matches(Request $request) - { - if (null !== $this->methods && !in_array($request->getMethod(), $this->methods)) { - return false; - } - - foreach ($this->attributes as $key => $pattern) { - if (!preg_match('#'.str_replace('#', '\\#', $pattern).'#', $request->attributes->get($key))) { - return false; - } - } - - if (null !== $this->path) { - $path = str_replace('#', '\\#', $this->path); - - if (!preg_match('#'.$path.'#', $request->getPathInfo())) { - return false; - } - } - - if (null !== $this->host && !preg_match('#'.str_replace('#', '\\#', $this->host).'#', $request->getHost())) { - return false; - } - - if (null !== $this->ip && !$this->checkIp($request->getClientIp(), $this->ip)) { - return false; - } - - return true; - } - - protected function checkIp($requestIp, $ip) - { - // IPv6 address - if (false !== strpos($requestIp, ':')) { - return $this->checkIp6($requestIp, $ip); - } else { - return $this->checkIp4($requestIp, $ip); - } - } - - protected function checkIp4($requestIp, $ip) - { - if (false !== strpos($ip, '/')) { - list($address, $netmask) = explode('/', $ip, 2); - - if ($netmask < 1 || $netmask > 32) { - return false; - } - } else { - $address = $ip; - $netmask = 32; - } - - return 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask); - } - - /** - * @author David Soria Parra - * @see https://github.com/dsp/v6tools - */ - protected function checkIp6($requestIp, $ip) - { - if (!defined('AF_INET6')) { - throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); - } - - list($address, $netmask) = explode('/', $ip, 2); - - $bytes_addr = unpack("n*", inet_pton($address)); - $bytes_test = unpack("n*", inet_pton($requestIp)); - - for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) { - $left = $netmask - 16 * ($i-1); - $left = ($left <= 16) ? $left : 16; - $mask = ~(0xffff >> $left) & 0xffff; - if (($bytes_addr[$i] & $mask) != ($bytes_test[$i] & $mask)) { - return false; - } - } - - return true; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.php b/core/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.php deleted file mode 100644 index 506ec79..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.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\HttpFoundation; - -/** - * RequestMatcherInterface is an interface for strategies to match a Request. - * - * @author Fabien Potencier - * - * @api - */ -interface RequestMatcherInterface -{ - /** - * Decides whether the rule(s) implemented by the strategy matches the supplied request. - * - * @param Request $request The request to check for a match - * - * @return Boolean true if the request matches, false otherwise - * - * @api - */ - function matches(Request $request); -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Response.php b/core/vendor/Symfony/Component/HttpFoundation/Response.php deleted file mode 100644 index b6cb484..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Response.php +++ /dev/null @@ -1,891 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Response represents an HTTP response. - * - * @author Fabien Potencier - * - * @api - */ -class Response -{ - /** - * @var \Symfony\Component\HttpFoundation\ResponseHeaderBag - */ - public $headers; - - protected $content; - protected $version; - protected $statusCode; - protected $statusText; - protected $charset; - - static public $statusTexts = array( - 100 => 'Continue', - 101 => 'Switching Protocols', - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 307 => 'Temporary Redirect', - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - 418 => 'I\'m a teapot', - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported', - ); - - /** - * Constructor. - * - * @param string $content The response content - * @param integer $status The response status code - * @param array $headers An array of response headers - * - * @api - */ - public function __construct($content = '', $status = 200, $headers = array()) - { - $this->headers = new ResponseHeaderBag($headers); - $this->setContent($content); - $this->setStatusCode($status); - $this->setProtocolVersion('1.0'); - if (!$this->headers->has('Date')) { - $this->setDate(new \DateTime(null, new \DateTimeZone('UTC'))); - } - } - - /** - * Returns the response content as it will be sent (with the headers). - * - * @return string The response content - */ - public function __toString() - { - $this->prepare(); - - return - sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n". - $this->headers."\r\n". - $this->getContent(); - } - - /** - * Clones the current Response instance. - */ - public function __clone() - { - $this->headers = clone $this->headers; - } - - /** - * Prepares the Response before it is sent to the client. - * - * This method tweaks the Response to ensure that it is - * compliant with RFC 2616. - */ - public function prepare() - { - if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) { - $this->setContent(''); - } - - // Fix Content-Type - $charset = $this->charset ?: 'UTF-8'; - if (!$this->headers->has('Content-Type')) { - $this->headers->set('Content-Type', 'text/html; charset='.$charset); - } elseif (0 === strpos($this->headers->get('Content-Type'), 'text/') && false === strpos($this->headers->get('Content-Type'), 'charset')) { - // add the charset - $this->headers->set('Content-Type', $this->headers->get('Content-Type').'; charset='.$charset); - } - - // Fix Content-Length - if ($this->headers->has('Transfer-Encoding')) { - $this->headers->remove('Content-Length'); - } - } - - /** - * Sends HTTP headers. - */ - public function sendHeaders() - { - // headers have already been sent by the developer - if (headers_sent()) { - return; - } - - $this->prepare(); - - // status - header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)); - - // headers - foreach ($this->headers->all() as $name => $values) { - foreach ($values as $value) { - header($name.': '.$value, false); - } - } - - // cookies - foreach ($this->headers->getCookies() as $cookie) { - setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } - } - - /** - * Sends content for the current web response. - */ - public function sendContent() - { - echo $this->content; - } - - /** - * Sends HTTP headers and content. - * - * @api - */ - public function send() - { - $this->sendHeaders(); - $this->sendContent(); - - if (function_exists('fastcgi_finish_request')) { - fastcgi_finish_request(); - } - } - - /** - * Sets the response content. - * - * Valid types are strings, numbers, and objects that implement a __toString() method. - * - * @param mixed $content - * - * @api - */ - public function setContent($content) - { - if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array($content, '__toString'))) { - throw new \UnexpectedValueException('The Response content must be a string or object implementing __toString(), "'.gettype($content).'" given.'); - } - - $this->content = (string) $content; - } - - /** - * Gets the current response content. - * - * @return string Content - * - * @api - */ - public function getContent() - { - return $this->content; - } - - /** - * Sets the HTTP protocol version (1.0 or 1.1). - * - * @param string $version The HTTP protocol version - * - * @api - */ - public function setProtocolVersion($version) - { - $this->version = $version; - } - - /** - * Gets the HTTP protocol version. - * - * @return string The HTTP protocol version - * - * @api - */ - public function getProtocolVersion() - { - return $this->version; - } - - /** - * Sets the response status code. - * - * @param integer $code HTTP status code - * @param string $text HTTP status text - * - * @throws \InvalidArgumentException When the HTTP status code is not valid - * - * @api - */ - public function setStatusCode($code, $text = null) - { - $this->statusCode = (int) $code; - if ($this->isInvalid()) { - throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code)); - } - - $this->statusText = false === $text ? '' : (null === $text ? self::$statusTexts[$this->statusCode] : $text); - } - - /** - * Retrieves the status code for the current web response. - * - * @return string Status code - * - * @api - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * Sets the response charset. - * - * @param string $charset Character set - * - * @api - */ - public function setCharset($charset) - { - $this->charset = $charset; - } - - /** - * Retrieves the response charset. - * - * @return string Character set - * - * @api - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Returns true if the response is worth caching under any circumstance. - * - * Responses marked "private" with an explicit Cache-Control directive are - * considered uncacheable. - * - * Responses with neither a freshness lifetime (Expires, max-age) nor cache - * validator (Last-Modified, ETag) are considered uncacheable. - * - * @return Boolean true if the response is worth caching, false otherwise - * - * @api - */ - public function isCacheable() - { - if (!in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) { - return false; - } - - if ($this->headers->hasCacheControlDirective('no-store') || $this->headers->getCacheControlDirective('private')) { - return false; - } - - return $this->isValidateable() || $this->isFresh(); - } - - /** - * Returns true if the response is "fresh". - * - * Fresh responses may be served from cache without any interaction with the - * origin. A response is considered fresh when it includes a Cache-Control/max-age - * indicator or Expiration header and the calculated age is less than the freshness lifetime. - * - * @return Boolean true if the response is fresh, false otherwise - * - * @api - */ - public function isFresh() - { - return $this->getTtl() > 0; - } - - /** - * Returns true if the response includes headers that can be used to validate - * the response with the origin server using a conditional GET request. - * - * @return Boolean true if the response is validateable, false otherwise - * - * @api - */ - public function isValidateable() - { - return $this->headers->has('Last-Modified') || $this->headers->has('ETag'); - } - - /** - * Marks the response as "private". - * - * It makes the response ineligible for serving other clients. - * - * @api - */ - public function setPrivate() - { - $this->headers->removeCacheControlDirective('public'); - $this->headers->addCacheControlDirective('private'); - } - - /** - * Marks the response as "public". - * - * It makes the response eligible for serving other clients. - * - * @api - */ - public function setPublic() - { - $this->headers->addCacheControlDirective('public'); - $this->headers->removeCacheControlDirective('private'); - } - - /** - * Returns true if the response must be revalidated by caches. - * - * This method indicates that the response must not be served stale by a - * cache in any circumstance without first revalidating with the origin. - * When present, the TTL of the response should not be overridden to be - * greater than the value provided by the origin. - * - * @return Boolean true if the response must be revalidated by a cache, false otherwise - * - * @api - */ - public function mustRevalidate() - { - return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('must-proxy-revalidate'); - } - - /** - * Returns the Date header as a DateTime instance. - * - * @return \DateTime A \DateTime instance - * - * @throws \RuntimeException When the header is not parseable - * - * @api - */ - public function getDate() - { - return $this->headers->getDate('Date'); - } - - /** - * Sets the Date header. - * - * @param \DateTime $date A \DateTime instance - * - * @api - */ - public function setDate(\DateTime $date) - { - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Date', $date->format('D, d M Y H:i:s').' GMT'); - } - - /** - * Returns the age of the response. - * - * @return integer The age of the response in seconds - */ - public function getAge() - { - if ($age = $this->headers->get('Age')) { - return $age; - } - - return max(time() - $this->getDate()->format('U'), 0); - } - - /** - * Marks the response stale by setting the Age header to be equal to the maximum age of the response. - * - * @api - */ - public function expire() - { - if ($this->isFresh()) { - $this->headers->set('Age', $this->getMaxAge()); - } - } - - /** - * Returns the value of the Expires header as a DateTime instance. - * - * @return \DateTime A DateTime instance - * - * @api - */ - public function getExpires() - { - return $this->headers->getDate('Expires'); - } - - /** - * Sets the Expires HTTP header with a DateTime instance. - * - * If passed a null value, it removes the header. - * - * @param \DateTime $date A \DateTime instance - * - * @api - */ - public function setExpires(\DateTime $date = null) - { - if (null === $date) { - $this->headers->remove('Expires'); - } else { - $date = clone $date; - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Expires', $date->format('D, d M Y H:i:s').' GMT'); - } - } - - /** - * Sets the number of seconds after the time specified in the response's Date - * header when the the response should no longer be considered fresh. - * - * First, it checks for a s-maxage directive, then a max-age directive, and then it falls - * back on an expires header. It returns null when no maximum age can be established. - * - * @return integer|null Number of seconds - * - * @api - */ - public function getMaxAge() - { - if ($age = $this->headers->getCacheControlDirective('s-maxage')) { - return $age; - } - - if ($age = $this->headers->getCacheControlDirective('max-age')) { - return $age; - } - - if (null !== $this->getExpires()) { - return $this->getExpires()->format('U') - $this->getDate()->format('U'); - } - - return null; - } - - /** - * Sets the number of seconds after which the response should no longer be considered fresh. - * - * This methods sets the Cache-Control max-age directive. - * - * @param integer $value Number of seconds - * - * @api - */ - public function setMaxAge($value) - { - $this->headers->addCacheControlDirective('max-age', $value); - } - - /** - * Sets the number of seconds after which the response should no longer be considered fresh by shared caches. - * - * This methods sets the Cache-Control s-maxage directive. - * - * @param integer $value Number of seconds - * - * @api - */ - public function setSharedMaxAge($value) - { - $this->setPublic(); - $this->headers->addCacheControlDirective('s-maxage', $value); - } - - /** - * Returns the response's time-to-live in seconds. - * - * It returns null when no freshness information is present in the response. - * - * When the responses TTL is <= 0, the response may not be served from cache without first - * revalidating with the origin. - * - * @return integer The TTL in seconds - * - * @api - */ - public function getTtl() - { - if ($maxAge = $this->getMaxAge()) { - return $maxAge - $this->getAge(); - } - - return null; - } - - /** - * Sets the response's time-to-live for shared caches. - * - * This method adjusts the Cache-Control/s-maxage directive. - * - * @param integer $seconds Number of seconds - * - * @api - */ - public function setTtl($seconds) - { - $this->setSharedMaxAge($this->getAge() + $seconds); - } - - /** - * Sets the response's time-to-live for private/client caches. - * - * This method adjusts the Cache-Control/max-age directive. - * - * @param integer $seconds Number of seconds - * - * @api - */ - public function setClientTtl($seconds) - { - $this->setMaxAge($this->getAge() + $seconds); - } - - /** - * Returns the Last-Modified HTTP header as a DateTime instance. - * - * @return \DateTime A DateTime instance - * - * @api - */ - public function getLastModified() - { - return $this->headers->getDate('Last-Modified'); - } - - /** - * Sets the Last-Modified HTTP header with a DateTime instance. - * - * If passed a null value, it removes the header. - * - * @param \DateTime $date A \DateTime instance - * - * @api - */ - public function setLastModified(\DateTime $date = null) - { - if (null === $date) { - $this->headers->remove('Last-Modified'); - } else { - $date = clone $date; - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT'); - } - } - - /** - * Returns the literal value of the ETag HTTP header. - * - * @return string The ETag HTTP header - * - * @api - */ - public function getEtag() - { - return $this->headers->get('ETag'); - } - - /** - * Sets the ETag value. - * - * @param string $etag The ETag unique identifier - * @param Boolean $weak Whether you want a weak ETag or not - * - * @api - */ - public function setEtag($etag = null, $weak = false) - { - if (null === $etag) { - $this->headers->remove('Etag'); - } else { - if (0 !== strpos($etag, '"')) { - $etag = '"'.$etag.'"'; - } - - $this->headers->set('ETag', (true === $weak ? 'W/' : '').$etag); - } - } - - /** - * Sets the response's cache headers (validation and/or expiration). - * - * Available options are: etag, last_modified, max_age, s_maxage, private, and public. - * - * @param array $options An array of cache options - * - * @api - */ - public function setCache(array $options) - { - if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'))) { - throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff)))); - } - - if (isset($options['etag'])) { - $this->setEtag($options['etag']); - } - - if (isset($options['last_modified'])) { - $this->setLastModified($options['last_modified']); - } - - if (isset($options['max_age'])) { - $this->setMaxAge($options['max_age']); - } - - if (isset($options['s_maxage'])) { - $this->setSharedMaxAge($options['s_maxage']); - } - - if (isset($options['public'])) { - if ($options['public']) { - $this->setPublic(); - } else { - $this->setPrivate(); - } - } - - if (isset($options['private'])) { - if ($options['private']) { - $this->setPrivate(); - } else { - $this->setPublic(); - } - } - } - - /** - * Modifies the response so that it conforms to the rules defined for a 304 status code. - * - * This sets the status, removes the body, and discards any headers - * that MUST NOT be included in 304 responses. - * - * @see http://tools.ietf.org/html/rfc2616#section-10.3.5 - * - * @api - */ - public function setNotModified() - { - $this->setStatusCode(304); - $this->setContent(null); - - // remove headers that MUST NOT be included with 304 Not Modified responses - foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) { - $this->headers->remove($header); - } - } - - /** - * Returns true if the response includes a Vary header. - * - * @return true if the response includes a Vary header, false otherwise - * - * @api - */ - public function hasVary() - { - return (Boolean) $this->headers->get('Vary'); - } - - /** - * Returns an array of header names given in the Vary header. - * - * @return array An array of Vary names - * - * @api - */ - public function getVary() - { - if (!$vary = $this->headers->get('Vary')) { - return array(); - } - - return is_array($vary) ? $vary : preg_split('/[\s,]+/', $vary); - } - - /** - * Sets the Vary header. - * - * @param string|array $headers - * @param Boolean $replace Whether to replace the actual value of not (true by default) - * - * @api - */ - public function setVary($headers, $replace = true) - { - $this->headers->set('Vary', $headers, $replace); - } - - /** - * Determines if the Response validators (ETag, Last-Modified) match - * a conditional value specified in the Request. - * - * If the Response is not modified, it sets the status code to 304 and - * removes the actual content by calling the setNotModified() method. - * - * @param Request $request A Request instance - * - * @return Boolean true if the Response validators match the Request, false otherwise - * - * @api - */ - public function isNotModified(Request $request) - { - $lastModified = $request->headers->get('If-Modified-Since'); - $notModified = false; - if ($etags = $request->getEtags()) { - $notModified = (in_array($this->getEtag(), $etags) || in_array('*', $etags)) && (!$lastModified || $this->headers->get('Last-Modified') == $lastModified); - } elseif ($lastModified) { - $notModified = $lastModified == $this->headers->get('Last-Modified'); - } - - if ($notModified) { - $this->setNotModified(); - } - - return $notModified; - } - - // http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html - /** - * @api - */ - public function isInvalid() - { - return $this->statusCode < 100 || $this->statusCode >= 600; - } - - /** - * @api - */ - public function isInformational() - { - return $this->statusCode >= 100 && $this->statusCode < 200; - } - - /** - * @api - */ - public function isSuccessful() - { - return $this->statusCode >= 200 && $this->statusCode < 300; - } - - /** - * @api - */ - public function isRedirection() - { - return $this->statusCode >= 300 && $this->statusCode < 400; - } - - /** - * @api - */ - public function isClientError() - { - return $this->statusCode >= 400 && $this->statusCode < 500; - } - - /** - * @api - */ - public function isServerError() - { - return $this->statusCode >= 500 && $this->statusCode < 600; - } - - /** - * @api - */ - public function isOk() - { - return 200 === $this->statusCode; - } - - /** - * @api - */ - public function isForbidden() - { - return 403 === $this->statusCode; - } - - /** - * @api - */ - public function isNotFound() - { - return 404 === $this->statusCode; - } - - /** - * @api - */ - public function isRedirect($location = null) - { - return in_array($this->statusCode, array(201, 301, 302, 303, 307)) && (null === $location ?: $location == $this->headers->get('Location')); - } - - /** - * @api - */ - public function isEmpty() - { - return in_array($this->statusCode, array(201, 204, 304)); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/core/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php deleted file mode 100644 index 999f0ab..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ /dev/null @@ -1,241 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ResponseHeaderBag is a container for Response HTTP headers. - * - * @author Fabien Potencier - * - * @api - */ -class ResponseHeaderBag extends HeaderBag -{ - const COOKIES_FLAT = 'flat'; - const COOKIES_ARRAY = 'array'; - - protected $computedCacheControl = array(); - protected $cookies = array(); - - /** - * Constructor. - * - * @param array $headers An array of HTTP headers - * - * @api - */ - public function __construct(array $headers = array()) - { - parent::__construct($headers); - - if (!isset($this->headers['cache-control'])) { - $this->set('cache-control', ''); - } - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - $cookies = ''; - foreach ($this->getCookies() as $cookie) { - $cookies .= 'Set-Cookie: '.$cookie."\r\n"; - } - - return parent::__toString().$cookies; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function replace(array $headers = array()) - { - parent::replace($headers); - - if (!isset($this->headers['cache-control'])) { - $this->set('cache-control', ''); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function set($key, $values, $replace = true) - { - parent::set($key, $values, $replace); - - // ensure the cache-control header has sensible defaults - if (in_array(strtr(strtolower($key), '_', '-'), array('cache-control', 'etag', 'last-modified', 'expires'))) { - $computed = $this->computeCacheControlValue(); - $this->headers['cache-control'] = array($computed); - $this->computedCacheControl = $this->parseCacheControl($computed); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function remove($key) - { - parent::remove($key); - - if ('cache-control' === strtr(strtolower($key), '_', '-')) { - $this->computedCacheControl = array(); - } - } - - /** - * {@inheritdoc} - */ - public function hasCacheControlDirective($key) - { - return array_key_exists($key, $this->computedCacheControl); - } - - /** - * {@inheritdoc} - */ - public function getCacheControlDirective($key) - { - return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; - } - - /** - * Sets a cookie. - * - * @param Cookie $cookie - * - * @return void - * - * @api - */ - public function setCookie(Cookie $cookie) - { - $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; - } - - /** - * Removes a cookie from the array, but does not unset it in the browser - * - * @param string $name - * @param string $path - * @param string $domain - * - * @return void - * - * @api - */ - public function removeCookie($name, $path = '/', $domain = null) - { - if (null === $path) { - $path = '/'; - } - - unset($this->cookies[$domain][$path][$name]); - - if (empty($this->cookies[$domain][$path])) { - unset($this->cookies[$domain][$path]); - - if (empty($this->cookies[$domain])) { - unset($this->cookies[$domain]); - } - } - } - - /** - * Returns an array with all cookies - * - * @param string $format - * - * @throws \InvalidArgumentException When the $format is invalid - * - * @return array - * - * @api - */ - public function getCookies($format = self::COOKIES_FLAT) - { - if (!in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) { - throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY)))); - } - - if (self::COOKIES_ARRAY === $format) { - return $this->cookies; - } - - $flattenedCookies = array(); - foreach ($this->cookies as $path) { - foreach ($path as $cookies) { - foreach ($cookies as $cookie) { - $flattenedCookies[] = $cookie; - } - } - } - - return $flattenedCookies; - } - - /** - * Clears a cookie in the browser - * - * @param string $name - * @param string $path - * @param string $domain - * - * @return void - * - * @api - */ - public function clearCookie($name, $path = '/', $domain = null) - { - $this->setCookie(new Cookie($name, null, 1, $path, $domain)); - } - - /** - * Returns the calculated value of the cache-control header. - * - * This considers several other headers and calculates or modifies the - * cache-control header to a sensible, conservative value. - * - * @return string - */ - protected function computeCacheControlValue() - { - if (!$this->cacheControl && !$this->has('ETag') && !$this->has('Last-Modified') && !$this->has('Expires')) { - return 'no-cache'; - } - - if (!$this->cacheControl) { - // conservative by default - return 'private, must-revalidate'; - } - - $header = $this->getCacheControlHeader(); - if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) { - return $header; - } - - // public if s-maxage is defined, private otherwise - if (!isset($this->cacheControl['s-maxage'])) { - return $header.', private'; - } - - return $header; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/ServerBag.php b/core/vendor/Symfony/Component/HttpFoundation/ServerBag.php deleted file mode 100644 index 9cb7786..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/ServerBag.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ServerBag is a container for HTTP headers from the $_SERVER variable. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - */ -class ServerBag extends ParameterBag -{ - public function getHeaders() - { - $headers = array(); - foreach ($this->parameters as $key => $value) { - if (0 === strpos($key, 'HTTP_')) { - $headers[substr($key, 5)] = $value; - } - // CONTENT_* are not prefixed with HTTP_ - elseif (in_array($key, array('CONTENT_LENGTH', 'CONTENT_MD5', 'CONTENT_TYPE'))) { - $headers[$key] = $this->parameters[$key]; - } - } - - // PHP_AUTH_USER/PHP_AUTH_PW - if (isset($this->parameters['PHP_AUTH_USER'])) { - $pass = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : ''; - $headers['AUTHORIZATION'] = 'Basic '.base64_encode($this->parameters['PHP_AUTH_USER'].':'.$pass); - } - - return $headers; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session.php b/core/vendor/Symfony/Component/HttpFoundation/Session.php deleted file mode 100644 index a835ef7..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Session.php +++ /dev/null @@ -1,405 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\HttpFoundation\SessionStorage\SessionStorageInterface; - -/** - * Session. - * - * @author Fabien Potencier - * - * @api - */ -class Session implements \Serializable -{ - protected $storage; - protected $started; - protected $attributes; - protected $flashes; - protected $oldFlashes; - protected $locale; - protected $defaultLocale; - protected $closed; - - /** - * Constructor. - * - * @param SessionStorageInterface $storage A SessionStorageInterface instance - * @param string $defaultLocale The default locale - */ - public function __construct(SessionStorageInterface $storage, $defaultLocale = 'en') - { - $this->storage = $storage; - $this->defaultLocale = $defaultLocale; - $this->locale = $defaultLocale; - $this->flashes = array(); - $this->oldFlashes = array(); - $this->attributes = array(); - $this->setPhpDefaultLocale($this->defaultLocale); - $this->started = false; - $this->closed = false; - } - - /** - * Starts the session storage. - * - * @api - */ - public function start() - { - if (true === $this->started) { - return; - } - - $this->storage->start(); - - $attributes = $this->storage->read('_symfony2'); - - if (isset($attributes['attributes'])) { - $this->attributes = $attributes['attributes']; - $this->flashes = $attributes['flashes']; - $this->locale = $attributes['locale']; - $this->setPhpDefaultLocale($this->locale); - - // flag current flash messages to be removed at shutdown - $this->oldFlashes = $this->flashes; - } - - $this->started = true; - } - - /** - * Checks if an attribute is defined. - * - * @param string $name The attribute name - * - * @return Boolean true if the attribute is defined, false otherwise - * - * @api - */ - public function has($name) - { - return array_key_exists($name, $this->attributes); - } - - /** - * Returns an attribute. - * - * @param string $name The attribute name - * @param mixed $default The default value - * - * @return mixed - * - * @api - */ - public function get($name, $default = null) - { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; - } - - /** - * Sets an attribute. - * - * @param string $name - * @param mixed $value - * - * @api - */ - public function set($name, $value) - { - if (false === $this->started) { - $this->start(); - } - - $this->attributes[$name] = $value; - } - - /** - * Returns attributes. - * - * @return array Attributes - * - * @api - */ - public function all() - { - return $this->attributes; - } - - /** - * Sets attributes. - * - * @param array $attributes Attributes - * - * @api - */ - public function replace(array $attributes) - { - if (false === $this->started) { - $this->start(); - } - - $this->attributes = $attributes; - } - - /** - * Removes an attribute. - * - * @param string $name - * - * @api - */ - public function remove($name) - { - if (false === $this->started) { - $this->start(); - } - - if (array_key_exists($name, $this->attributes)) { - unset($this->attributes[$name]); - } - } - - /** - * Clears all attributes. - * - * @api - */ - public function clear() - { - if (false === $this->started) { - $this->start(); - } - - $this->attributes = array(); - $this->flashes = array(); - $this->setPhpDefaultLocale($this->locale = $this->defaultLocale); - } - - /** - * Invalidates the current session. - * - * @api - */ - public function invalidate() - { - $this->clear(); - $this->storage->regenerate(true); - } - - /** - * Migrates the current session to a new session id while maintaining all - * session attributes. - * - * @api - */ - public function migrate() - { - $this->storage->regenerate(); - } - - /** - * Returns the session ID - * - * @return mixed The session ID - * - * @api - */ - public function getId() - { - if (false === $this->started) { - $this->start(); - } - - return $this->storage->getId(); - } - - /** - * Returns the locale - * - * @return string - */ - public function getLocale() - { - return $this->locale; - } - - /** - * Sets the locale. - * - * @param string $locale - */ - public function setLocale($locale) - { - if (false === $this->started) { - $this->start(); - } - - $this->setPhpDefaultLocale($this->locale = $locale); - } - - /** - * Gets the flash messages. - * - * @return array - */ - public function getFlashes() - { - return $this->flashes; - } - - /** - * Sets the flash messages. - * - * @param array $values - */ - public function setFlashes($values) - { - if (false === $this->started) { - $this->start(); - } - - $this->flashes = $values; - $this->oldFlashes = array(); - } - - /** - * Gets a flash message. - * - * @param string $name - * @param string|null $default - * - * @return string - */ - public function getFlash($name, $default = null) - { - return array_key_exists($name, $this->flashes) ? $this->flashes[$name] : $default; - } - - /** - * Sets a flash message. - * - * @param string $name - * @param string $value - */ - public function setFlash($name, $value) - { - if (false === $this->started) { - $this->start(); - } - - $this->flashes[$name] = $value; - unset($this->oldFlashes[$name]); - } - - /** - * Checks whether a flash message exists. - * - * @param string $name - * - * @return Boolean - */ - public function hasFlash($name) - { - if (false === $this->started) { - $this->start(); - } - - return array_key_exists($name, $this->flashes); - } - - /** - * Removes a flash message. - * - * @param string $name - */ - public function removeFlash($name) - { - if (false === $this->started) { - $this->start(); - } - - unset($this->flashes[$name]); - } - - /** - * Removes the flash messages. - */ - public function clearFlashes() - { - if (false === $this->started) { - $this->start(); - } - - $this->flashes = array(); - $this->oldFlashes = array(); - } - - public function save() - { - if (false === $this->started) { - $this->start(); - } - - $this->flashes = array_diff_key($this->flashes, $this->oldFlashes); - - $this->storage->write('_symfony2', array( - 'attributes' => $this->attributes, - 'flashes' => $this->flashes, - 'locale' => $this->locale, - )); - } - - /** - * This method should be called when you don't want the session to be saved - * when the Session object is garbaged collected (useful for instance when - * you want to simulate the interaction of several users/sessions in a single - * PHP process). - */ - public function close() - { - $this->closed = true; - } - - public function __destruct() - { - if (true === $this->started && !$this->closed) { - $this->save(); - } - } - - public function serialize() - { - return serialize(array($this->storage, $this->defaultLocale)); - } - - public function unserialize($serialized) - { - list($this->storage, $this->defaultLocale) = unserialize($serialized); - $this->attributes = array(); - $this->started = false; - } - - private function setPhpDefaultLocale($locale) - { - // if either the class Locale doesn't exist, or an exception is thrown when - // setting the default locale, the intl module is not installed, and - // the call can be ignored: - try { - if (class_exists('Locale', false)) { - \Locale::setDefault($locale); - } - } catch (\Exception $e) { - } - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/ArraySessionStorage.php b/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/ArraySessionStorage.php deleted file mode 100644 index 62aac40..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/ArraySessionStorage.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\SessionStorage; - -/** - * ArraySessionStorage mocks the session for unit tests. - * - * When doing functional testing, you should use FilesystemSessionStorage instead. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - */ - -class ArraySessionStorage implements SessionStorageInterface -{ - private $data = array(); - - public function read($key, $default = null) - { - return array_key_exists($key, $this->data) ? $this->data[$key] : $default; - } - - public function regenerate($destroy = false) - { - if ($destroy) { - $this->data = array(); - } - - return true; - } - - public function remove($key) - { - unset($this->data[$key]); - } - - public function start() - { - } - - public function getId() - { - } - - public function write($key, $data) - { - $this->data[$key] = $data; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php b/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php deleted file mode 100644 index e6eb9ba..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php +++ /dev/null @@ -1,175 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\SessionStorage; - -/** - * FilesystemSessionStorage simulates sessions for functional tests. - * - * This storage does not start the session (session_start()) - * as it is not "available" when running tests on the command line. - * - * @author Fabien Potencier - * - * @api - */ -class FilesystemSessionStorage extends NativeSessionStorage -{ - private $path; - private $data; - private $started; - - /** - * Constructor. - */ - public function __construct($path, array $options = array()) - { - $this->path = $path; - $this->started = false; - - parent::__construct($options); - } - - /** - * Starts the session. - * - * @api - */ - public function start() - { - if ($this->started) { - return; - } - - session_set_cookie_params( - $this->options['lifetime'], - $this->options['path'], - $this->options['domain'], - $this->options['secure'], - $this->options['httponly'] - ); - - if (!ini_get('session.use_cookies') && isset($this->options['id']) && $this->options['id'] && $this->options['id'] != session_id()) { - session_id($this->options['id']); - } - - if (!session_id()) { - session_id(hash('md5', uniqid(mt_rand(), true))); - } - - $file = $this->path.'/'.session_id().'.session'; - - $this->data = file_exists($file) ? unserialize(file_get_contents($file)) : array(); - $this->started = true; - } - - /** - * Returns the session ID - * - * @return mixed The session ID - * - * @throws \RuntimeException If the session was not started yet - * - * @api - */ - public function getId() - { - if (!$this->started) { - throw new \RuntimeException('The session must be started before reading its ID'); - } - - return session_id(); - } - - /** - * Reads data from this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * @param string $default The default value - * - * @return mixed Data associated with the key - * - * @throws \RuntimeException If an error occurs while reading data from this storage - * - * @api - */ - public function read($key, $default = null) - { - return array_key_exists($key, $this->data) ? $this->data[$key] : $default; - } - - /** - * Removes data from this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * - * @return mixed Data associated with the key - * - * @throws \RuntimeException If an error occurs while removing data from this storage - * - * @api - */ - public function remove($key) - { - $retval = $this->data[$key]; - - unset($this->data[$key]); - - return $retval; - } - - /** - * Writes data to this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * @param mixed $data Data associated with your key - * - * @throws \RuntimeException If an error occurs while writing to this storage - * - * @api - */ - public function write($key, $data) - { - $this->data[$key] = $data; - - if (!is_dir($this->path)) { - mkdir($this->path, 0777, true); - } - - file_put_contents($this->path.'/'.session_id().'.session', serialize($this->data)); - } - - /** - * Regenerates id that represents this storage. - * - * @param Boolean $destroy Destroy session when regenerating? - * - * @return Boolean True if session regenerated, false if error - * - * @throws \RuntimeException If an error occurs while regenerating this storage - * - * @api - */ - public function regenerate($destroy = false) - { - if ($destroy) { - $this->data = array(); - } - - return true; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php b/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php deleted file mode 100644 index b759f74..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php +++ /dev/null @@ -1,180 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\SessionStorage; - -/** - * NativeSessionStorage. - * - * @author Fabien Potencier - * - * @api - */ -class NativeSessionStorage implements SessionStorageInterface -{ - static protected $sessionIdRegenerated = false; - static protected $sessionStarted = false; - - protected $options; - - /** - * Available options: - * - * * name: The cookie name (null [omitted] by default) - * * id: The session id (null [omitted] by default) - * * lifetime: Cookie lifetime - * * path: Cookie path - * * domain: Cookie domain - * * secure: Cookie secure - * * httponly: Cookie http only - * - * The default values for most options are those returned by the session_get_cookie_params() function - * - * @param array $options An associative array of session options - */ - public function __construct(array $options = array()) - { - $cookieDefaults = session_get_cookie_params(); - - $this->options = array_merge(array( - 'lifetime' => $cookieDefaults['lifetime'], - 'path' => $cookieDefaults['path'], - 'domain' => $cookieDefaults['domain'], - 'secure' => $cookieDefaults['secure'], - 'httponly' => isset($cookieDefaults['httponly']) ? $cookieDefaults['httponly'] : false, - ), $options); - - // Skip setting new session name if user don't want it - if (isset($this->options['name'])) { - session_name($this->options['name']); - } - } - - /** - * Starts the session. - * - * @api - */ - public function start() - { - if (self::$sessionStarted) { - return; - } - - session_set_cookie_params( - $this->options['lifetime'], - $this->options['path'], - $this->options['domain'], - $this->options['secure'], - $this->options['httponly'] - ); - - // disable native cache limiter as this is managed by HeaderBag directly - session_cache_limiter(false); - - if (!ini_get('session.use_cookies') && isset($this->options['id']) && $this->options['id'] && $this->options['id'] != session_id()) { - session_id($this->options['id']); - } - - session_start(); - - self::$sessionStarted = true; - } - - /** - * {@inheritDoc} - * - * @api - */ - public function getId() - { - if (!self::$sessionStarted) { - throw new \RuntimeException('The session must be started before reading its ID'); - } - - return session_id(); - } - - /** - * Reads data from this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * @param string $default Default value - * - * @return mixed Data associated with the key - * - * @api - */ - public function read($key, $default = null) - { - return array_key_exists($key, $_SESSION) ? $_SESSION[$key] : $default; - } - - /** - * Removes data from this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * - * @return mixed Data associated with the key - * - * @api - */ - public function remove($key) - { - $retval = null; - - if (isset($_SESSION[$key])) { - $retval = $_SESSION[$key]; - unset($_SESSION[$key]); - } - - return $retval; - } - - /** - * Writes data to this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * @param mixed $data Data associated with your key - * - * @api - */ - public function write($key, $data) - { - $_SESSION[$key] = $data; - } - - /** - * Regenerates id that represents this storage. - * - * @param Boolean $destroy Destroy session when regenerating? - * - * @return Boolean True if session regenerated, false if error - * - * @api - */ - public function regenerate($destroy = false) - { - if (self::$sessionIdRegenerated) { - return; - } - - session_regenerate_id($destroy); - - self::$sessionIdRegenerated = true; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php deleted file mode 100644 index 09d032a..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php +++ /dev/null @@ -1,266 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\SessionStorage; - -/** - * PdoSessionStorage. - * - * @author Fabien Potencier - * @author Michael Williams - */ -class PdoSessionStorage extends NativeSessionStorage -{ - private $db; - private $dbOptions; - - /** - * Constructor. - * - * @param \PDO $db A PDO instance - * @param array $options An associative array of session options - * @param array $dbOptions An associative array of DB options - * - * @throws \InvalidArgumentException When "db_table" option is not provided - * - * @see NativeSessionStorage::__construct() - */ - public function __construct(\PDO $db, array $options = array(), array $dbOptions = array()) - { - if (!array_key_exists('db_table', $dbOptions)) { - throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.'); - } - - $this->db = $db; - $this->dbOptions = array_merge(array( - 'db_id_col' => 'sess_id', - 'db_data_col' => 'sess_data', - 'db_time_col' => 'sess_time', - ), $dbOptions); - - parent::__construct($options); - } - - /** - * Starts the session. - */ - public function start() - { - if (self::$sessionStarted) { - return; - } - - // use this object as the session handler - session_set_save_handler( - array($this, 'sessionOpen'), - array($this, 'sessionClose'), - array($this, 'sessionRead'), - array($this, 'sessionWrite'), - array($this, 'sessionDestroy'), - array($this, 'sessionGC') - ); - - parent::start(); - } - - /** - * Opens a session. - * - * @param string $path (ignored) - * @param string $name (ignored) - * - * @return Boolean true, if the session was opened, otherwise an exception is thrown - */ - public function sessionOpen($path = null, $name = null) - { - return true; - } - - /** - * Closes a session. - * - * @return Boolean true, if the session was closed, otherwise false - */ - public function sessionClose() - { - // do nothing - return true; - } - - /** - * Destroys a session. - * - * @param string $id A session ID - * - * @return Boolean true, if the session was destroyed, otherwise an exception is thrown - * - * @throws \RuntimeException If the session cannot be destroyed - */ - public function sessionDestroy($id) - { - // get table/column - $dbTable = $this->dbOptions['db_table']; - $dbIdCol = $this->dbOptions['db_id_col']; - - // delete the record associated with this id - $sql = "DELETE FROM $dbTable WHERE $dbIdCol = :id"; - - try { - $stmt = $this->db->prepare($sql); - $stmt->bindParam(':id', $id, \PDO::PARAM_STR); - $stmt->execute(); - } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); - } - - return true; - } - - /** - * Cleans up old sessions. - * - * @param int $lifetime The lifetime of a session - * - * @return Boolean true, if old sessions have been cleaned, otherwise an exception is thrown - * - * @throws \RuntimeException If any old sessions cannot be cleaned - */ - public function sessionGC($lifetime) - { - // get table/column - $dbTable = $this->dbOptions['db_table']; - $dbTimeCol = $this->dbOptions['db_time_col']; - - // delete the record associated with this id - $sql = "DELETE FROM $dbTable WHERE $dbTimeCol < (:time - $lifetime)"; - - try { - $stmt = $this->db->prepare($sql); - $stmt->bindValue(':time', time(), \PDO::PARAM_INT); - $stmt->execute(); - } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); - } - - return true; - } - - /** - * Reads a session. - * - * @param string $id A session ID - * - * @return string The session data if the session was read or created, otherwise an exception is thrown - * - * @throws \RuntimeException If the session cannot be read - */ - public function sessionRead($id) - { - // get table/columns - $dbTable = $this->dbOptions['db_table']; - $dbDataCol = $this->dbOptions['db_data_col']; - $dbIdCol = $this->dbOptions['db_id_col']; - - try { - $sql = "SELECT $dbDataCol FROM $dbTable WHERE $dbIdCol = :id"; - - $stmt = $this->db->prepare($sql); - $stmt->bindParam(':id', $id, \PDO::PARAM_STR, 255); - - $stmt->execute(); - // it is recommended to use fetchAll so that PDO can close the DB cursor - // we anyway expect either no rows, or one row with one column. fetchColumn, seems to be buggy #4777 - $sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM); - - if (count($sessionRows) == 1) { - return base64_decode($sessionRows[0][0]); - } - - // session does not exist, create it - $this->createNewSession($id); - - return ''; - } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); - } - } - - /** - * Writes session data. - * - * @param string $id A session ID - * @param string $data A serialized chunk of session data - * - * @return Boolean true, if the session was written, otherwise an exception is thrown - * - * @throws \RuntimeException If the session data cannot be written - */ - public function sessionWrite($id, $data) - { - // get table/column - $dbTable = $this->dbOptions['db_table']; - $dbDataCol = $this->dbOptions['db_data_col']; - $dbIdCol = $this->dbOptions['db_id_col']; - $dbTimeCol = $this->dbOptions['db_time_col']; - - $sql = ('mysql' === $this->db->getAttribute(\PDO::ATTR_DRIVER_NAME)) - ? "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time) " - ."ON DUPLICATE KEY UPDATE $dbDataCol = VALUES($dbDataCol), $dbTimeCol = CASE WHEN $dbTimeCol = :time THEN (VALUES($dbTimeCol) + 1) ELSE VALUES($dbTimeCol) END" - : "UPDATE $dbTable SET $dbDataCol = :data, $dbTimeCol = :time WHERE $dbIdCol = :id"; - - try { - //session data can contain non binary safe characters so we need to encode it - $encoded = base64_encode($data); - $stmt = $this->db->prepare($sql); - $stmt->bindParam(':id', $id, \PDO::PARAM_STR); - $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR); - $stmt->bindValue(':time', time(), \PDO::PARAM_INT); - $stmt->execute(); - - if (!$stmt->rowCount()) { - // No session exists in the database to update. This happens when we have called - // session_regenerate_id() - $this->createNewSession($id, $data); - } - } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); - } - - return true; - } - - /** - * Creates a new session with the given $id and $data - * - * @param string $id - * @param string $data - */ - private function createNewSession($id, $data = '') - { - // get table/column - $dbTable = $this->dbOptions['db_table']; - $dbDataCol = $this->dbOptions['db_data_col']; - $dbIdCol = $this->dbOptions['db_id_col']; - $dbTimeCol = $this->dbOptions['db_time_col']; - - $sql = "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time)"; - - //session data can contain non binary safe characters so we need to encode it - $encoded = base64_encode($data); - $stmt = $this->db->prepare($sql); - $stmt->bindParam(':id', $id, \PDO::PARAM_STR); - $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR); - $stmt->bindValue(':time', time(), \PDO::PARAM_INT); - $stmt->execute(); - - return true; - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/SessionStorageInterface.php b/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/SessionStorageInterface.php deleted file mode 100644 index b61a255..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/SessionStorage/SessionStorageInterface.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\SessionStorage; - -/** - * SessionStorageInterface. - * - * @author Fabien Potencier - * - * @api - */ -interface SessionStorageInterface -{ - /** - * Starts the session. - * - * @api - */ - function start(); - - /** - * Returns the session ID - * - * @return mixed The session ID - * - * @throws \RuntimeException If the session was not started yet - * - * @api - */ - function getId(); - - /** - * Reads data from this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * - * @return mixed Data associated with the key - * - * @throws \RuntimeException If an error occurs while reading data from this storage - * - * @api - */ - function read($key); - - /** - * Removes data from this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * - * @return mixed Data associated with the key - * - * @throws \RuntimeException If an error occurs while removing data from this storage - * - * @api - */ - function remove($key); - - /** - * Writes data to this storage. - * - * The preferred format for a key is directory style so naming conflicts can be avoided. - * - * @param string $key A unique key identifying your data - * @param mixed $data Data associated with your key - * - * @throws \RuntimeException If an error occurs while writing to this storage - * - * @api - */ - function write($key, $data); - - /** - * Regenerates id that represents this storage. - * - * @param Boolean $destroy Destroy session when regenerating? - * - * @return Boolean True if session regenerated, false if error - * - * @throws \RuntimeException If an error occurs while regenerating this storage - * - * @api - */ - function regenerate($destroy = false); -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/composer.json b/core/vendor/Symfony/Component/HttpFoundation/composer.json deleted file mode 100644 index 53e0b10..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/composer.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "symfony/http-foundation", - "type": "library", - "description": "Symfony HttpFoundation Component", - "keywords": [], - "homepage": "http://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.2" - }, - "autoload": { - "psr-0": { "Symfony\\Component\\HttpFoundation": "" } - }, - "target-dir": "Symfony/Component/HttpFoundation" -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Bundle/Bundle.php b/core/vendor/Symfony/Component/HttpKernel/Bundle/Bundle.php deleted file mode 100644 index 494feab..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Bundle; - -use Symfony\Component\DependencyInjection\ContainerAware; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\Console\Application; -use Symfony\Component\Finder\Finder; - -/** - * An implementation of BundleInterface that adds a few conventions - * for DependencyInjection extensions and Console commands. - * - * @author Fabien Potencier - * - * @api - */ -abstract class Bundle extends ContainerAware implements BundleInterface -{ - protected $name; - protected $reflected; - protected $extension; - - /** - * Boots the Bundle. - */ - public function boot() - { - } - - /** - * Shutdowns the Bundle. - */ - public function shutdown() - { - } - - /** - * Builds the bundle. - * - * It is only ever called once when the cache is empty. - * - * This method can be overridden to register compilation passes, - * other extensions, ... - * - * @param ContainerBuilder $container A ContainerBuilder instance - */ - public function build(ContainerBuilder $container) - { - } - - /** - * Returns the bundle's container extension. - * - * @return ExtensionInterface|null The container extension - * - * @api - */ - public function getContainerExtension() - { - if (null === $this->extension) { - $basename = preg_replace('/Bundle$/', '', $this->getName()); - - $class = $this->getNamespace().'\\DependencyInjection\\'.$basename.'Extension'; - if (class_exists($class)) { - $extension = new $class(); - - // check naming convention - $expectedAlias = Container::underscore($basename); - if ($expectedAlias != $extension->getAlias()) { - throw new \LogicException(sprintf( - 'The extension alias for the default extension of a '. - 'bundle must be the underscored version of the '. - 'bundle name ("%s" instead of "%s")', - $expectedAlias, $extension->getAlias() - )); - } - - $this->extension = $extension; - } else { - $this->extension = false; - } - } - - if ($this->extension) { - return $this->extension; - } - } - - /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace - * - * @api - */ - public function getNamespace() - { - if (null === $this->reflected) { - $this->reflected = new \ReflectionObject($this); - } - - return $this->reflected->getNamespaceName(); - } - - /** - * Gets the Bundle directory path. - * - * @return string The Bundle absolute path - * - * @api - */ - public function getPath() - { - if (null === $this->reflected) { - $this->reflected = new \ReflectionObject($this); - } - - return dirname($this->reflected->getFileName()); - } - - /** - * Returns the bundle parent name. - * - * @return string The Bundle parent name it overrides or null if no parent - * - * @api - */ - public function getParent() - { - return null; - } - - /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name - * - * @api - */ - final public function getName() - { - if (null !== $this->name) { - return $this->name; - } - - $name = get_class($this); - $pos = strrpos($name, '\\'); - - return $this->name = false === $pos ? $name : substr($name, $pos + 1); - } - - /** - * Finds and registers Commands. - * - * Override this method if your bundle commands do not follow the conventions: - * - * * Commands are in the 'Command' sub-directory - * * Commands extend Symfony\Component\Console\Command\Command - * - * @param Application $application An Application instance - */ - public function registerCommands(Application $application) - { - if (!$dir = realpath($this->getPath().'/Command')) { - return; - } - - $finder = new Finder(); - $finder->files()->name('*Command.php')->in($dir); - - $prefix = $this->getNamespace().'\\Command'; - foreach ($finder as $file) { - $ns = $prefix; - if ($relativePath = $file->getRelativePath()) { - $ns .= '\\'.strtr($relativePath, '/', '\\'); - } - $r = new \ReflectionClass($ns.'\\'.$file->getBasename('.php')); - if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract()) { - $application->add($r->newInstance()); - } - } - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/core/vendor/Symfony/Component/HttpKernel/Bundle/BundleInterface.php deleted file mode 100644 index 99d591f..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Bundle/BundleInterface.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\HttpKernel\Bundle; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * BundleInterface. - * - * @author Fabien Potencier - * - * @api - */ -interface BundleInterface -{ - /** - * Boots the Bundle. - * - * @api - */ - function boot(); - - /** - * Shutdowns the Bundle. - * - * @api - */ - function shutdown(); - - /** - * Builds the bundle. - * - * It is only ever called once when the cache is empty. - * - * @param ContainerBuilder $container A ContainerBuilder instance - * - * @api - */ - function build(ContainerBuilder $container); - - /** - * Returns the container extension that should be implicitly loaded. - * - * @return ExtensionInterface|null The default extension or null if there is none - * - * @api - */ - function getContainerExtension(); - - /** - * Returns the bundle parent name. - * - * @return string The Bundle parent name it overrides or null if no parent - * - * @api - */ - function getParent(); - - /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name - * - * @api - */ - function getName(); - - /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace - * - * @api - */ - function getNamespace(); - - /** - * Gets the Bundle directory path. - * - * The path should always be returned as a Unix path (with /). - * - * @return string The Bundle absolute path - * - * @api - */ - function getPath(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php b/core/vendor/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php deleted file mode 100644 index 1588b67..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.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\HttpKernel\CacheClearer; - -/** - * CacheClearerInterface. - * - * @author Dustin Dobervich - */ -interface CacheClearerInterface -{ - /** - * Clears any caches necessary. - * - * @param string $cacheDir The cache directory. - */ - function clear($cacheDir); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php b/core/vendor/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php deleted file mode 100644 index 7b492d0..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheClearer; - -/** - * ChainCacheClearer. - * - * @author Dustin Dobervich - */ -class ChainCacheClearer implements CacheClearerInterface -{ - /** - * @var array $clearers - */ - protected $clearers; - - /** - * Constructs a new instance of ChainCacheClearer. - * - * @param array $clearers The initial clearers. - */ - public function __construct(array $clearers = array()) - { - $this->clearers = $clearers; - } - - /** - * {@inheritDoc} - */ - public function clear($cacheDir) - { - foreach ($this->clearers as $clearer) { - $clearer->clear($cacheDir); - } - } - - /** - * Adds a cache clearer to the aggregate. - * - * @param CacheClearerInterface $clearer - */ - public function add(CacheClearerInterface $clearer) - { - $this->clearers[] = $clearer; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php b/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php deleted file mode 100644 index 758fb1e..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.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\HttpKernel\CacheWarmer; - -/** - * Abstract cache warmer that knows how to write a file to the cache. - * - * @author Fabien Potencier - */ -abstract class CacheWarmer implements CacheWarmerInterface -{ - protected function writeCacheFile($file, $content) - { - $tmpFile = tempnam(dirname($file), basename($file)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { - chmod($file, 0644); - - return; - } - - throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file)); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php b/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php deleted file mode 100644 index eb26ac5..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.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\HttpKernel\CacheWarmer; - -/** - * Aggregates several cache warmers into a single one. - * - * @author Fabien Potencier - */ -class CacheWarmerAggregate implements CacheWarmerInterface -{ - protected $warmers; - protected $optionalsEnabled; - - public function __construct(array $warmers = array()) - { - $this->setWarmers($warmers); - $this->optionalsEnabled = false; - } - - public function enableOptionalWarmers() - { - $this->optionalsEnabled = true; - } - - /** - * Warms up the cache. - * - * @param string $cacheDir The cache directory - */ - public function warmUp($cacheDir) - { - foreach ($this->warmers as $warmer) { - if (!$this->optionalsEnabled && $warmer->isOptional()) { - continue; - } - - $warmer->warmUp($cacheDir); - } - } - - /** - * Checks whether this warmer is optional or not. - * - * @return Boolean always true - */ - public function isOptional() - { - return false; - } - - public function setWarmers(array $warmers) - { - $this->warmers = array(); - foreach ($warmers as $warmer) { - $this->add($warmer); - } - } - - public function add(CacheWarmerInterface $warmer) - { - $this->warmers[] = $warmer; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php b/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php deleted file mode 100644 index 478cdc9..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.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\HttpKernel\CacheWarmer; - -/** - * Interface for classes able to warm up the cache. - * - * @author Fabien Potencier - */ -interface CacheWarmerInterface extends WarmableInterface -{ - /** - * Checks whether this warmer is optional or not. - * - * Optional warmers can be ignored on certain conditions. - * - * A warmer should return true if the cache can be - * generated incrementally and on-demand. - * - * @return Boolean true if the warmer is optional, false otherwise - */ - function isOptional(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php b/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php deleted file mode 100644 index 0476161..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.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\HttpKernel\CacheWarmer; - -/** - * Interface for classes that support warming their cache. - * - * @author Fabien Potencier - */ -interface WarmableInterface -{ - /** - * Warms up the cache. - * - * @param string $cacheDir The cache directory - */ - function warmUp($cacheDir); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Client.php b/core/vendor/Symfony/Component/HttpKernel/Client.php deleted file mode 100644 index ff93bf7..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Client.php +++ /dev/null @@ -1,184 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\BrowserKit\Client as BaseClient; -use Symfony\Component\BrowserKit\Request as DomRequest; -use Symfony\Component\BrowserKit\Response as DomResponse; -use Symfony\Component\BrowserKit\Cookie as DomCookie; -use Symfony\Component\BrowserKit\History; -use Symfony\Component\BrowserKit\CookieJar; -use Symfony\Component\HttpKernel\TerminableInterface; - -/** - * Client simulates a browser and makes requests to a Kernel object. - * - * @author Fabien Potencier - * - * @api - */ -class Client extends BaseClient -{ - protected $kernel; - - /** - * Constructor. - * - * @param HttpKernelInterface $kernel An HttpKernel instance - * @param array $server The server parameters (equivalent of $_SERVER) - * @param History $history A History instance to store the browser history - * @param CookieJar $cookieJar A CookieJar instance to store the cookies - */ - public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null) - { - $this->kernel = $kernel; - - parent::__construct($server, $history, $cookieJar); - - $this->followRedirects = false; - } - - /** - * Makes a request. - * - * @param Request $request A Request instance - * - * @return Response A Response instance - */ - protected function doRequest($request) - { - $response = $this->kernel->handle($request); - - if ($this->kernel instanceof TerminableInterface) { - $this->kernel->terminate($request, $response); - } - - return $response; - } - - /** - * Returns the script to execute when the request must be insulated. - * - * @param Request $request A Request instance - */ - protected function getScript($request) - { - $kernel = str_replace("'", "\\'", serialize($this->kernel)); - $request = str_replace("'", "\\'", serialize($request)); - - $r = new \ReflectionClass('\\Symfony\\Component\\ClassLoader\\UniversalClassLoader'); - $requirePath = str_replace("'", "\\'", $r->getFileName()); - - $symfonyPath = str_replace("'", "\\'", realpath(__DIR__.'/../../..')); - - return <<registerNamespaces(array('Symfony' => '$symfonyPath')); -\$loader->register(); - -\$kernel = unserialize('$kernel'); -echo serialize(\$kernel->handle(unserialize('$request'))); -EOF; - } - - /** - * Converts the BrowserKit request to a HttpKernel request. - * - * @param DomRequest $request A Request instance - * - * @return Request A Request instance - */ - protected function filterRequest(DomRequest $request) - { - $httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent()); - - $httpRequest->files->replace($this->filterFiles($httpRequest->files->all())); - - return $httpRequest; - } - - /** - * Filters an array of files. - * - * This method created test instances of UploadedFile so that the move() - * method can be called on those instances. - * - * If the size of a file is greater than the allowed size (from php.ini) then - * an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE. - * - * @see Symfony\Component\HttpFoundation\File\UploadedFile - * - * @param array $files An array of files - * - * @return array An array with all uploaded files marked as already moved - */ - protected function filterFiles(array $files) - { - $filtered = array(); - foreach ($files as $key => $value) { - if (is_array($value)) { - $filtered[$key] = $this->filterFiles($value); - } elseif ($value instanceof UploadedFile) { - if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) { - $filtered[$key] = new UploadedFile( - '', - $value->getClientOriginalName(), - $value->getClientMimeType(), - 0, - UPLOAD_ERR_INI_SIZE, - true - ); - } else { - $filtered[$key] = new UploadedFile( - $value->getPathname(), - $value->getClientOriginalName(), - $value->getClientMimeType(), - $value->getClientSize(), - $value->getError(), - true - ); - } - } else { - $filtered[$key] = $value; - } - } - - return $filtered; - } - - /** - * Converts the HttpKernel response to a BrowserKit response. - * - * @param Response $response A Response instance - * - * @return Response A Response instance - */ - protected function filterResponse($response) - { - $headers = $response->headers->all(); - if ($response->headers->getCookies()) { - $cookies = array(); - foreach ($response->headers->getCookies() as $cookie) { - $cookies[] = new DomCookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } - $headers['Set-Cookie'] = $cookies; - } - - return new DomResponse($response->getContent(), $response->getStatusCode(), $headers); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Config/FileLocator.php b/core/vendor/Symfony/Component/HttpKernel/Config/FileLocator.php deleted file mode 100644 index 6cc615c..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Config/FileLocator.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Config; - -use Symfony\Component\Config\FileLocator as BaseFileLocator; -use Symfony\Component\HttpKernel\KernelInterface; - -/** - * FileLocator uses the KernelInterface to locate resources in bundles. - * - * @author Fabien Potencier - */ -class FileLocator extends BaseFileLocator -{ - private $kernel; - private $path; - - /** - * Constructor. - * - * @param KernelInterface $kernel A KernelInterface instance - * @param string $path The path the global resource directory - * @param string|array $paths A path or an array of paths where to look for resources - */ - public function __construct(KernelInterface $kernel, $path = null, array $paths = array()) - { - $this->kernel = $kernel; - $this->path = $path; - $paths[] = $path; - - parent::__construct($paths); - } - - /** - * {@inheritdoc} - */ - public function locate($file, $currentPath = null, $first = true) - { - if ('@' === $file[0]) { - return $this->kernel->locateResource($file, $this->path, $first); - } - - return parent::locate($file, $currentPath, $first); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolver.php deleted file mode 100644 index d535c55..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpKernel\Log\LoggerInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * ControllerResolver. - * - * This implementation uses the '_controller' request attribute to determine - * the controller to execute and uses the request attributes to determine - * the controller method arguments. - * - * @author Fabien Potencier - * - * @api - */ -class ControllerResolver implements ControllerResolverInterface -{ - private $logger; - - /** - * Constructor. - * - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(LoggerInterface $logger = null) - { - $this->logger = $logger; - } - - /** - * Returns the Controller instance associated with a Request. - * - * This method looks for a '_controller' request attribute that represents - * the controller name (a string like ClassName::MethodName). - * - * @param Request $request A Request instance - * - * @return mixed|Boolean A PHP callable representing the Controller, - * or false if this resolver is not able to determine the controller - * - * @throws \InvalidArgumentException|\LogicException If the controller can't be found - * - * @api - */ - public function getController(Request $request) - { - if (!$controller = $request->attributes->get('_controller')) { - if (null !== $this->logger) { - $this->logger->warn('Unable to look for the controller as the "_controller" parameter is missing'); - } - - return false; - } - - if (is_array($controller) || (is_object($controller) && method_exists($controller, '__invoke'))) { - return $controller; - } - - if (false === strpos($controller, ':')) { - if (method_exists($controller, '__invoke')) { - return new $controller; - } elseif (function_exists($controller)) { - return $controller; - } - } - - list($controller, $method) = $this->createController($controller); - - if (!method_exists($controller, $method)) { - throw new \InvalidArgumentException(sprintf('Method "%s::%s" does not exist.', get_class($controller), $method)); - } - - return array($controller, $method); - } - - /** - * Returns the arguments to pass to the controller. - * - * @param Request $request A Request instance - * @param mixed $controller A PHP callable - * - * @throws \RuntimeException When value for argument given is not provided - * - * @api - */ - public function getArguments(Request $request, $controller) - { - if (is_array($controller)) { - $r = new \ReflectionMethod($controller[0], $controller[1]); - } elseif (is_object($controller) && !$controller instanceof \Closure) { - $r = new \ReflectionObject($controller); - $r = $r->getMethod('__invoke'); - } else { - $r = new \ReflectionFunction($controller); - } - - return $this->doGetArguments($request, $controller, $r->getParameters()); - } - - protected function doGetArguments(Request $request, $controller, array $parameters) - { - $attributes = $request->attributes->all(); - $arguments = array(); - foreach ($parameters as $param) { - if (array_key_exists($param->getName(), $attributes)) { - $arguments[] = $attributes[$param->getName()]; - } elseif ($param->getClass() && $param->getClass()->isInstance($request)) { - $arguments[] = $request; - } elseif ($param->isDefaultValueAvailable()) { - $arguments[] = $param->getDefaultValue(); - } else { - if (is_array($controller)) { - $repr = sprintf('%s::%s()', get_class($controller[0]), $controller[1]); - } elseif (is_object($controller)) { - $repr = get_class($controller); - } else { - $repr = $controller; - } - - throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (because there is no default value or because there is a non optional argument after this one).', $repr, $param->getName())); - } - } - - return $arguments; - } - - /** - * Returns a callable for the given controller. - * - * @param string $controller A Controller string - * - * @return mixed A PHP callable - */ - protected function createController($controller) - { - if (false === strpos($controller, '::')) { - throw new \InvalidArgumentException(sprintf('Unable to find controller "%s".', $controller)); - } - - list($class, $method) = explode('::', $controller, 2); - - if (!class_exists($class)) { - throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); - } - - return array(new $class(), $method); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php b/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php deleted file mode 100644 index 986a13d..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpFoundation\Request; - -/** - * A ControllerResolverInterface implementation knows how to determine the - * controller to execute based on a Request object. - * - * It can also determine the arguments to pass to the Controller. - * - * A Controller can be any valid PHP callable. - * - * @author Fabien Potencier - * - * @api - */ -interface ControllerResolverInterface -{ - /** - * Returns the Controller instance associated with a Request. - * - * As several resolvers can exist for a single application, a resolver must - * return false when it is not able to determine the controller. - * - * The resolver must only throw an exception when it should be able to load - * controller but cannot because of some errors made by the developer. - * - * @param Request $request A Request instance - * - * @return mixed|Boolean A PHP callable representing the Controller, - * or false if this resolver is not able to determine the controller - * - * @throws \InvalidArgumentException|\LogicException If the controller can't be found - * - * @api - */ - function getController(Request $request); - - /** - * Returns the arguments to pass to the controller. - * - * @param Request $request A Request instance - * @param mixed $controller A PHP callable - * - * @return array An array of arguments to pass to the controller - * - * @throws \RuntimeException When value for argument given is not provided - * - * @api - */ - function getArguments(Request $request, $controller); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php deleted file mode 100644 index 37e93b0..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\HttpKernel\DataCollector\DataCollector; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * ConfigDataCollector. - * - * @author Fabien Potencier - */ -class ConfigDataCollector extends DataCollector -{ - private $kernel; - - /** - * Constructor. - * - * @param KernelInterface $kernel A KernelInterface instance - */ - public function __construct(KernelInterface $kernel) - { - $this->kernel = $kernel; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'token' => $response->headers->get('X-Debug-Token'), - 'symfony_version' => Kernel::VERSION, - 'name' => $this->kernel->getName(), - 'env' => $this->kernel->getEnvironment(), - 'debug' => $this->kernel->isDebug(), - 'php_version' => PHP_VERSION, - 'xdebug_enabled' => extension_loaded('xdebug'), - 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), - 'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'), - 'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'), - 'bundles' => array(), - ); - - foreach ($this->kernel->getBundles() as $name => $bundle) { - $this->data['bundles'][$name] = $bundle->getPath(); - } - } - - /** - * Gets the token. - * - * @return string The token - */ - public function getToken() - { - return $this->data['token']; - } - - /** - * Gets the Symfony version. - * - * @return string The Symfony version - */ - public function getSymfonyVersion() - { - return $this->data['symfony_version']; - } - - /** - * Gets the PHP version. - * - * @return string The PHP version - */ - public function getPhpVersion() - { - return $this->data['php_version']; - } - - /** - * Gets the application name. - * - * @return string The application name - */ - public function getAppName() - { - return $this->data['name']; - } - - /** - * Gets the environment. - * - * @return string The environment - */ - public function getEnv() - { - return $this->data['env']; - } - - /** - * Returns true if the debug is enabled. - * - * @return Boolean true if debug is enabled, false otherwise - */ - public function isDebug() - { - return $this->data['debug']; - } - - /** - * Returns true if the XDebug is enabled. - * - * @return Boolean true if XDebug is enabled, false otherwise - */ - public function hasXDebug() - { - return $this->data['xdebug_enabled']; - } - - /** - * Returns true if EAccelerator is enabled. - * - * @return Boolean true if EAccelerator is enabled, false otherwise - */ - public function hasEAccelerator() - { - return $this->data['eaccel_enabled']; - } - - /** - * Returns true if APC is enabled. - * - * @return Boolean true if APC is enabled, false otherwise - */ - public function hasApc() - { - return $this->data['apc_enabled']; - } - - /** - * Returns true if XCache is enabled. - * - * @return Boolean true if XCache is enabled, false otherwise - */ - public function hasXCache() - { - return $this->data['xcache_enabled']; - } - - /** - * Returns true if any accelerator is enabled. - * - * @return Boolean true if any accelerator is enabled, false otherwise - */ - public function hasAccelerator() - { - return $this->hasApc() || $this->hasEAccelerator() || $this->hasXCache(); - } - - public function getBundles() - { - return $this->data['bundles']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'config'; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollector.php deleted file mode 100644 index f1002fb..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollector.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\HttpKernel\DataCollector; - -use Symfony\Component\HttpKernel\Profiler\Profiler; - -/** - * DataCollector. - * - * Children of this class must store the collected data in the data property. - * - * @author Fabien Potencier - */ -abstract class DataCollector implements DataCollectorInterface, \Serializable -{ - protected $data; - - public function serialize() - { - return serialize($this->data); - } - - public function unserialize($data) - { - $this->data = unserialize($data); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php deleted file mode 100644 index 5e0ff7a..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * DataCollectorInterface. - * - * @author Fabien Potencier - * - * @api - */ -interface DataCollectorInterface -{ - /** - * Collects data for the given Request and Response. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An Exception instance - * - * @api - */ - function collect(Request $request, Response $response, \Exception $exception = null); - - /** - * Returns the name of the collector. - * - * @return string The collector name - * - * @api - */ - function getName(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php deleted file mode 100644 index 66f7bf8..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcherInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * EventDataCollector. - * - * @author Fabien Potencier - */ -class EventDataCollector extends DataCollector -{ - private $dispatcher; - - public function setEventDispatcher(EventDispatcherInterface $dispatcher) - { - if ($dispatcher instanceof TraceableEventDispatcherInterface) { - $this->dispatcher = $dispatcher; - } - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'called_listeners' => null !== $this->dispatcher ? $this->dispatcher->getCalledListeners() : array(), - 'not_called_listeners' => null !== $this->dispatcher ? $this->dispatcher->getNotCalledListeners() : array(), - ); - } - - /** - * Gets the called listeners. - * - * @return array An array of called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function getCalledListeners() - { - return $this->data['called_listeners']; - } - - /** - * Gets the not called listeners. - * - * @return array An array of not called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function getNotCalledListeners() - { - return $this->data['not_called_listeners']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'events'; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php deleted file mode 100644 index d6808ce..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\FlattenException; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; - -/** - * ExceptionDataCollector. - * - * @author Fabien Potencier - */ -class ExceptionDataCollector extends DataCollector -{ - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (null !== $exception) { - $flattenException = FlattenException::create($exception); - if ($exception instanceof HttpExceptionInterface) { - $flattenException->setStatusCode($exception->getStatusCode()); - } - - $this->data = array( - 'exception' => $flattenException, - ); - } - } - - /** - * Checks if the exception is not null. - * - * @return Boolean true if the exception is not null, false otherwise - */ - public function hasException() - { - return isset($this->data['exception']); - } - - /** - * Gets the exception. - * - * @return \Exception The exception - */ - public function getException() - { - return $this->data['exception']; - } - - /** - * Gets the exception message. - * - * @return string The exception message - */ - public function getMessage() - { - return $this->data['exception']->getMessage(); - } - - /** - * Gets the exception code. - * - * @return integer The exception code - */ - public function getCode() - { - return $this->data['exception']->getCode(); - } - - /** - * Gets the status code. - * - * @return integer The status code - */ - public function getStatusCode() - { - return $this->data['exception']->getStatusCode(); - } - - /** - * Gets the exception trace. - * - * @return array The exception trace - */ - public function getTrace() - { - return $this->data['exception']->getTrace(); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'exception'; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php deleted file mode 100644 index 97f7165..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; - -/** - * LogDataCollector. - * - * @author Fabien Potencier - */ -class LoggerDataCollector extends DataCollector -{ - private $logger; - - public function __construct($logger = null) - { - if (null !== $logger && $logger instanceof DebugLoggerInterface) { - $this->logger = $logger; - } - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (null !== $this->logger) { - $this->data = array( - 'error_count' => $this->logger->countErrors(), - 'logs' => $this->sanitizeLogs($this->logger->getLogs()), - ); - } - } - - /** - * Gets the called events. - * - * @return array An array of called events - * - * @see TraceableEventDispatcherInterface - */ - public function countErrors() - { - return isset($this->data['error_count']) ? $this->data['error_count'] : 0; - } - - /** - * Gets the logs. - * - * @return array An array of logs - */ - public function getLogs() - { - return isset($this->data['logs']) ? $this->data['logs'] : array(); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'logger'; - } - - private function sanitizeLogs($logs) - { - foreach ($logs as $i => $log) { - $logs[$i]['context'] = $this->sanitizeContext($log['context']); - } - - return $logs; - } - - private function sanitizeContext($context) - { - if (is_array($context)) { - foreach ($context as $key => $value) { - $context[$key] = $this->sanitizeContext($value); - } - - return $context; - } - - if (is_resource($context)) { - return sprintf('Resource(%s)', get_resource_type($context)); - } - - if (is_object($context)) { - return sprintf('Object(%s)', get_class($context)); - } - - return $context; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php deleted file mode 100644 index c41ca31..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * MemoryDataCollector. - * - * @author Fabien Potencier - */ -class MemoryDataCollector extends DataCollector -{ - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'memory' => memory_get_peak_usage(true), - ); - } - - /** - * Gets the memory. - * - * @return integer The memory - */ - public function getMemory() - { - return $this->data['memory']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'memory'; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php deleted file mode 100644 index 54d9fac..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ /dev/null @@ -1,187 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\HttpFoundation\ParameterBag; -use Symfony\Component\HttpFoundation\HeaderBag; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\ResponseHeaderBag; - -/** - * RequestDataCollector. - * - * @author Fabien Potencier - */ -class RequestDataCollector extends DataCollector -{ - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $responseHeaders = $response->headers->all(); - $cookies = array(); - foreach ($response->headers->getCookies() as $cookie) { - $cookies[] = $this->getCookieHeader($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } - if (count($cookies) > 0) { - $responseHeaders['Set-Cookie'] = $cookies; - } - - $attributes = array(); - foreach ($request->attributes->all() as $key => $value) { - if (is_object($value)) { - $attributes[$key] = sprintf('Object(%s)', get_class($value)); - if (is_callable(array($value, '__toString'))) { - $attributes[$key] .= sprintf(' = %s', (string) $value); - } - } else { - $attributes[$key] = $value; - } - } - - $content = null; - try { - $content = $request->getContent(); - } catch (\LogicException $e) { - // the user already got the request content as a resource - $content = false; - } - - $this->data = array( - 'format' => $request->getRequestFormat(), - 'content' => $content, - 'content_type' => $response->headers->get('Content-Type') ? $response->headers->get('Content-Type') : 'text/html', - 'status_code' => $response->getStatusCode(), - 'request_query' => $request->query->all(), - 'request_request' => $request->request->all(), - 'request_headers' => $request->headers->all(), - 'request_server' => $request->server->all(), - 'request_cookies' => $request->cookies->all(), - 'request_attributes' => $attributes, - 'response_headers' => $responseHeaders, - 'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(), - 'path_info' => $request->getPathInfo(), - ); - } - - public function getPathInfo() - { - return $this->data['path_info']; - } - - public function getRequestRequest() - { - return new ParameterBag($this->data['request_request']); - } - - public function getRequestQuery() - { - return new ParameterBag($this->data['request_query']); - } - - public function getRequestHeaders() - { - return new HeaderBag($this->data['request_headers']); - } - - public function getRequestServer() - { - return new ParameterBag($this->data['request_server']); - } - - public function getRequestCookies() - { - return new ParameterBag($this->data['request_cookies']); - } - - public function getRequestAttributes() - { - return new ParameterBag($this->data['request_attributes']); - } - - public function getResponseHeaders() - { - return new ResponseHeaderBag($this->data['response_headers']); - } - - public function getSessionAttributes() - { - return $this->data['session_attributes']; - } - - public function getContent() - { - return $this->data['content']; - } - - public function getContentType() - { - return $this->data['content_type']; - } - - public function getStatusCode() - { - return $this->data['status_code']; - } - - public function getFormat() - { - return $this->data['format']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'request'; - } - - private function getCookieHeader($name, $value, $expires, $path, $domain, $secure, $httponly) - { - $cookie = sprintf('%s=%s', $name, urlencode($value)); - - if (0 !== $expires) { - if (is_numeric($expires)) { - $expires = (int) $expires; - } elseif ($expires instanceof \DateTime) { - $expires = $expires->getTimestamp(); - } else { - $expires = strtotime($expires); - if (false === $expires || -1 == $expires) { - throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid.', $expires)); - } - } - - $cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5); - } - - if ($domain) { - $cookie .= '; domain='.$domain; - } - - $cookie .= '; path='.$path; - - if ($secure) { - $cookie .= '; secure'; - } - - if ($httponly) { - $cookie .= '; httponly'; - } - - return $cookie; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php b/core/vendor/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php deleted file mode 100644 index bdeb84c..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpKernel\DataCollector\DataCollector; -use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * TimeDataCollector. - * - * @author Fabien Potencier - */ -class TimeDataCollector extends DataCollector -{ - protected $kernel; - - public function __construct(KernelInterface $kernel = null) - { - $this->kernel = $kernel; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'start_time' => (null !== $this->kernel ? $this->kernel->getStartTime() : $_SERVER['REQUEST_TIME']) * 1000, - 'events' => array(), - ); - } - - /** - * Sets the request events. - * - * @param array $events The request events - */ - public function setEvents(array $events) - { - foreach ($events as $event) { - $event->ensureStopped(); - } - - $this->data['events'] = $events; - } - - /** - * Gets the request events. - * - * @return array The request events - */ - public function getEvents() - { - return $this->data['events']; - } - - /** - * Gets the request elapsed time. - * - * @return integer The elapsed time - */ - public function getTotalTime() - { - $values = array_values($this->data['events']); - $lastEvent = $values[count($values) - 1]; - - return $lastEvent->getOrigin() + $lastEvent->getEndTime() - $this->data['start_time']; - } - - /** - * Gets the initialization time. - * - * This is the time spent until the beginning of the request handling. - * - * @return integer The elapsed time - */ - public function getInitTime() - { - return $this->data['events']['section']->getOrigin() - $this->getStartTime(); - } - - /** - * Gets the request time. - * - * @return integer The time - */ - public function getStartTime() - { - return $this->data['start_time']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'time'; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/ErrorHandler.php b/core/vendor/Symfony/Component/HttpKernel/Debug/ErrorHandler.php deleted file mode 100644 index 942e82b..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Debug/ErrorHandler.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\HttpKernel\Debug; - -/** - * ErrorHandler. - * - * @author Fabien Potencier - */ -class ErrorHandler -{ - private $levels = array( - E_WARNING => 'Warning', - E_NOTICE => 'Notice', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice', - E_RECOVERABLE_ERROR => 'Catchable Fatal Error', - ); - - private $level; - - /** - * Register the error handler. - * - * @param integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable) - * - * @return The registered error handler - */ - static public function register($level = null) - { - $handler = new static(); - $handler->setLevel($level); - - set_error_handler(array($handler, 'handle')); - - return $handler; - } - - public function setLevel($level) - { - $this->level = null === $level ? error_reporting() : $level; - } - - /** - * @throws \ErrorException When error_reporting returns error - */ - public function handle($level, $message, $file, $line, $context) - { - if (0 === $this->level) { - return false; - } - - if (error_reporting() & $level && $this->level & $level) { - throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line)); - } - - return false; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php b/core/vendor/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php deleted file mode 100644 index a9da249..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php +++ /dev/null @@ -1,263 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\FlattenException; - -if (!defined('ENT_SUBSTITUTE')) { - define('ENT_SUBSTITUTE', 8); -} - -/** - * ExceptionHandler converts an exception to a Response object. - * - * It is mostly useful in debug mode to replace the default PHP/XDebug - * output with something prettier and more useful. - * - * As this class is mainly used during Kernel boot, where nothing is yet - * available, the Response content is always HTML. - * - * @author Fabien Potencier - */ -class ExceptionHandler -{ - private $debug; - private $charset; - - public function __construct($debug = true, $charset = 'UTF-8') - { - $this->debug = $debug; - $this->charset = $charset; - } - - /** - * Register the exception handler. - * - * @return The registered exception handler - */ - static public function register($debug = true) - { - $handler = new static($debug); - - set_exception_handler(array($handler, 'handle')); - - return $handler; - } - - /** - * Sends a Response for the given Exception. - * - * @param \Exception $exception An \Exception instance - */ - public function handle(\Exception $exception) - { - $this->createResponse($exception)->send(); - } - - /** - * Creates the error Response associated with the given Exception. - * - * @param \Exception|FlattenException $exception An \Exception instance - * - * @return Response A Response instance - */ - public function createResponse($exception) - { - $content = ''; - $title = ''; - try { - if (!$exception instanceof FlattenException) { - $exception = FlattenException::create($exception); - } - - switch ($exception->getStatusCode()) { - case 404: - $title = 'Sorry, the page you are looking for could not be found.'; - break; - default: - $title = 'Whoops, looks like something went wrong.'; - } - - if ($this->debug) { - $content = $this->getContent($exception); - } - } catch (\Exception $e) { - // something nasty happened and we cannot throw an exception here anymore - if ($this->debug) { - $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($exception), $exception->getMessage()); - } else { - $title = 'Whoops, looks like something went wrong.'; - } - } - - return new Response($this->decorate($content, $title), $exception->getStatusCode()); - } - - private function getContent($exception) - { - $message = nl2br($exception->getMessage()); - $class = $this->abbrClass($exception->getClass()); - $count = count($exception->getAllPrevious()); - $content = ''; - foreach ($exception->toArray() as $position => $e) { - $ind = $count - $position + 1; - $total = $count + 1; - $class = $this->abbrClass($e['class']); - $message = nl2br($e['message']); - $content .= sprintf(<< -

%d/%d %s: %s

- -
-
    - -EOF - , $ind, $total, $class, $message); - foreach ($e['trace'] as $i => $trace) { - $content .= '
  1. '; - if ($trace['function']) { - $content .= sprintf('at %s%s%s(%s)', $this->abbrClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); - } - if (isset($trace['file']) && isset($trace['line'])) { - if ($linkFormat = ini_get('xdebug.file_link_format')) { - $link = str_replace(array('%f', '%l'), array($trace['file'], $trace['line']), $linkFormat); - $content .= sprintf(' in %s line %s', $link, $trace['file'], $trace['line']); - } else { - $content .= sprintf(' in %s line %s', $trace['file'], $trace['line']); - } - } - $content .= "
  2. \n"; - } - - $content .= "
\n
\n"; - } - - return $content; - } - - private function decorate($content, $title) - { - return << - - - - - {$title} - - - -
-

$title

-$content -
- - -EOF; - } - - private function abbrClass($class) - { - $parts = explode('\\', $class); - - return sprintf("%s", $class, array_pop($parts)); - } - - /** - * Formats an array as a string. - * - * @param array $args The argument array - * - * @return string - */ - public function formatArgs(array $args) - { - $result = array(); - foreach ($args as $key => $item) { - if ('object' === $item[0]) { - $formattedValue = sprintf("object(%s)", $this->abbrClass($item[1])); - } elseif ('array' === $item[0]) { - $formattedValue = sprintf("array(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); - } elseif ('string' === $item[0]) { - $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset)); - } elseif ('null' === $item[0]) { - $formattedValue = 'null'; - } elseif ('boolean' === $item[0]) { - $formattedValue = ''.strtolower(var_export($item[1], true)).''; - } elseif ('resource' === $item[0]) { - $formattedValue = 'resource'; - } else { - $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), true)); - } - - $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); - } - - return implode(', ', $result); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/Stopwatch.php b/core/vendor/Symfony/Component/HttpKernel/Debug/Stopwatch.php deleted file mode 100644 index f964d42..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Debug/Stopwatch.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -/** - * Stopwatch provides a way to profile code. - * - * @author Fabien Potencier - */ -class Stopwatch -{ - private $waiting; - private $sections; - private $events; - private $origin; - - /** - * Starts a new section. - */ - public function startSection() - { - if ($this->events) { - $this->start('section.child', 'section'); - $this->waiting[] = array($this->events, $this->origin); - $this->events = array(); - } - - $this->origin = microtime(true) * 1000; - - $this->start('section'); - } - - /** - * Stops the last started section. - * - * The id parameter is used to retrieve the events from this section. - * - * @see getSectionEvents - * - * @param string $id The identifier of the section - */ - public function stopSection($id) - { - $this->stop('section'); - - if (null !== $id) { - $this->sections[$id] = $this->events; - } - - if ($this->waiting) { - list($this->events, $this->origin) = array_pop($this->waiting); - $this->stop('section.child'); - } else { - $this->origin = null; - $this->events = array(); - } - } - - /** - * Starts an event. - * - * @param string $name The event name - * @param string $category The event category - * - * @return StopwatchEvent A StopwatchEvent instance - */ - public function start($name, $category = null) - { - if (!isset($this->events[$name])) { - $this->events[$name] = new StopwatchEvent($this->origin ?: microtime(true) * 1000, $category); - } - - return $this->events[$name]->start(); - } - - /** - * Stops an event. - * - * @param string $name The event name - * - * @return StopwatchEvent A StopwatchEvent instance - */ - public function stop($name) - { - if (!isset($this->events[$name])) { - throw new \LogicException(sprintf('Event "%s" is not started.', $name)); - } - - return $this->events[$name]->stop(); - } - - /** - * Stops then restart an event. - * - * @param string $name The event name - * - * @return StopwatchEvent A StopwatchEvent instance - */ - public function lap($name) - { - return $this->stop($name)->start(); - } - - /** - * Gets all events for a given section. - * - * @param string $id A section identifier - * - * @return StopwatchEvent[] An array of StopwatchEvent instances - */ - public function getSectionEvents($id) - { - return isset($this->sections[$id]) ? $this->sections[$id] : array(); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php b/core/vendor/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php deleted file mode 100644 index f606f1b..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php +++ /dev/null @@ -1,177 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -/** - * Represents an Event managed by Stopwatch. - * - * @author Fabien Potencier - */ -class StopwatchEvent -{ - private $periods; - private $origin; - private $category; - private $started; - - /** - * Constructor. - * - * @param integer $origin The origin time in milliseconds - * @param string $category The event category - * - * @throws \InvalidArgumentException When the raw time is not valid - */ - public function __construct($origin, $category = null) - { - $this->origin = $this->formatTime($origin); - $this->category = is_string($category) ? $category : 'default'; - $this->started = array(); - $this->periods = array(); - } - - /** - * Gets the category. - * - * @return string The category - */ - public function getCategory() - { - return $this->category; - } - - /** - * Gets the origin. - * - * @return integer The origin in milliseconds - */ - public function getOrigin() - { - return $this->origin; - } - - /** - * Starts a new event period. - * - * @return StopwatchEvent The event. - */ - public function start() - { - $this->started[] = $this->getNow(); - - return $this; - } - - /** - * Stops the last started event period. - * - * @return StopwatchEvent The event. - */ - public function stop() - { - if (!count($this->started)) { - throw new \LogicException('stop() called but start() has not been called before.'); - } - - $this->periods[] = array(array_pop($this->started), $this->getNow()); - - return $this; - } - - /** - * Stops the current period and then starts a new one. - * - * @return StopwatchEvent The event. - */ - public function lap() - { - return $this->stop()->start(); - } - - /** - * Stops all non already stopped periods. - */ - public function ensureStopped() - { - while (count($this->started)) { - $this->stop(); - } - } - - /** - * Gets all event periods. - * - * @return array An array of periods - */ - public function getPeriods() - { - return $this->periods; - } - - /** - * Gets the relative time of the start of the first period. - * - * @return integer The time (in milliseconds) - */ - public function getStartTime() - { - return isset($this->periods[0]) ? $this->periods[0][0] : 0; - } - - /** - * Gets the relative time of the end of the last period. - * - * @return integer The time (in milliseconds) - */ - public function getEndTime() - { - return ($count = count($this->periods)) ? $this->periods[$count - 1][1] : 0; - } - - /** - * Gets the total time of all periods. - * - * @return integer The time (in milliseconds) - */ - public function getTotalTime() - { - $total = 0; - foreach ($this->periods as $period) { - $total += $period[1] - $period[0]; - } - - return $this->formatTime($total); - } - - private function getNow() - { - return $this->formatTime(microtime(true) * 1000 - $this->origin); - } - - /** - * Formats a time. - * - * @param numerical $time A raw time - * - * @return float The formatted time - * - * @throws \InvalidArgumentException When the raw time is not valid - */ - private function formatTime($time) - { - if (!is_numeric($time)) { - throw new \InvalidArgumentException('The time must be a numerical value'); - } - - return round($time, 1); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcherInterface.php b/core/vendor/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcherInterface.php deleted file mode 100644 index 622acd6..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcherInterface.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\HttpKernel\Debug; - -/** - * @author Fabien Potencier - */ -interface TraceableEventDispatcherInterface -{ - /** - * Gets the called listeners. - * - * @return array An array of called listeners - */ - function getCalledListeners(); - - /** - * Gets the not called listeners. - * - * @return array An array of not called listeners - */ - function getNotCalledListeners(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php b/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php deleted file mode 100644 index d18c72b..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\HttpKernel\Kernel; - -/** - * Sets the classes to compile in the cache for the container. - * - * @author Fabien Potencier - */ -class AddClassesToCachePass implements CompilerPassInterface -{ - private $kernel; - - public function __construct(Kernel $kernel) - { - $this->kernel = $kernel; - } - - /** - * {@inheritDoc} - */ - public function process(ContainerBuilder $container) - { - $classes = array(); - foreach ($container->getExtensions() as $extension) { - if ($extension instanceof Extension) { - $classes = array_merge($classes, $extension->getClassesToCompile()); - } - } - - $this->kernel->setClassCache(array_unique($container->getParameterBag()->resolveValue($classes))); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/Extension.php b/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/Extension.php deleted file mode 100644 index dcdf032..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/Extension.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -/** - * Provides useful features shared by many extensions. - * - * @author Fabien Potencier - */ -abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface -{ - private $classes = array(); - - /** - * Gets the classes to cache. - * - * @return array An array of classes - */ - public function getClassesToCompile() - { - return $this->classes; - } - - /** - * Adds classes to the class cache. - * - * @param array $classes An array of classes - */ - public function addClassesToCompile(array $classes) - { - $this->classes = array_merge($this->classes, $classes); - } - - /** - * Returns the base path for the XSD files. - * - * @return string The XSD base path - */ - public function getXsdValidationBasePath() - { - return false; - } - - /** - * Returns the namespace to be used for this extension (XML namespace). - * - * @return string The XML namespace - */ - public function getNamespace() - { - return 'http://example.org/schema/dic/'.$this->getAlias(); - } - - /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * This convention is to remove the "Extension" postfix from the class - * name and then lowercase and underscore the result. So: - * - * AcmeHelloExtension - * - * becomes - * - * acme_hello - * - * This can be overridden in a sub-class to specify the alias manually. - * - * @return string The alias - */ - public function getAlias() - { - $className = get_class($this); - if (substr($className, -9) != 'Extension') { - throw new \BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); - } - $classBaseName = substr(strrchr($className, '\\'), 1, -9); - - return Container::underscore($classBaseName); - } - - protected final function processConfiguration(ConfigurationInterface $configuration, array $configs) - { - $processor = new Processor(); - - return $processor->processConfiguration($configuration, $configs); - } - - /** - * {@inheritDoc} - */ - public function getConfiguration(array $config, ContainerBuilder $container) - { - $reflected = new \ReflectionClass($this); - $namespace = $reflected->getNamespaceName(); - - $class = $namespace . '\\Configuration'; - if (class_exists($class)) { - if (!method_exists($class, '__construct')) { - $configuration = new $class(); - - return $configuration; - } - } - - return null; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php b/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php deleted file mode 100644 index d7d9c18..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass as BaseMergeExtensionConfigurationPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Ensures certain extensions are always loaded. - * - * @author Kris Wallsmith - */ -class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPass -{ - private $extensions; - - public function __construct(array $extensions) - { - $this->extensions = $extensions; - } - - public function process(ContainerBuilder $container) - { - foreach ($this->extensions as $extension) { - if (!count($container->getExtensionConfig($extension))) { - $container->loadFromExtension($extension, array()); - } - } - - parent::process($container); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php b/core/vendor/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php deleted file mode 100644 index fbac347..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Event/FilterControllerEvent.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\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows filtering of a controller callable - * - * You can call getController() to retrieve the current controller. With - * setController() you can set a new controller that is used in the processing - * of the request. - * - * Controllers should be callables. - * - * @author Bernhard Schussek - * - * @api - */ -class FilterControllerEvent extends KernelEvent -{ - /** - * The current controller - * @var callable - */ - private $controller; - - public function __construct(HttpKernelInterface $kernel, $controller, Request $request, $requestType) - { - parent::__construct($kernel, $request, $requestType); - - $this->setController($controller); - } - - /** - * Returns the current controller - * - * @return callable - * - * @api - */ - public function getController() - { - return $this->controller; - } - - /** - * Sets a new controller - * - * @param callable $controller - * - * @api - */ - public function setController($controller) - { - // controller must be a callable - if (!is_callable($controller)) { - throw new \LogicException(sprintf('The controller must be a callable (%s given).', $this->varToString($controller))); - } - - $this->controller = $controller; - } - - private function varToString($var) - { - if (is_object($var)) { - return sprintf('Object(%s)', get_class($var)); - } - - if (is_array($var)) { - $a = array(); - foreach ($var as $k => $v) { - $a[] = sprintf('%s => %s', $k, $this->varToString($v)); - } - - return sprintf("Array(%s)", implode(', ', $a)); - } - - if (is_resource($var)) { - return sprintf('Resource(%s)', get_resource_type($var)); - } - - if (null === $var) { - return 'null'; - } - - if (false === $var) { - return 'false'; - } - - if (true === $var) { - return 'true'; - } - - return (string) $var; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php b/core/vendor/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php deleted file mode 100644 index 7e1f4a2..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Event/FilterResponseEvent.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\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to filter a Response object - * - * You can call getResponse() to retrieve the current response. With - * setResponse() you can set a new response that will be returned to the - * browser. - * - * @author Bernhard Schussek - * - * @api - */ -class FilterResponseEvent extends KernelEvent -{ - /** - * The current response object - * @var Symfony\Component\HttpFoundation\Response - */ - private $response; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, Response $response) - { - parent::__construct($kernel, $request, $requestType); - - $this->setResponse($response); - } - - /** - * Returns the current response object - * - * @return Symfony\Component\HttpFoundation\Response - * - * @api - */ - public function getResponse() - { - return $this->response; - } - - /** - * Sets a new response object - * - * @param Symfony\Component\HttpFoundation\Response $response - * - * @api - */ - public function setResponse(Response $response) - { - $this->response = $response; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseEvent.php b/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseEvent.php deleted file mode 100644 index eb726c0..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseEvent.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to create a response for a request - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * @author Bernhard Schussek - * - * @api - */ -class GetResponseEvent extends KernelEvent -{ - /** - * The response object - * @var Symfony\Component\HttpFoundation\Response - */ - private $response; - - /** - * Returns the response object - * - * @return Symfony\Component\HttpFoundation\Response - * - * @api - */ - public function getResponse() - { - return $this->response; - } - - /** - * Sets a response and stops event propagation - * - * @param Symfony\Component\HttpFoundation\Response $response - * - * @api - */ - public function setResponse(Response $response) - { - $this->response = $response; - - $this->stopPropagation(); - } - - /** - * Returns whether a response was set - * - * @return Boolean Whether a response was set - * - * @api - */ - public function hasResponse() - { - return null !== $this->response; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php b/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php deleted file mode 100644 index 25ceca8..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows to create a response for the return value of a controller - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * @author Bernhard Schussek - * - * @api - */ -class GetResponseForControllerResultEvent extends GetResponseEvent -{ - /** - * The return value of the controller - * @var mixed - */ - private $controllerResult; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, $controllerResult) - { - parent::__construct($kernel, $request, $requestType); - - $this->controllerResult = $controllerResult; - } - - /** - * Returns the return value of the controller - * - * @return mixed The controller return value - * - * @api - */ - public function getControllerResult() - { - return $this->controllerResult; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php b/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php deleted file mode 100644 index f7cf28d..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows to create a response for a thrown exception - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * You can also call setException() to replace the thrown exception. This - * exception will be thrown if no response is set during processing of this - * event. - * - * @author Bernhard Schussek - * - * @api - */ -class GetResponseForExceptionEvent extends GetResponseEvent -{ - /** - * The exception object - * @var \Exception - */ - private $exception; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, \Exception $e) - { - parent::__construct($kernel, $request, $requestType); - - $this->setException($e); - } - - /** - * Returns the thrown exception - * - * @return \Exception The thrown exception - * - * @api - */ - public function getException() - { - return $this->exception; - } - - /** - * Replaces the thrown exception - * - * This exception will be thrown if no response is set in the event. - * - * @param \Exception $exception The thrown exception - * - * @api - */ - public function setException(\Exception $exception) - { - $this->exception = $exception; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/KernelEvent.php b/core/vendor/Symfony/Component/HttpKernel/Event/KernelEvent.php deleted file mode 100644 index 4dcfd11..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Event/KernelEvent.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\EventDispatcher\Event; - -/** - * Base class for events thrown in the HttpKernel component - * - * @author Bernhard Schussek - * - * @api - */ -class KernelEvent extends Event -{ - /** - * The kernel in which this event was thrown - * @var Symfony\Component\HttpKernel\HttpKernelInterface - */ - private $kernel; - - /** - * The request the kernel is currently processing - * @var Symfony\Component\HttpFoundation\Request - */ - private $request; - - /** - * The request type the kernel is currently processing. One of - * HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST - * @var integer - */ - private $requestType; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType) - { - $this->kernel = $kernel; - $this->request = $request; - $this->requestType = $requestType; - } - - /** - * Returns the kernel in which this event was thrown - * - * @return Symfony\Component\HttpKernel\HttpKernelInterface - * - * @api - */ - public function getKernel() - { - return $this->kernel; - } - - /** - * Returns the request the kernel is currently processing - * - * @return Symfony\Component\HttpFoundation\Request - * - * @api - */ - public function getRequest() - { - return $this->request; - } - - /** - * Returns the request type the kernel is currently processing - * - * @return integer One of HttpKernelInterface::MASTER_REQUEST and - * HttpKernelInterface::SUB_REQUEST - * - * @api - */ - public function getRequestType() - { - return $this->requestType; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/PostResponseEvent.php b/core/vendor/Symfony/Component/HttpKernel/Event/PostResponseEvent.php deleted file mode 100644 index 6848f78..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Event/PostResponseEvent.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to execute logic after a response was sent - * - * @author Jordi Boggiano - */ -class PostResponseEvent extends Event -{ - /** - * The kernel in which this event was thrown - * @var HttpKernelInterface - */ - private $kernel; - - private $request; - - private $response; - - public function __construct(HttpKernelInterface $kernel, Request $request, Response $response) - { - $this->kernel = $kernel; - $this->request = $request; - $this->response = $response; - } - - /** - * Returns the kernel in which this event was thrown. - * - * @return HttpKernelInterface - */ - public function getKernel() - { - return $this->kernel; - } - - /** - * Returns the request for which this event was thrown. - * - * @return Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Returns the reponse for which this event was thrown. - * - * @return Response - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/EsiListener.php b/core/vendor/Symfony/Component/HttpKernel/EventListener/EsiListener.php deleted file mode 100644 index d48d740..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/EsiListener.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * EsiListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for ESI. - * - * @author Fabien Potencier - */ -class EsiListener implements EventSubscriberInterface -{ - private $i; - private $esi; - - /** - * Constructor. - * - * @param Esi $esi An ESI instance - */ - public function __construct(Esi $esi = null) - { - $this->esi = $esi; - } - - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType() || null === $this->esi) { - return; - } - - $this->esi->addSurrogateControl($event->getResponse()); - } - - static public function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => 'onKernelResponse', - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/core/vendor/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php deleted file mode 100644 index 0577dcf..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/ExceptionListener.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\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Exception\FlattenException; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ExceptionListener. - * - * @author Fabien Potencier - */ -class ExceptionListener implements EventSubscriberInterface -{ - private $controller; - private $logger; - - public function __construct($controller, LoggerInterface $logger = null) - { - $this->controller = $controller; - $this->logger = $logger; - } - - public function onKernelException(GetResponseForExceptionEvent $event) - { - static $handling; - - if (true === $handling) { - return false; - } - - $handling = true; - - $exception = $event->getException(); - $request = $event->getRequest(); - - if (null !== $this->logger) { - $message = sprintf('%s: %s (uncaught exception) at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine()); - if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { - $this->logger->crit($message); - } else { - $this->logger->err($message); - } - } else { - error_log(sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine())); - } - - $logger = $this->logger instanceof DebugLoggerInterface ? $this->logger : null; - - $flattenException = FlattenException::create($exception); - if ($exception instanceof HttpExceptionInterface) { - $flattenException->setStatusCode($exception->getStatusCode()); - $flattenException->setHeaders($exception->getHeaders()); - } - - $attributes = array( - '_controller' => $this->controller, - 'exception' => $flattenException, - 'logger' => $logger, - 'format' => $request->getRequestFormat(), - ); - - $request = $request->duplicate(null, null, $attributes); - - try { - $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, true); - } catch (\Exception $e) { - $message = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $e->getMessage()); - if (null !== $this->logger) { - if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { - $this->logger->crit($message); - } else { - $this->logger->err($message); - } - } else { - error_log($message); - } - - // set handling to false otherwise it wont be able to handle further more - $handling = false; - - // re-throw the exception as this is a catch-all - throw $exception; - } - - $event->setResponse($response); - - $handling = false; - } - - static public function getSubscribedEvents() - { - return array( - KernelEvents::EXCEPTION => array('onKernelException', -128), - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/LocaleListener.php b/core/vendor/Symfony/Component/HttpKernel/EventListener/LocaleListener.php deleted file mode 100644 index 8adefc5..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/LocaleListener.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\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Routing\RouterInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Initializes the locale based on the current request. - * - * @author Fabien Potencier - */ -class LocaleListener implements EventSubscriberInterface -{ - private $router; - private $defaultLocale; - - public function __construct($defaultLocale = 'en', RouterInterface $router = null) - { - $this->defaultLocale = $defaultLocale; - $this->router = $router; - } - - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - - if ($request->hasPreviousSession()) { - $request->setDefaultLocale($request->getSession()->get('_locale', $this->defaultLocale)); - } else { - $request->setDefaultLocale($this->defaultLocale); - } - - if ($locale = $request->attributes->get('_locale')) { - $request->setLocale($locale); - - if ($request->hasPreviousSession()) { - $request->getSession()->set('_locale', $request->getLocale()); - } - } - - if (null !== $this->router) { - $this->router->getContext()->setParameter('_locale', $request->getLocale()); - } - } - - static public function getSubscribedEvents() - { - return array( - // must be registered after the Router to have access to the _locale - KernelEvents::REQUEST => array(array('onKernelRequest', 16)), - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/core/vendor/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php deleted file mode 100644 index aa78dba..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\HttpFoundation\RequestMatcherInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ProfilerListener collects data for the current request by listening to the onKernelResponse event. - * - * @author Fabien Potencier - */ -class ProfilerListener implements EventSubscriberInterface -{ - protected $profiler; - protected $matcher; - protected $onlyException; - protected $onlyMasterRequests; - protected $exception; - protected $children; - protected $requests; - - /** - * Constructor. - * - * @param Profiler $profiler A Profiler instance - * @param RequestMatcherInterface $matcher A RequestMatcher instance - * @param Boolean $onlyException true if the profiler only collects data when an exception occurs, false otherwise - * @param Boolean $onlyMasterRequests true if the profiler only collects data when the request is a master request, false otherwise - */ - public function __construct(Profiler $profiler, RequestMatcherInterface $matcher = null, $onlyException = false, $onlyMasterRequests = false) - { - $this->profiler = $profiler; - $this->matcher = $matcher; - $this->onlyException = (Boolean) $onlyException; - $this->onlyMasterRequests = (Boolean) $onlyMasterRequests; - $this->children = new \SplObjectStorage(); - } - - /** - * Handles the onKernelException event. - * - * @param GetResponseForExceptionEvent $event A GetResponseForExceptionEvent instance - */ - public function onKernelException(GetResponseForExceptionEvent $event) - { - if ($this->onlyMasterRequests && HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - $this->exception = $event->getException(); - } - - public function onKernelRequest(GetResponseEvent $event) - { - $this->requests[] = $event->getRequest(); - } - - /** - * Handles the onKernelResponse event. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - $master = HttpKernelInterface::MASTER_REQUEST === $event->getRequestType(); - if ($this->onlyMasterRequests && !$master) { - return; - } - - if ($this->onlyException && null === $this->exception) { - return; - } - - $exception = $this->exception; - $this->exception = null; - - if (null !== $this->matcher && !$this->matcher->matches($event->getRequest())) { - return; - } - - if (!$profile = $this->profiler->collect($event->getRequest(), $event->getResponse(), $exception)) { - return; - } - - // keep the profile as the child of its parent - if (!$master) { - array_pop($this->requests); - - $parent = $this->requests[count($this->requests) - 1]; - if (!isset($this->children[$parent])) { - $profiles = array($profile); - } else { - $profiles = $this->children[$parent]; - $profiles[] = $profile; - } - - $this->children[$parent] = $profiles; - } - - // store the profile and its children - if (isset($this->children[$event->getRequest()])) { - foreach ($this->children[$event->getRequest()] as $child) { - $child->setParent($profile); - $profile->addChild($child); - $this->profiler->saveProfile($child); - } - $this->children[$event->getRequest()] = array(); - } - - $this->profiler->saveProfile($profile); - } - - static public function getSubscribedEvents() - { - return array( - // kernel.request must be registered as early as possible to not break - // when an exception is thrown in any other kernel.request listener - KernelEvents::REQUEST => array('onKernelRequest', 1024), - - KernelEvents::RESPONSE => array('onKernelResponse', -100), - KernelEvents::EXCEPTION => 'onKernelException', - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/ResponseListener.php b/core/vendor/Symfony/Component/HttpKernel/EventListener/ResponseListener.php deleted file mode 100644 index d047b1f..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/ResponseListener.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ResponseListener fixes the Response headers based on the Request. - * - * @author Fabien Potencier - */ -class ResponseListener implements EventSubscriberInterface -{ - private $charset; - - public function __construct($charset) - { - $this->charset = $charset; - } - - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - $response = $event->getResponse(); - - if (null === $response->getCharset()) { - $response->setCharset($this->charset); - } - - $response->prepare($event->getRequest()); - } - - static public function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => 'onKernelResponse', - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/core/vendor/Symfony/Component/HttpKernel/EventListener/RouterListener.php deleted file mode 100644 index a352685..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/RouterListener.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Log\LoggerInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Initializes request attributes based on a matching route. - * - * @author Fabien Potencier - */ -class RouterListener implements EventSubscriberInterface -{ - private $urlMatcher; - private $logger; - - public function __construct(UrlMatcherInterface $urlMatcher, LoggerInterface $logger = null) - { - $this->urlMatcher = $urlMatcher; - $this->logger = $logger; - } - - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - - if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { - $this->urlMatcher->getContext()->fromRequest($request); - } - - if ($request->attributes->has('_controller')) { - // routing is already done - return; - } - - // add attributes based on the path info (routing) - try { - $parameters = $this->urlMatcher->match($request->getPathInfo()); - - if (null !== $this->logger) { - $this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters))); - } - - $request->attributes->add($parameters); - unset($parameters['_route']); - $request->attributes->set('_route_params', $parameters); - } catch (ResourceNotFoundException $e) { - $message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo()); - - throw new NotFoundHttpException($message, $e); - } catch (MethodNotAllowedException $e) { - $message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getPathInfo(), strtoupper(implode(', ', $e->getAllowedMethods()))); - - throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e); - } - } - - private function parametersToString(array $parameters) - { - $pieces = array(); - foreach ($parameters as $key => $val) { - $pieces[] = sprintf('"%s": "%s"', $key, (is_string($val) ? $val : json_encode($val))); - } - - return implode(', ', $pieces); - } - - static public function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 32)), - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php b/core/vendor/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php deleted file mode 100644 index 588c5fe..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.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\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * StreamedResponseListener is responsible for sending the Response - * to the client. - * - * @author Fabien Potencier - */ -class StreamedResponseListener implements EventSubscriberInterface -{ - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { - return; - } - - $response = $event->getResponse(); - - if ($response instanceof StreamedResponse) { - $response->send(); - } - } - - static public function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', -1024), - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php b/core/vendor/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php deleted file mode 100644 index 7778df8..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.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\HttpKernel\Exception; - -/** - * AccessDeniedHttpException. - * - * @author Fabien Potencier - * @author Christophe Coevoet - */ -class AccessDeniedHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(403, $message, $previous, array(), $code); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/FlattenException.php b/core/vendor/Symfony/Component/HttpKernel/Exception/FlattenException.php deleted file mode 100644 index c48606e..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Exception/FlattenException.php +++ /dev/null @@ -1,202 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * FlattenException wraps a PHP Exception to be able to serialize it. - * - * Basically, this class removes all objects from the trace. - * - * @author Fabien Potencier - */ -class FlattenException -{ - private $message; - private $code; - private $previous; - private $trace; - private $class; - private $statusCode; - private $headers; - - static public function create(\Exception $exception, $statusCode = null, array $headers = array()) - { - $e = new static(); - $e->setMessage($exception->getMessage()); - $e->setCode($exception->getCode()); - - if (null === $statusCode) { - $statusCode = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500; - } - - $e->setStatusCode($statusCode); - $e->setHeaders($headers); - $e->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine()); - $e->setClass(get_class($exception)); - if ($exception->getPrevious()) { - $e->setPrevious(static::create($exception->getPrevious())); - } - - return $e; - } - - public function toArray() - { - $exceptions = array(); - foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) { - $exceptions[] = array( - 'message' => $exception->getMessage(), - 'class' => $exception->getClass(), - 'trace' => $exception->getTrace(), - ); - } - - return $exceptions; - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function setStatusCode($code) - { - $this->statusCode = $code; - } - - public function getHeaders() - { - return $this->headers; - } - - public function setHeaders(array $headers) - { - $this->headers = $headers; - } - - public function getClass() - { - return $this->class; - } - - public function setClass($class) - { - $this->class = $class; - } - - public function getMessage() - { - return $this->message; - } - - public function setMessage($message) - { - $this->message = $message; - } - - public function getCode() - { - return $this->code; - } - - public function setCode($code) - { - $this->code = $code; - } - - public function getPrevious() - { - return $this->previous; - } - - public function setPrevious(FlattenException $previous) - { - $this->previous = $previous; - } - - public function getAllPrevious() - { - $exceptions = array(); - $e = $this; - while ($e = $e->getPrevious()) { - $exceptions[] = $e; - } - - return $exceptions; - } - - public function getTrace() - { - return $this->trace; - } - - public function setTrace($trace, $file, $line) - { - $this->trace = array(); - $this->trace[] = array( - 'namespace' => '', - 'short_class' => '', - 'class' => '', - 'type' => '', - 'function' => '', - 'file' => $file, - 'line' => $line, - 'args' => array(), - ); - foreach ($trace as $entry) { - $class = ''; - $namespace = ''; - if (isset($entry['class'])) { - $parts = explode('\\', $entry['class']); - $class = array_pop($parts); - $namespace = implode('\\', $parts); - } - - $this->trace[] = array( - 'namespace' => $namespace, - 'short_class' => $class, - 'class' => isset($entry['class']) ? $entry['class'] : '', - 'type' => isset($entry['type']) ? $entry['type'] : '', - 'function' => $entry['function'], - 'file' => isset($entry['file']) ? $entry['file'] : null, - 'line' => isset($entry['line']) ? $entry['line'] : null, - 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), - ); - } - } - - private function flattenArgs($args, $level = 0) - { - $result = array(); - foreach ($args as $key => $value) { - if (is_object($value)) { - $result[$key] = array('object', get_class($value)); - } elseif (is_array($value)) { - if ($level > 10) { - $result[$key] = array('array', '*DEEP NESTED ARRAY*'); - } else { - $result[$key] = array('array', $this->flattenArgs($value, ++$level)); - } - } elseif (null === $value) { - $result[$key] = array('null', null); - } elseif (is_bool($value)) { - $result[$key] = array('boolean', $value); - } elseif (is_resource($value)) { - $result[$key] = array('resource', get_resource_type($value)); - } else { - $result[$key] = array('string', (string) $value); - } - } - - return $result; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/HttpException.php b/core/vendor/Symfony/Component/HttpKernel/Exception/HttpException.php deleted file mode 100644 index 4e1b526..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Exception/HttpException.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\HttpKernel\Exception; - -/** - * HttpException. - * - * @author Kris Wallsmith - */ -class HttpException extends \RuntimeException implements HttpExceptionInterface -{ - private $statusCode; - private $headers; - - public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = array(), $code = 0) - { - $this->statusCode = $statusCode; - $this->headers = $headers; - - parent::__construct($message, $code, $previous); - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function getHeaders() - { - return $this->headers; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php b/core/vendor/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php deleted file mode 100644 index 11102bd..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * Interface for HTTP error exceptions. - * - * @author Kris Wallsmith - */ -interface HttpExceptionInterface -{ - /** - * Returns the status code. - * - * @return integer An HTTP response status code - */ - function getStatusCode(); - - /** - * Returns response headers. - * - * @return array Response headers - */ - function getHeaders(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php b/core/vendor/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php deleted file mode 100644 index 7ae7b7a..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * MethodNotAllowedHttpException. - * - * @author Kris Wallsmith - */ -class MethodNotAllowedHttpException extends HttpException -{ - /** - * Constructor. - * - * @param array $allow An array of allowed methods - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code - */ - public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array('Allow' => strtoupper(implode(', ', $allow))); - - parent::__construct(405, $message, $previous, $headers, $code); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php b/core/vendor/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php deleted file mode 100644 index c99502d..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.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\HttpKernel\Exception; - -/** - * NotFoundHttpException. - * - * @author Fabien Potencier - */ -class NotFoundHttpException extends HttpException -{ - /** - * Constructor. - * - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(404, $message, $previous, array(), $code); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/Esi.php b/core/vendor/Symfony/Component/HttpKernel/HttpCache/Esi.php deleted file mode 100644 index e1a0e6a..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/HttpCache/Esi.php +++ /dev/null @@ -1,234 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -/** - * Esi implements the ESI capabilities to Request and Response instances. - * - * For more information, read the following W3C notes: - * - * * ESI Language Specification 1.0 (http://www.w3.org/TR/esi-lang) - * - * * Edge Architecture Specification (http://www.w3.org/TR/edge-arch) - * - * @author Fabien Potencier - */ -class Esi -{ - private $contentTypes; - - /** - * Constructor. - * - * @param array $contentTypes An array of content-type that should be parsed for ESI information. - * (default: text/html, text/xml, and application/xml) - */ - public function __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xml')) - { - $this->contentTypes = $contentTypes; - } - - /** - * Returns a new cache strategy instance. - * - * @return EsiResponseCacheStrategyInterface A EsiResponseCacheStrategyInterface instance - */ - public function createCacheStrategy() - { - return new EsiResponseCacheStrategy(); - } - - /** - * Checks that at least one surrogate has ESI/1.0 capability. - * - * @param Request $request A Request instance - * - * @return Boolean true if one surrogate has ESI/1.0 capability, false otherwise - */ - public function hasSurrogateEsiCapability(Request $request) - { - if (null === $value = $request->headers->get('Surrogate-Capability')) { - return false; - } - - return false !== strpos($value, 'ESI/1.0'); - } - - /** - * Adds ESI/1.0 capability to the given Request. - * - * @param Request $request A Request instance - */ - public function addSurrogateEsiCapability(Request $request) - { - $current = $request->headers->get('Surrogate-Capability'); - $new = 'symfony2="ESI/1.0"'; - - $request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new); - } - - /** - * Adds HTTP headers to specify that the Response needs to be parsed for ESI. - * - * This method only adds an ESI HTTP header if the Response has some ESI tags. - * - * @param Response $response A Response instance - */ - public function addSurrogateControl(Response $response) - { - if (false !== strpos($response->getContent(), 'headers->set('Surrogate-Control', 'content="ESI/1.0"'); - } - } - - /** - * Checks that the Response needs to be parsed for ESI tags. - * - * @param Response $response A Response instance - * - * @return Boolean true if the Response needs to be parsed, false otherwise - */ - public function needsEsiParsing(Response $response) - { - if (!$control = $response->headers->get('Surrogate-Control')) { - return false; - } - - return (Boolean) preg_match('#content="[^"]*ESI/1.0[^"]*"#', $control); - } - - /** - * Renders an ESI tag. - * - * @param string $uri A URI - * @param string $alt An alternate URI - * @param Boolean $ignoreErrors Whether to ignore errors or not - * @param string $comment A comment to add as an esi:include tag - */ - public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = '') - { - $html = sprintf('', - $uri, - $ignoreErrors ? ' onerror="continue"' : '', - $alt ? sprintf(' alt="%s"', $alt) : '' - ); - - if (!empty($comment)) { - return sprintf("\n%s", $comment, $html); - } - - return $html; - } - - /** - * Replaces a Response ESI tags with the included resource content. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - */ - public function process(Request $request, Response $response) - { - $this->request = $request; - $type = $response->headers->get('Content-Type'); - if (empty($type)) { - $type = 'text/html'; - } - - $parts = explode(';', $type); - if (!in_array($parts[0], $this->contentTypes)) { - return $response; - } - - // we don't use a proper XML parser here as we can have ESI tags in a plain text response - $content = $response->getContent(); - $content = str_replace(array('', ''), $content); - $content = preg_replace_callback('##', array($this, 'handleEsiIncludeTag'), $content); - $content = preg_replace('#]*(?:/|#', '', $content); - $content = preg_replace('#.*?#', '', $content); - - $response->setContent($content); - $response->headers->set('X-Body-Eval', 'ESI'); - - // remove ESI/1.0 from the Surrogate-Control header - if ($response->headers->has('Surrogate-Control')) { - $value = $response->headers->get('Surrogate-Control'); - if ('content="ESI/1.0"' == $value) { - $response->headers->remove('Surrogate-Control'); - } elseif (preg_match('#,\s*content="ESI/1.0"#', $value)) { - $response->headers->set('Surrogate-Control', preg_replace('#,\s*content="ESI/1.0"#', '', $value)); - } elseif (preg_match('#content="ESI/1.0",\s*#', $value)) { - $response->headers->set('Surrogate-Control', preg_replace('#content="ESI/1.0",\s*#', '', $value)); - } - } - } - - /** - * Handles an ESI from the cache. - * - * @param HttpCache $cache An HttpCache instance - * @param string $uri The main URI - * @param string $alt An alternative URI - * @param Boolean $ignoreErrors Whether to ignore errors or not - */ - public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors) - { - $subRequest = Request::create($uri, 'get', array(), $cache->getRequest()->cookies->all(), array(), $cache->getRequest()->server->all()); - - try { - $response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true); - - if (!$response->isSuccessful()) { - throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $subRequest->getUri(), $response->getStatusCode())); - } - - return $response->getContent(); - } catch (\Exception $e) { - if ($alt) { - return $this->handle($cache, $alt, '', $ignoreErrors); - } - - if (!$ignoreErrors) { - throw $e; - } - } - } - - /** - * Handles an ESI include tag (called internally). - * - * @param array $attributes An array containing the attributes. - * - * @return string The response content for the include. - */ - private function handleEsiIncludeTag($attributes) - { - $options = array(); - preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $attributes[1], $matches, PREG_SET_ORDER); - foreach ($matches as $set) { - $options[$set[1]] = $set[2]; - } - - if (!isset($options['src'])) { - throw new \RuntimeException('Unable to process an ESI tag without a "src" attribute.'); - } - - return sprintf('esi->handle($this, \'%s\', \'%s\', %s) ?>'."\n", - $options['src'], - isset($options['alt']) ? $options['alt'] : null, - isset($options['onerror']) && 'continue' == $options['onerror'] ? 'true' : 'false' - ); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php b/core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php deleted file mode 100644 index c5ec810..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Response; - -/** - * EsiResponseCacheStrategy knows how to compute the Response cache HTTP header - * based on the different ESI response cache headers. - * - * This implementation changes the master response TTL to the smallest TTL received - * or force validation if one of the ESI has validation cache strategy. - * - * @author Fabien Potencier - */ -class EsiResponseCacheStrategy implements EsiResponseCacheStrategyInterface -{ - private $cacheable = true; - private $ttls = array(); - private $maxAges = array(); - - /** - * Adds a Response. - * - * @param Response $response - */ - public function add(Response $response) - { - if ($response->isValidateable()) { - $this->cacheable = false; - } else { - $this->ttls[] = $response->getTtl(); - $this->maxAges[] = $response->getMaxAge(); - } - } - - /** - * Updates the Response HTTP headers based on the embedded Responses. - * - * @param Response $response - */ - public function update(Response $response) - { - // if we only have one Response, do nothing - if (1 === count($this->ttls)) { - return; - } - - if (!$this->cacheable) { - $response->headers->set('Cache-Control', 'no-cache, must-revalidate'); - - return; - } - - if (null !== $maxAge = min($this->maxAges)) { - $response->setSharedMaxAge($maxAge); - $response->headers->set('Age', $maxAge - min($this->ttls)); - } - $response->setMaxAge(0); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php b/core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php deleted file mode 100644 index 7b1d387..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Response; - -/** - * EsiResponseCacheStrategyInterface implementations know how to compute the - * Response cache HTTP header based on the different ESI response cache headers. - * - * @author Fabien Potencier - */ -interface EsiResponseCacheStrategyInterface -{ - /** - * Adds a Response. - * - * @param Response $response - */ - function add(Response $response); - - /** - * Updates the Response HTTP headers based on the embedded Responses. - * - * @param Response $response - */ - function update(Response $response); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/core/vendor/Symfony/Component/HttpKernel/HttpCache/HttpCache.php deleted file mode 100644 index e0a3d12..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ /dev/null @@ -1,659 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\TerminableInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Cache provides HTTP caching. - * - * @author Fabien Potencier - * - * @api - */ -class HttpCache implements HttpKernelInterface, TerminableInterface -{ - private $kernel; - private $store; - private $request; - private $esi; - private $esiCacheStrategy; - private $traces; - - /** - * Constructor. - * - * The available options are: - * - * * debug: If true, the traces are added as a HTTP header to ease debugging - * - * * default_ttl The number of seconds that a cache entry should be considered - * fresh when no explicit freshness information is provided in - * a response. Explicit Cache-Control or Expires headers - * override this value. (default: 0) - * - * * private_headers Set of request headers that trigger "private" cache-control behavior - * on responses that don't explicitly state whether the response is - * public or private via a Cache-Control directive. (default: Authorization and Cookie) - * - * * allow_reload Specifies whether the client can force a cache reload by including a - * Cache-Control "no-cache" directive in the request. Set it to ``true`` - * for compliance with RFC 2616. (default: false) - * - * * allow_revalidate Specifies whether the client can force a cache revalidate by including - * a Cache-Control "max-age=0" directive in the request. Set it to ``true`` - * for compliance with RFC 2616. (default: false) - * - * * stale_while_revalidate Specifies the default number of seconds (the granularity is the second as the - * Response TTL precision is a second) during which the cache can immediately return - * a stale response while it revalidates it in the background (default: 2). - * This setting is overridden by the stale-while-revalidate HTTP Cache-Control - * extension (see RFC 5861). - * - * * stale_if_error Specifies the default number of seconds (the granularity is the second) during which - * the cache can serve a stale response when an error is encountered (default: 60). - * This setting is overridden by the stale-if-error HTTP Cache-Control extension - * (see RFC 5861). - * - * @param HttpKernelInterface $kernel An HttpKernelInterface instance - * @param StoreInterface $store A Store instance - * @param Esi $esi An Esi instance - * @param array $options An array of options - */ - public function __construct(HttpKernelInterface $kernel, StoreInterface $store, Esi $esi = null, array $options = array()) - { - $this->store = $store; - $this->kernel = $kernel; - - // needed in case there is a fatal error because the backend is too slow to respond - register_shutdown_function(array($this->store, 'cleanup')); - - $this->options = array_merge(array( - 'debug' => false, - 'default_ttl' => 0, - 'private_headers' => array('Authorization', 'Cookie'), - 'allow_reload' => false, - 'allow_revalidate' => false, - 'stale_while_revalidate' => 2, - 'stale_if_error' => 60, - ), $options); - $this->esi = $esi; - $this->traces = array(); - } - - /** - * Gets the current store. - * - * @return StoreInterface $store A StoreInterface instance - */ - public function getStore() - { - return $this->store; - } - - /** - * Returns an array of events that took place during processing of the last request. - * - * @return array An array of events - */ - public function getTraces() - { - return $this->traces; - } - - /** - * Returns a log message for the events of the last request processing. - * - * @return string A log message - */ - public function getLog() - { - $log = array(); - foreach ($this->traces as $request => $traces) { - $log[] = sprintf('%s: %s', $request, implode(', ', $traces)); - } - - return implode('; ', $log); - } - - /** - * Gets the Request instance associated with the master request. - * - * @return Symfony\Component\HttpFoundation\Request A Request instance - */ - public function getRequest() - { - return $this->request; - } - - /** - * Gets the Kernel instance - * - * @return Symfony\Component\HttpKernel\HttpKernelInterface An HttpKernelInterface instance - */ - public function getKernel() - { - return $this->kernel; - } - - - /** - * Gets the Esi instance - * - * @return Symfony\Component\HttpKernel\HttpCache\Esi An Esi instance - */ - public function getEsi() - { - return $this->esi; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism - if (HttpKernelInterface::MASTER_REQUEST === $type) { - $this->traces = array(); - $this->request = $request; - if (null !== $this->esi) { - $this->esiCacheStrategy = $this->esi->createCacheStrategy(); - } - } - - $path = $request->getPathInfo(); - if ($qs = $request->getQueryString()) { - $path .= '?'.$qs; - } - $this->traces[$request->getMethod().' '.$path] = array(); - - if (!$request->isMethodSafe()) { - $response = $this->invalidate($request, $catch); - } elseif ($request->headers->has('expect')) { - $response = $this->pass($request, $catch); - } else { - $response = $this->lookup($request, $catch); - } - - $response->isNotModified($request); - - $this->restoreResponseBody($request, $response); - - $response->setDate(new \DateTime(null, new \DateTimeZone('UTC'))); - - if (HttpKernelInterface::MASTER_REQUEST === $type && $this->options['debug']) { - $response->headers->set('X-Symfony-Cache', $this->getLog()); - } - - if (null !== $this->esi) { - $this->esiCacheStrategy->add($response); - - if (HttpKernelInterface::MASTER_REQUEST === $type) { - $this->esiCacheStrategy->update($response); - } - } - - $response->prepare($request); - - return $response; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function terminate(Request $request, Response $response) - { - if ($this->getKernel() instanceof TerminableInterface) { - $this->getKernel()->terminate($request, $response); - } - } - - /** - * Forwards the Request to the backend without storing the Response in the cache. - * - * @param Request $request A Request instance - * @param Boolean $catch Whether to process exceptions - * - * @return Response A Response instance - */ - protected function pass(Request $request, $catch = false) - { - $this->record($request, 'pass'); - - return $this->forward($request, $catch); - } - - /** - * Invalidates non-safe methods (like POST, PUT, and DELETE). - * - * @param Request $request A Request instance - * @param Boolean $catch Whether to process exceptions - * - * @return Response A Response instance - * - * @see RFC2616 13.10 - */ - protected function invalidate(Request $request, $catch = false) - { - $response = $this->pass($request, $catch); - - // invalidate only when the response is successful - if ($response->isSuccessful() || $response->isRedirect()) { - try { - $this->store->invalidate($request, $catch); - - $this->record($request, 'invalidate'); - } catch (\Exception $e) { - $this->record($request, 'invalidate-failed'); - - if ($this->options['debug']) { - throw $e; - } - } - } - - return $response; - } - - /** - * Lookups a Response from the cache for the given Request. - * - * When a matching cache entry is found and is fresh, it uses it as the - * response without forwarding any request to the backend. When a matching - * cache entry is found but is stale, it attempts to "validate" the entry with - * the backend using conditional GET. When no matching cache entry is found, - * it triggers "miss" processing. - * - * @param Request $request A Request instance - * @param Boolean $catch whether to process exceptions - * - * @return Response A Response instance - */ - protected function lookup(Request $request, $catch = false) - { - // if allow_reload and no-cache Cache-Control, allow a cache reload - if ($this->options['allow_reload'] && $request->isNoCache()) { - $this->record($request, 'reload'); - - return $this->fetch($request); - } - - try { - $entry = $this->store->lookup($request); - } catch (\Exception $e) { - $this->record($request, 'lookup-failed'); - - if ($this->options['debug']) { - throw $e; - } - - return $this->pass($request, $catch); - } - - if (null === $entry) { - $this->record($request, 'miss'); - - return $this->fetch($request, $catch); - } - - if (!$this->isFreshEnough($request, $entry)) { - $this->record($request, 'stale'); - - return $this->validate($request, $entry, $catch); - } - - $this->record($request, 'fresh'); - - $entry->headers->set('Age', $entry->getAge()); - - return $entry; - } - - /** - * Validates that a cache entry is fresh. - * - * The original request is used as a template for a conditional - * GET request with the backend. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance to validate - * @param Boolean $catch Whether to process exceptions - * - * @return Response A Response instance - */ - protected function validate(Request $request, Response $entry, $catch = false) - { - $subRequest = clone $request; - - // send no head requests because we want content - $subRequest->setMethod('GET'); - - // add our cached last-modified validator - $subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified')); - - // Add our cached etag validator to the environment. - // We keep the etags from the client to handle the case when the client - // has a different private valid entry which is not cached here. - $cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array(); - $requestEtags = $request->getEtags(); - if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) { - $subRequest->headers->set('if_none_match', implode(', ', $etags)); - } - - $response = $this->forward($subRequest, $catch, $entry); - - if (304 == $response->getStatusCode()) { - $this->record($request, 'valid'); - - // return the response and not the cache entry if the response is valid but not cached - $etag = $response->getEtag(); - if ($etag && in_array($etag, $requestEtags) && !in_array($etag, $cachedEtags)) { - return $response; - } - - $entry = clone $entry; - $entry->headers->remove('Date'); - - foreach (array('Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified') as $name) { - if ($response->headers->has($name)) { - $entry->headers->set($name, $response->headers->get($name)); - } - } - - $response = $entry; - } else { - $this->record($request, 'invalid'); - } - - if ($response->isCacheable()) { - $this->store($request, $response); - } - - return $response; - } - - /** - * Forwards the Request to the backend and determines whether the response should be stored. - * - * This methods is triggered when the cache missed or a reload is required. - * - * @param Request $request A Request instance - * @param Boolean $catch whether to process exceptions - * - * @return Response A Response instance - */ - protected function fetch(Request $request, $catch = false) - { - $subRequest = clone $request; - - // send no head requests because we want content - $subRequest->setMethod('GET'); - - // avoid that the backend sends no content - $subRequest->headers->remove('if_modified_since'); - $subRequest->headers->remove('if_none_match'); - - $response = $this->forward($subRequest, $catch); - - if ($this->isPrivateRequest($request) && !$response->headers->hasCacheControlDirective('public')) { - $response->setPrivate(true); - } elseif ($this->options['default_ttl'] > 0 && null === $response->getTtl() && !$response->headers->getCacheControlDirective('must-revalidate')) { - $response->setTtl($this->options['default_ttl']); - } - - if ($response->isCacheable()) { - $this->store($request, $response); - } - - return $response; - } - - /** - * Forwards the Request to the backend and returns the Response. - * - * @param Request $request A Request instance - * @param Boolean $catch Whether to catch exceptions or not - * @param Response $entry A Response instance (the stale entry if present, null otherwise) - * - * @return Response A Response instance - */ - protected function forward(Request $request, $catch = false, Response $entry = null) - { - if ($this->esi) { - $this->esi->addSurrogateEsiCapability($request); - } - - // always a "master" request (as the real master request can be in cache) - $response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch); - // FIXME: we probably need to also catch exceptions if raw === true - - // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC - if (null !== $entry && in_array($response->getStatusCode(), array(500, 502, 503, 504))) { - if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) { - $age = $this->options['stale_if_error']; - } - - if (abs($entry->getTtl()) < $age) { - $this->record($request, 'stale-if-error'); - - return $entry; - } - } - - $this->processResponseBody($request, $response); - - return $response; - } - - /** - * Checks whether the cache entry is "fresh enough" to satisfy the Request. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * - * @return Boolean true if the cache entry if fresh enough, false otherwise - */ - protected function isFreshEnough(Request $request, Response $entry) - { - if (!$entry->isFresh()) { - return $this->lock($request, $entry); - } - - if ($this->options['allow_revalidate'] && null !== $maxAge = $request->headers->getCacheControlDirective('max-age')) { - return $maxAge > 0 && $maxAge >= $entry->getAge(); - } - - return true; - } - - /** - * Locks a Request during the call to the backend. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * - * @return Boolean true if the cache entry can be returned even if it is staled, false otherwise - */ - protected function lock(Request $request, Response $entry) - { - // try to acquire a lock to call the backend - $lock = $this->store->lock($request, $entry); - - // there is already another process calling the backend - if (true !== $lock) { - // check if we can serve the stale entry - if (null === $age = $entry->headers->getCacheControlDirective('stale-while-revalidate')) { - $age = $this->options['stale_while_revalidate']; - } - - if (abs($entry->getTtl()) < $age) { - $this->record($request, 'stale-while-revalidate'); - - // server the stale response while there is a revalidation - return true; - } - - // wait for the lock to be released - $wait = 0; - while (is_file($lock) && $wait < 5000000) { - usleep($wait += 50000); - } - - if ($wait < 2000000) { - // replace the current entry with the fresh one - $new = $this->lookup($request); - $entry->headers = $new->headers; - $entry->setContent($new->getContent()); - $entry->setStatusCode($new->getStatusCode()); - $entry->setProtocolVersion($new->getProtocolVersion()); - foreach ($new->headers->getCookies() as $cookie) { - $entry->headers->setCookie($cookie); - } - } else { - // backend is slow as hell, send a 503 response (to avoid the dog pile effect) - $entry->setStatusCode(503); - $entry->setContent('503 Service Unavailable'); - $entry->headers->set('Retry-After', 10); - } - - return true; - } - - // we have the lock, call the backend - return false; - } - - /** - * Writes the Response to the cache. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - */ - protected function store(Request $request, Response $response) - { - try { - $this->store->write($request, $response); - - $this->record($request, 'store'); - - $response->headers->set('Age', $response->getAge()); - } catch (\Exception $e) { - $this->record($request, 'store-failed'); - - if ($this->options['debug']) { - throw $e; - } - } - - // now that the response is cached, release the lock - $this->store->unlock($request); - } - - /** - * Restores the Response body. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return Response A Response instance - */ - private function restoreResponseBody(Request $request, Response $response) - { - if ('HEAD' === $request->getMethod() || 304 === $response->getStatusCode()) { - $response->setContent(''); - $response->headers->remove('X-Body-Eval'); - $response->headers->remove('X-Body-File'); - - return; - } - - if ($response->headers->has('X-Body-Eval')) { - ob_start(); - - if ($response->headers->has('X-Body-File')) { - include $response->headers->get('X-Body-File'); - } else { - eval('; ?>'.$response->getContent().'setContent(ob_get_clean()); - $response->headers->remove('X-Body-Eval'); - if (!$response->headers->has('Transfer-Encoding')) { - $response->headers->set('Content-Length', strlen($response->getContent())); - } - } elseif ($response->headers->has('X-Body-File')) { - $response->setContent(file_get_contents($response->headers->get('X-Body-File'))); - } else { - return; - } - - $response->headers->remove('X-Body-File'); - } - - protected function processResponseBody(Request $request, Response $response) - { - if (null !== $this->esi && $this->esi->needsEsiParsing($response)) { - $this->esi->process($request, $response); - } - } - - /** - * Checks if the Request includes authorization or other sensitive information - * that should cause the Response to be considered private by default. - * - * @param Request $request A Request instance - * - * @return Boolean true if the Request is private, false otherwise - */ - private function isPrivateRequest(Request $request) - { - foreach ($this->options['private_headers'] as $key) { - $key = strtolower(str_replace('HTTP_', '', $key)); - - if ('cookie' === $key) { - if (count($request->cookies->all())) { - return true; - } - } elseif ($request->headers->has($key)) { - return true; - } - } - - return false; - } - - /** - * Records that an event took place. - * - * @param Request $request A Request instance - * @param string $event The event name - */ - private function record(Request $request, $event) - { - $path = $request->getPathInfo(); - if ($qs = $request->getQueryString()) { - $path .= '?'.$qs; - } - $this->traces[$request->getMethod().' '.$path][] = $event; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/Store.php b/core/vendor/Symfony/Component/HttpKernel/HttpCache/Store.php deleted file mode 100644 index 6818bd3..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/HttpCache/Store.php +++ /dev/null @@ -1,403 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Store implements all the logic for storing cache metadata (Request and Response headers). - * - * @author Fabien Potencier - */ -class Store implements StoreInterface -{ - private $root; - private $keyCache; - private $locks; - - /** - * Constructor. - * - * @param string $root The path to the cache directory - */ - public function __construct($root) - { - $this->root = $root; - if (!is_dir($this->root)) { - mkdir($this->root, 0777, true); - } - $this->keyCache = new \SplObjectStorage(); - $this->locks = array(); - } - - /** - * Cleanups storage. - */ - public function cleanup() - { - // unlock everything - foreach ($this->locks as $lock) { - @unlink($lock); - } - - $error = error_get_last(); - if (1 === $error['type'] && false === headers_sent()) { - // send a 503 - header('HTTP/1.0 503 Service Unavailable'); - header('Retry-After: 10'); - echo '503 Service Unavailable'; - } - } - - /** - * Locks the cache for a given Request. - * - * @param Request $request A Request instance - * - * @return Boolean|string true if the lock is acquired, the path to the current lock otherwise - */ - public function lock(Request $request) - { - if (false !== $lock = @fopen($path = $this->getPath($this->getCacheKey($request).'.lck'), 'x')) { - fclose($lock); - - $this->locks[] = $path; - - return true; - } - - return $path; - } - - /** - * Releases the lock for the given Request. - * - * @param Request $request A Request instance - */ - public function unlock(Request $request) - { - return @unlink($this->getPath($this->getCacheKey($request).'.lck')); - } - - /** - * Locates a cached Response for the Request provided. - * - * @param Request $request A Request instance - * - * @return Response|null A Response instance, or null if no cache entry was found - */ - public function lookup(Request $request) - { - $key = $this->getCacheKey($request); - - if (!$entries = $this->getMetadata($key)) { - return null; - } - - // find a cached entry that matches the request. - $match = null; - foreach ($entries as $entry) { - if ($this->requestsMatch(isset($entry[1]['vary']) ? $entry[1]['vary'][0] : '', $request->headers->all(), $entry[0])) { - $match = $entry; - - break; - } - } - - if (null === $match) { - return null; - } - - list($req, $headers) = $match; - if (is_file($body = $this->getPath($headers['x-content-digest'][0]))) { - return $this->restoreResponse($headers, $body); - } - - // TODO the metaStore referenced an entity that doesn't exist in - // the entityStore. We definitely want to return nil but we should - // also purge the entry from the meta-store when this is detected. - return null; - } - - /** - * Writes a cache entry to the store for the given Request and Response. - * - * Existing entries are read and any that match the response are removed. This - * method calls write with the new list of cache entries. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return string The key under which the response is stored - */ - public function write(Request $request, Response $response) - { - $key = $this->getCacheKey($request); - $storedEnv = $this->persistRequest($request); - - // write the response body to the entity store if this is the original response - if (!$response->headers->has('X-Content-Digest')) { - $digest = 'en'.sha1($response->getContent()); - - if (false === $this->save($digest, $response->getContent())) { - throw new \RuntimeException('Unable to store the entity.'); - } - - $response->headers->set('X-Content-Digest', $digest); - - if (!$response->headers->has('Transfer-Encoding')) { - $response->headers->set('Content-Length', strlen($response->getContent())); - } - } - - // read existing cache entries, remove non-varying, and add this one to the list - $entries = array(); - $vary = $response->headers->get('vary'); - foreach ($this->getMetadata($key) as $entry) { - if (!isset($entry[1]['vary'])) { - $entry[1]['vary'] = array(''); - } - - if ($vary != $entry[1]['vary'][0] || !$this->requestsMatch($vary, $entry[0], $storedEnv)) { - $entries[] = $entry; - } - } - - $headers = $this->persistResponse($response); - unset($headers['age']); - - array_unshift($entries, array($storedEnv, $headers)); - - if (false === $this->save($key, serialize($entries))) { - throw new \RuntimeException('Unable to store the metadata.'); - } - - return $key; - } - - /** - * Invalidates all cache entries that match the request. - * - * @param Request $request A Request instance - */ - public function invalidate(Request $request) - { - $modified = false; - $key = $this->getCacheKey($request); - - $entries = array(); - foreach ($this->getMetadata($key) as $entry) { - $response = $this->restoreResponse($entry[1]); - if ($response->isFresh()) { - $response->expire(); - $modified = true; - $entries[] = array($entry[0], $this->persistResponse($response)); - } else { - $entries[] = $entry; - } - } - - if ($modified) { - if (false === $this->save($key, serialize($entries))) { - throw new \RuntimeException('Unable to store the metadata.'); - } - } - - // As per the RFC, invalidate Location and Content-Location URLs if present - foreach (array('Location', 'Content-Location') as $header) { - if ($uri = $request->headers->get($header)) { - $subRequest = Request::create($uri, 'get', array(), array(), array(), $request->server->all()); - - $this->invalidate($subRequest); - } - } - } - - /** - * Determines whether two Request HTTP header sets are non-varying based on - * the vary response header value provided. - * - * @param string $vary A Response vary header - * @param array $env1 A Request HTTP header array - * @param array $env2 A Request HTTP header array - * - * @return Boolean true if the the two environments match, false otherwise - */ - private function requestsMatch($vary, $env1, $env2) - { - if (empty($vary)) { - return true; - } - - foreach (preg_split('/[\s,]+/', $vary) as $header) { - $key = strtr(strtolower($header), '_', '-'); - $v1 = isset($env1[$key]) ? $env1[$key] : null; - $v2 = isset($env2[$key]) ? $env2[$key] : null; - if ($v1 !== $v2) { - return false; - } - } - - return true; - } - - /** - * Gets all data associated with the given key. - * - * Use this method only if you know what you are doing. - * - * @param string $key The store key - * - * @return array An array of data associated with the key - */ - private function getMetadata($key) - { - if (false === $entries = $this->load($key)) { - return array(); - } - - return unserialize($entries); - } - - /** - * Purges data for the given URL. - * - * @param string $url A URL - * - * @return Boolean true if the URL exists and has been purged, false otherwise - */ - public function purge($url) - { - if (is_file($path = $this->getPath($this->getCacheKey(Request::create($url))))) { - unlink($path); - - return true; - } - - return false; - } - - /** - * Loads data for the given key. - * - * @param string $key The store key - * - * @return string The data associated with the key - */ - private function load($key) - { - $path = $this->getPath($key); - - return is_file($path) ? file_get_contents($path) : false; - } - - /** - * Save data for the given key. - * - * @param string $key The store key - * @param string $data The data to store - */ - private function save($key, $data) - { - $path = $this->getPath($key); - if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) { - return false; - } - - $tmpFile = tempnam(dirname($path), basename($path)); - if (false === $fp = @fopen($tmpFile, 'wb')) { - return false; - } - @fwrite($fp, $data); - @fclose($fp); - - if ($data != file_get_contents($tmpFile)) { - return false; - } - - if (false === @rename($tmpFile, $path)) { - return false; - } - - chmod($path, 0644); - } - - public function getPath($key) - { - return $this->root.DIRECTORY_SEPARATOR.substr($key, 0, 2).DIRECTORY_SEPARATOR.substr($key, 2, 2).DIRECTORY_SEPARATOR.substr($key, 4, 2).DIRECTORY_SEPARATOR.substr($key, 6); - } - - /** - * Returns a cache key for the given Request. - * - * @param Request $request A Request instance - * - * @return string A key for the given Request - */ - private function getCacheKey(Request $request) - { - if (isset($this->keyCache[$request])) { - return $this->keyCache[$request]; - } - - return $this->keyCache[$request] = 'md'.sha1($request->getUri()); - } - - /** - * Persists the Request HTTP headers. - * - * @param Request $request A Request instance - * - * @return array An array of HTTP headers - */ - private function persistRequest(Request $request) - { - return $request->headers->all(); - } - - /** - * Persists the Response HTTP headers. - * - * @param Response $response A Response instance - * - * @return array An array of HTTP headers - */ - private function persistResponse(Response $response) - { - $headers = $response->headers->all(); - $headers['X-Status'] = array($response->getStatusCode()); - - return $headers; - } - - /** - * Restores a Response from the HTTP headers and body. - * - * @param array $headers An array of HTTP headers for the Response - * @param string $body The Response body - */ - private function restoreResponse($headers, $body = null) - { - $status = $headers['X-Status'][0]; - unset($headers['X-Status']); - - if (null !== $body) { - $headers['X-Body-File'] = array($body); - } - - return new Response($body, $status, $headers); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php b/core/vendor/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php deleted file mode 100644 index 58f8a8c..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Interface implemented by HTTP cache stores. - * - * @author Fabien Potencier - */ -interface StoreInterface -{ - /** - * Locates a cached Response for the Request provided. - * - * @param Request $request A Request instance - * - * @return Response|null A Response instance, or null if no cache entry was found - */ - function lookup(Request $request); - - /** - * Writes a cache entry to the store for the given Request and Response. - * - * Existing entries are read and any that match the response are removed. This - * method calls write with the new list of cache entries. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return string The key under which the response is stored - */ - function write(Request $request, Response $response); - - /** - * Invalidates all cache entries that match the request. - * - * @param Request $request A Request instance - */ - function invalidate(Request $request); - - /** - * Locks the cache for a given Request. - * - * @param Request $request A Request instance - * - * @return Boolean|string true if the lock is acquired, the path to the current lock otherwise - */ - function lock(Request $request); - - /** - * Releases the lock for the given Request. - * - * @param Request $request A Request instance - */ - function unlock(Request $request); - - /** - * Purges data for the given URL. - * - * @param string $url A URL - * - * @return Boolean true if the URL exists and has been purged, false otherwise - */ - function purge($url); - - /** - * Cleanups storage. - */ - function cleanup(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpKernel.php b/core/vendor/Symfony/Component/HttpKernel/HttpKernel.php deleted file mode 100644 index 3327f4f..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/HttpKernel.php +++ /dev/null @@ -1,231 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * HttpKernel notifies events to convert a Request object to a Response one. - * - * @author Fabien Potencier - * - * @api - */ -class HttpKernel implements HttpKernelInterface, TerminableInterface -{ - private $dispatcher; - private $resolver; - - /** - * Constructor - * - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param ControllerResolverInterface $resolver A ControllerResolverInterface instance - * - * @api - */ - public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver) - { - $this->dispatcher = $dispatcher; - $this->resolver = $resolver; - } - - /** - * Handles a Request to convert it to a Response. - * - * When $catch is true, the implementation must catch all exceptions - * and do its best to convert them to a Response instance. - * - * @param Request $request A Request instance - * @param integer $type The type of the request - * (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * @param Boolean $catch Whether to catch exceptions or not - * - * @return Response A Response instance - * - * @throws \Exception When an Exception occurs during processing - * - * @api - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - try { - return $this->handleRaw($request, $type); - } catch (\Exception $e) { - if (false === $catch) { - throw $e; - } - - return $this->handleException($e, $request, $type); - } - } - - /** - * {@inheritdoc} - * - * @api - */ - public function terminate(Request $request, Response $response) - { - $this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response)); - } - - /** - * Handles a request to convert it to a response. - * - * Exceptions are not caught. - * - * @param Request $request A Request instance - * @param integer $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * - * @return Response A Response instance - * - * @throws \LogicException If one of the listener does not behave as expected - * @throws NotFoundHttpException When controller cannot be found - */ - private function handleRaw(Request $request, $type = self::MASTER_REQUEST) - { - // request - $event = new GetResponseEvent($this, $request, $type); - $this->dispatcher->dispatch(KernelEvents::REQUEST, $event); - - if ($event->hasResponse()) { - return $this->filterResponse($event->getResponse(), $request, $type); - } - - // load controller - if (false === $controller = $this->resolver->getController($request)) { - throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". Maybe you forgot to add the matching route in your routing configuration?', $request->getPathInfo())); - } - - $event = new FilterControllerEvent($this, $controller, $request, $type); - $this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event); - $controller = $event->getController(); - - // controller arguments - $arguments = $this->resolver->getArguments($request, $controller); - - // call controller - $response = call_user_func_array($controller, $arguments); - - // view - if (!$response instanceof Response) { - $event = new GetResponseForControllerResultEvent($this, $request, $type, $response); - $this->dispatcher->dispatch(KernelEvents::VIEW, $event); - - if ($event->hasResponse()) { - $response = $event->getResponse(); - } - - if (!$response instanceof Response) { - $msg = sprintf('The controller must return a response (%s given).', $this->varToString($response)); - - // the user may have forgotten to return something - if (null === $response) { - $msg .= ' Did you forget to add a return statement somewhere in your controller?'; - } - throw new \LogicException($msg); - } - } - - return $this->filterResponse($response, $request, $type); - } - - /** - * Filters a response object. - * - * @param Response $response A Response instance - * @param Request $request A error message in case the response is not a Response object - * @param integer $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * - * @return Response The filtered Response instance - * - * @throws \RuntimeException if the passed object is not a Response instance - */ - private function filterResponse(Response $response, Request $request, $type) - { - $event = new FilterResponseEvent($this, $request, $type, $response); - - $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - return $event->getResponse(); - } - - /** - * Handles and exception by trying to convert it to a Response. - * - * @param \Exception $e An \Exception instance - * @param Request $request A Request instance - * @param integer $type The type of the request - * - * @return Response A Response instance - */ - private function handleException(\Exception $e, $request, $type) - { - $event = new GetResponseForExceptionEvent($this, $request, $type, $e); - $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); - - if (!$event->hasResponse()) { - throw $e; - } - - try { - return $this->filterResponse($event->getResponse(), $request, $type); - } catch (\Exception $e) { - return $event->getResponse(); - } - } - - private function varToString($var) - { - if (is_object($var)) { - return sprintf('Object(%s)', get_class($var)); - } - - if (is_array($var)) { - $a = array(); - foreach ($var as $k => $v) { - $a[] = sprintf('%s => %s', $k, $this->varToString($v)); - } - - return sprintf("Array(%s)", implode(', ', $a)); - } - - if (is_resource($var)) { - return sprintf('Resource(%s)', get_resource_type($var)); - } - - if (null === $var) { - return 'null'; - } - - if (false === $var) { - return 'false'; - } - - if (true === $var) { - return 'true'; - } - - return (string) $var; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpKernelInterface.php b/core/vendor/Symfony/Component/HttpKernel/HttpKernelInterface.php deleted file mode 100644 index a2a0f1c..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/HttpKernelInterface.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\HttpKernel; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * HttpKernelInterface handles a Request to convert it to a Response. - * - * @author Fabien Potencier - * - * @api - */ -interface HttpKernelInterface -{ - const MASTER_REQUEST = 1; - const SUB_REQUEST = 2; - - /** - * Handles a Request to convert it to a Response. - * - * When $catch is true, the implementation must catch all exceptions - * and do its best to convert them to a Response instance. - * - * @param Request $request A Request instance - * @param integer $type The type of the request - * (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * @param Boolean $catch Whether to catch exceptions or not - * - * @return Response A Response instance - * - * @throws \Exception When an Exception occurs during processing - * - * @api - */ - function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Kernel.php b/core/vendor/Symfony/Component/HttpKernel/Kernel.php deleted file mode 100644 index 05f895f..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Kernel.php +++ /dev/null @@ -1,756 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Dumper\PhpDumper; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\DependencyInjection\Loader\ClosureLoader; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\HttpKernel\Config\FileLocator; -use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; -use Symfony\Component\HttpKernel\DependencyInjection\AddClassesToCachePass; -use Symfony\Component\HttpKernel\DependencyInjection\Extension as DIExtension; -use Symfony\Component\HttpKernel\Debug\ErrorHandler; -use Symfony\Component\HttpKernel\Debug\ExceptionHandler; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\Loader\DelegatingLoader; -use Symfony\Component\Config\ConfigCache; -use Symfony\Component\ClassLoader\ClassCollectionLoader; -use Symfony\Component\ClassLoader\DebugUniversalClassLoader; - -/** - * The Kernel is the heart of the Symfony system. - * - * It manages an environment made of bundles. - * - * @author Fabien Potencier - * - * @api - */ -abstract class Kernel implements KernelInterface, TerminableInterface -{ - protected $bundles; - protected $bundleMap; - protected $container; - protected $rootDir; - protected $environment; - protected $debug; - protected $booted; - protected $name; - protected $startTime; - protected $classes; - - const VERSION = '2.1.0-DEV'; - - /** - * Constructor. - * - * @param string $environment The environment - * @param Boolean $debug Whether to enable debugging or not - * - * @api - */ - public function __construct($environment, $debug) - { - $this->environment = $environment; - $this->debug = (Boolean) $debug; - $this->booted = false; - $this->rootDir = $this->getRootDir(); - $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); - $this->classes = array(); - - if ($this->debug) { - $this->startTime = microtime(true); - } - - $this->init(); - } - - public function init() - { - if ($this->debug) { - ini_set('display_errors', 1); - error_reporting(-1); - - DebugUniversalClassLoader::enable(); - ErrorHandler::register(); - if ('cli' !== php_sapi_name()) { - ExceptionHandler::register(); - } - } else { - ini_set('display_errors', 0); - } - } - - public function __clone() - { - if ($this->debug) { - $this->startTime = microtime(true); - } - - $this->booted = false; - $this->container = null; - } - - /** - * Boots the current kernel. - * - * @api - */ - public function boot() - { - if (true === $this->booted) { - return; - } - - // init bundles - $this->initializeBundles(); - - // init container - $this->initializeContainer(); - - foreach ($this->getBundles() as $bundle) { - $bundle->setContainer($this->container); - $bundle->boot(); - } - - $this->booted = true; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function terminate(Request $request, Response $response) - { - if (false === $this->booted) { - return; - } - - if ($this->getHttpKernel() instanceof TerminableInterface) { - $this->getHttpKernel()->terminate($request, $response); - } - } - - /** - * Shutdowns the kernel. - * - * This method is mainly useful when doing functional testing. - * - * @api - */ - public function shutdown() - { - if (false === $this->booted) { - return; - } - - $this->booted = false; - - foreach ($this->getBundles() as $bundle) { - $bundle->shutdown(); - $bundle->setContainer(null); - } - - $this->container = null; - } - - /** - * {@inheritdoc} - * - * @api - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - if (false === $this->booted) { - $this->boot(); - } - - return $this->getHttpKernel()->handle($request, $type, $catch); - } - - /** - * Gets a http kernel from the container - * - * @return HttpKernel - */ - protected function getHttpKernel() - { - return $this->container->get('http_kernel'); - } - - /** - * Gets the registered bundle instances. - * - * @return array An array of registered bundle instances - * - * @api - */ - public function getBundles() - { - return $this->bundles; - } - - /** - * Checks if a given class name belongs to an active bundle. - * - * @param string $class A class name - * - * @return Boolean true if the class belongs to an active bundle, false otherwise - * - * @api - */ - public function isClassInActiveBundle($class) - { - foreach ($this->getBundles() as $bundle) { - if (0 === strpos($class, $bundle->getNamespace())) { - return true; - } - } - - return false; - } - - /** - * Returns a bundle and optionally its descendants by its name. - * - * @param string $name Bundle name - * @param Boolean $first Whether to return the first bundle only or together with its descendants - * - * @return BundleInterface|Array A BundleInterface instance or an array of BundleInterface instances if $first is false - * - * @throws \InvalidArgumentException when the bundle is not enabled - * - * @api - */ - public function getBundle($name, $first = true) - { - if (!isset($this->bundleMap[$name])) { - throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() function of your %s.php file?', $name, get_class($this))); - } - - if (true === $first) { - return $this->bundleMap[$name][0]; - } - - return $this->bundleMap[$name]; - } - - /** - * Returns the file path for a given resource. - * - * A Resource can be a file or a directory. - * - * The resource name must follow the following pattern: - * - * @/path/to/a/file.something - * - * where BundleName is the name of the bundle - * and the remaining part is the relative path in the bundle. - * - * If $dir is passed, and the first segment of the path is "Resources", - * this method will look for a file named: - * - * $dir//path/without/Resources - * - * before looking in the bundle resource folder. - * - * @param string $name A resource name to locate - * @param string $dir A directory where to look for the resource first - * @param Boolean $first Whether to return the first path or paths for all matching bundles - * - * @return string|array The absolute path of the resource or an array if $first is false - * - * @throws \InvalidArgumentException if the file cannot be found or the name is not valid - * @throws \RuntimeException if the name contains invalid/unsafe - * @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle - * - * @api - */ - public function locateResource($name, $dir = null, $first = true) - { - if ('@' !== $name[0]) { - throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); - } - - if (false !== strpos($name, '..')) { - throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name)); - } - - $bundleName = substr($name, 1); - $path = ''; - if (false !== strpos($bundleName, '/')) { - list($bundleName, $path) = explode('/', $bundleName, 2); - } - - $isResource = 0 === strpos($path, 'Resources') && null !== $dir; - $overridePath = substr($path, 9); - $resourceBundle = null; - $bundles = $this->getBundle($bundleName, false); - $files = array(); - - foreach ($bundles as $bundle) { - if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { - if (null !== $resourceBundle) { - throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', - $file, - $resourceBundle, - $dir.'/'.$bundles[0]->getName().$overridePath - )); - } - - if ($first) { - return $file; - } - $files[] = $file; - } - - if (file_exists($file = $bundle->getPath().'/'.$path)) { - if ($first && !$isResource) { - return $file; - } - $files[] = $file; - $resourceBundle = $bundle->getName(); - } - } - - if (count($files) > 0) { - return $first && $isResource ? $files[0] : $files; - } - - throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name)); - } - - /** - * Gets the name of the kernel - * - * @return string The kernel name - * - * @api - */ - public function getName() - { - return $this->name; - } - - /** - * Gets the environment. - * - * @return string The current environment - * - * @api - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Checks if debug mode is enabled. - * - * @return Boolean true if debug mode is enabled, false otherwise - * - * @api - */ - public function isDebug() - { - return $this->debug; - } - - /** - * Gets the application root dir. - * - * @return string The application root dir - * - * @api - */ - public function getRootDir() - { - if (null === $this->rootDir) { - $r = new \ReflectionObject($this); - $this->rootDir = dirname($r->getFileName()); - } - - return $this->rootDir; - } - - /** - * Gets the current container. - * - * @return ContainerInterface A ContainerInterface instance - * - * @api - */ - public function getContainer() - { - return $this->container; - } - - /** - * Loads the PHP class cache. - * - * @param string $name The cache name prefix - * @param string $extension File extension of the resulting file - */ - public function loadClassCache($name = 'classes', $extension = '.php') - { - if (!$this->booted && is_file($this->getCacheDir().'/classes.map')) { - ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension); - } - } - - /** - * Used internally. - */ - public function setClassCache(array $classes) - { - file_put_contents($this->getCacheDir().'/classes.map', sprintf('debug ? $this->startTime : -INF; - } - - /** - * Gets the cache directory. - * - * @return string The cache directory - * - * @api - */ - public function getCacheDir() - { - return $this->rootDir.'/cache/'.$this->environment; - } - - /** - * Gets the log directory. - * - * @return string The log directory - * - * @api - */ - public function getLogDir() - { - return $this->rootDir.'/logs'; - } - - /** - * Initializes the data structures related to the bundle management. - * - * - the bundles property maps a bundle name to the bundle instance, - * - the bundleMap property maps a bundle name to the bundle inheritance hierarchy (most derived bundle first). - * - * @throws \LogicException if two bundles share a common name - * @throws \LogicException if a bundle tries to extend a non-registered bundle - * @throws \LogicException if a bundle tries to extend itself - * @throws \LogicException if two bundles extend the same ancestor - */ - protected function initializeBundles() - { - // init bundles - $this->bundles = array(); - $topMostBundles = array(); - $directChildren = array(); - - foreach ($this->registerBundles() as $bundle) { - $name = $bundle->getName(); - if (isset($this->bundles[$name])) { - throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name)); - } - $this->bundles[$name] = $bundle; - - if ($parentName = $bundle->getParent()) { - if (isset($directChildren[$parentName])) { - throw new \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName])); - } - if ($parentName == $name) { - throw new \LogicException(sprintf('Bundle "%s" can not extend itself.', $name)); - } - $directChildren[$parentName] = $name; - } else { - $topMostBundles[$name] = $bundle; - } - } - - // look for orphans - if (count($diff = array_values(array_diff(array_keys($directChildren), array_keys($this->bundles))))) { - throw new \LogicException(sprintf('Bundle "%s" extends bundle "%s", which is not registered.', $directChildren[$diff[0]], $diff[0])); - } - - // inheritance - $this->bundleMap = array(); - foreach ($topMostBundles as $name => $bundle) { - $bundleMap = array($bundle); - $hierarchy = array($name); - - while (isset($directChildren[$name])) { - $name = $directChildren[$name]; - array_unshift($bundleMap, $this->bundles[$name]); - $hierarchy[] = $name; - } - - foreach ($hierarchy as $bundle) { - $this->bundleMap[$bundle] = $bundleMap; - array_pop($bundleMap); - } - } - - } - - /** - * Gets the container class. - * - * @return string The container class - */ - protected function getContainerClass() - { - return $this->name.ucfirst($this->environment).($this->debug ? 'Debug' : '').'ProjectContainer'; - } - - /** - * Gets the container's base class. - * - * All names except Container must be fully qualified. - * - * @return string - */ - protected function getContainerBaseClass() - { - return 'Container'; - } - - /** - * Initializes the service container. - * - * The cached version of the service container is used when fresh, otherwise the - * container is built. - */ - protected function initializeContainer() - { - $class = $this->getContainerClass(); - $cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); - $fresh = true; - if (!$cache->isFresh()) { - $container = $this->buildContainer(); - $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); - - $fresh = false; - } - - require_once $cache; - - $this->container = new $class(); - $this->container->set('kernel', $this); - - if (!$fresh && $this->container->has('cache_warmer')) { - $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir')); - } - } - - /** - * Returns the kernel parameters. - * - * @return array An array of kernel parameters - */ - protected function getKernelParameters() - { - $bundles = array(); - foreach ($this->bundles as $name => $bundle) { - $bundles[$name] = get_class($bundle); - } - - return array_merge( - array( - 'kernel.root_dir' => $this->rootDir, - 'kernel.environment' => $this->environment, - 'kernel.debug' => $this->debug, - 'kernel.name' => $this->name, - 'kernel.cache_dir' => $this->getCacheDir(), - 'kernel.logs_dir' => $this->getLogDir(), - 'kernel.bundles' => $bundles, - 'kernel.charset' => 'UTF-8', - 'kernel.container_class' => $this->getContainerClass(), - ), - $this->getEnvParameters() - ); - } - - /** - * Gets the environment parameters. - * - * Only the parameters starting with "SYMFONY__" are considered. - * - * @return array An array of parameters - */ - protected function getEnvParameters() - { - $parameters = array(); - foreach ($_SERVER as $key => $value) { - if (0 === strpos($key, 'SYMFONY__')) { - $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; - } - } - - return $parameters; - } - - /** - * Builds the service container. - * - * @return ContainerBuilder The compiled service container - */ - protected function buildContainer() - { - foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) { - throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); - } - } elseif (!is_writable($dir)) { - throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); - } - } - - $container = new ContainerBuilder(new ParameterBag($this->getKernelParameters())); - $extensions = array(); - foreach ($this->bundles as $bundle) { - if ($extension = $bundle->getContainerExtension()) { - $container->registerExtension($extension); - $extensions[] = $extension->getAlias(); - } - - if ($this->debug) { - $container->addObjectResource($bundle); - } - } - foreach ($this->bundles as $bundle) { - $bundle->build($container); - } - - $container->addObjectResource($this); - - // ensure these extensions are implicitly loaded - $container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions)); - - if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) { - $container->merge($cont); - } - - $container->addCompilerPass(new AddClassesToCachePass($this)); - $container->compile(); - - return $container; - } - - /** - * Dumps the service container to PHP code in the cache. - * - * @param ConfigCache $cache The config cache - * @param ContainerBuilder $container The service container - * @param string $class The name of the class to generate - * @param string $baseClass The name of the container's base class - */ - protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass) - { - // cache the container - $dumper = new PhpDumper($container); - $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass)); - if (!$this->debug) { - $content = self::stripComments($content); - } - - $cache->write($content, $container->getResources()); - } - - /** - * Returns a loader for the container. - * - * @param ContainerInterface $container The service container - * - * @return DelegatingLoader The loader - */ - protected function getContainerLoader(ContainerInterface $container) - { - $locator = new FileLocator($this); - $resolver = new LoaderResolver(array( - new XmlFileLoader($container, $locator), - new YamlFileLoader($container, $locator), - new IniFileLoader($container, $locator), - new PhpFileLoader($container, $locator), - new ClosureLoader($container), - )); - - return new DelegatingLoader($resolver); - } - - /** - * Removes comments from a PHP source string. - * - * We don't use the PHP php_strip_whitespace() function - * as we want the content to be readable and well-formatted. - * - * @param string $source A PHP string - * - * @return string The PHP string with the comments removed - */ - static public function stripComments($source) - { - if (!function_exists('token_get_all')) { - return $source; - } - - $output = ''; - foreach (token_get_all($source) as $token) { - if (is_string($token)) { - $output .= $token; - } elseif (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { - $output .= $token[1]; - } - } - - // replace multiple new lines with a single newline - $output = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $output); - - return $output; - } - - public function serialize() - { - return serialize(array($this->environment, $this->debug)); - } - - public function unserialize($data) - { - list($environment, $debug) = unserialize($data); - - $this->__construct($environment, $debug); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/KernelEvents.php b/core/vendor/Symfony/Component/HttpKernel/KernelEvents.php deleted file mode 100644 index 1594d3e..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/KernelEvents.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -/** - * Contains all events thrown in the HttpKernel component - * - * @author Bernhard Schussek - * - * @api - */ -final class KernelEvents -{ - /** - * The REQUEST event occurs at the very beginning of request - * dispatching - * - * This event allows you to create a response for a request before any - * other code in the framework is executed. The event listener method - * receives a Symfony\Component\HttpKernel\Event\GetResponseEvent - * instance. - * - * @var string - * - * @api - */ - const REQUEST = 'kernel.request'; - - /** - * The EXCEPTION event occurs when an uncaught exception appears - * - * This event allows you to create a response for a thrown exception or - * to modify the thrown exception. The event listener method receives - * a Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent - * instance. - * - * @var string - * - * @api - */ - const EXCEPTION = 'kernel.exception'; - - /** - * The VIEW event occurs when the return value of a controller - * is not a Response instance - * - * This event allows you to create a response for the return value of the - * controller. The event listener method receives a - * Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent - * instance. - * - * @var string - * - * @api - */ - const VIEW = 'kernel.view'; - - /** - * The CONTROLLER event occurs once a controller was found for - * handling a request - * - * This event allows you to change the controller that will handle the - * request. The event listener method receives a - * Symfony\Component\HttpKernel\Event\FilterControllerEvent instance. - * - * @var string - * - * @api - */ - const CONTROLLER = 'kernel.controller'; - - /** - * The RESPONSE event occurs once a response was created for - * replying to a request - * - * This event allows you to modify or replace the response that will be - * replied. The event listener method receives a - * Symfony\Component\HttpKernel\Event\FilterResponseEvent instance. - * - * @var string - * - * @api - */ - const RESPONSE = 'kernel.response'; - - /** - * The TERMINATE event occurs once a reponse was sent - * - * This event allows you to run expensive post-response jobs. - * The event listener method receives a - * Symfony\Component\HttpKernel\Event\PostResponseEvent instance. - * - * @var string - */ - const TERMINATE = 'kernel.terminate'; -} diff --git a/core/vendor/Symfony/Component/HttpKernel/KernelInterface.php b/core/vendor/Symfony/Component/HttpKernel/KernelInterface.php deleted file mode 100644 index 4fb0abc..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/KernelInterface.php +++ /dev/null @@ -1,199 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\Config\Loader\LoaderInterface; - -/** - * The Kernel is the heart of the Symfony system. - * - * It manages an environment made of bundles. - * - * @author Fabien Potencier - * - * @api - */ -interface KernelInterface extends HttpKernelInterface, \Serializable -{ - /** - * Returns an array of bundles to registers. - * - * @return array An array of bundle instances. - * - * @api - */ - function registerBundles(); - - /** - * Loads the container configuration - * - * @param LoaderInterface $loader A LoaderInterface instance - * - * @api - */ - function registerContainerConfiguration(LoaderInterface $loader); - - /** - * Boots the current kernel. - * - * @api - */ - function boot(); - - /** - * Shutdowns the kernel. - * - * This method is mainly useful when doing functional testing. - * - * @api - */ - function shutdown(); - - /** - * Gets the registered bundle instances. - * - * @return array An array of registered bundle instances - * - * @api - */ - function getBundles(); - - /** - * Checks if a given class name belongs to an active bundle. - * - * @param string $class A class name - * - * @return Boolean true if the class belongs to an active bundle, false otherwise - * - * @api - */ - function isClassInActiveBundle($class); - - /** - * Returns a bundle and optionally its descendants by its name. - * - * @param string $name Bundle name - * @param Boolean $first Whether to return the first bundle only or together with its descendants - * - * @return BundleInterface|Array A BundleInterface instance or an array of BundleInterface instances if $first is false - * - * @throws \InvalidArgumentException when the bundle is not enabled - * - * @api - */ - function getBundle($name, $first = true); - - /** - * Returns the file path for a given resource. - * - * A Resource can be a file or a directory. - * - * The resource name must follow the following pattern: - * - * @BundleName/path/to/a/file.something - * - * where BundleName is the name of the bundle - * and the remaining part is the relative path in the bundle. - * - * If $dir is passed, and the first segment of the path is Resources, - * this method will look for a file named: - * - * $dir/BundleName/path/without/Resources - * - * @param string $name A resource name to locate - * @param string $dir A directory where to look for the resource first - * @param Boolean $first Whether to return the first path or paths for all matching bundles - * - * @return string|array The absolute path of the resource or an array if $first is false - * - * @throws \InvalidArgumentException if the file cannot be found or the name is not valid - * @throws \RuntimeException if the name contains invalid/unsafe characters - * - * @api - */ - function locateResource($name, $dir = null, $first = true); - - /** - * Gets the name of the kernel - * - * @return string The kernel name - * - * @api - */ - function getName(); - - /** - * Gets the environment. - * - * @return string The current environment - * - * @api - */ - function getEnvironment(); - - /** - * Checks if debug mode is enabled. - * - * @return Boolean true if debug mode is enabled, false otherwise - * - * @api - */ - function isDebug(); - - /** - * Gets the application root dir. - * - * @return string The application root dir - * - * @api - */ - function getRootDir(); - - /** - * Gets the current container. - * - * @return ContainerInterface A ContainerInterface instance - * - * @api - */ - function getContainer(); - - /** - * Gets the request start time (not available if debug is disabled). - * - * @return integer The request start timestamp - * - * @api - */ - function getStartTime(); - - /** - * Gets the cache directory. - * - * @return string The cache directory - * - * @api - */ - function getCacheDir(); - - /** - * Gets the log directory. - * - * @return string The log directory - * - * @api - */ - function getLogDir(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/LICENSE b/core/vendor/Symfony/Component/HttpKernel/LICENSE deleted file mode 100644 index 89df448..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2011 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/core/vendor/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php b/core/vendor/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php deleted file mode 100644 index 65bb25a..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.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\HttpKernel\Log; - -/** - * DebugLoggerInterface. - * - * @author Fabien Potencier - */ -interface DebugLoggerInterface -{ - /** - * Returns an array of logs. - * - * A log is an array with the following mandatory keys: - * timestamp, message, priority, and priorityName. - * It can also have an optional context key containing an array. - * - * @return array An array of logs - */ - function getLogs(); - - /** - * Returns the number of errors. - * - * @return integer The number of errors - */ - function countErrors(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Log/LoggerInterface.php b/core/vendor/Symfony/Component/HttpKernel/Log/LoggerInterface.php deleted file mode 100644 index 97fe65b..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Log/LoggerInterface.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Log; - -/** - * LoggerInterface. - * - * @author Fabien Potencier - * - * @api - */ -interface LoggerInterface -{ - /** - * @api - */ - function emerg($message, array $context = array()); - - /** - * @api - */ - function alert($message, array $context = array()); - - /** - * @api - */ - function crit($message, array $context = array()); - - /** - * @api - */ - function err($message, array $context = array()); - - /** - * @api - */ - function warn($message, array $context = array()); - - /** - * @api - */ - function notice($message, array $context = array()); - - /** - * @api - */ - function info($message, array $context = array()); - - /** - * @api - */ - function debug($message, array $context = array()); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Log/NullLogger.php b/core/vendor/Symfony/Component/HttpKernel/Log/NullLogger.php deleted file mode 100644 index 8edec89..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Log/NullLogger.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Log; - -use Symfony\Component\HttpKernel\Log\LoggerInterface; - -/** - * NullLogger. - * - * @author Fabien Potencier - * - * @api - */ -class NullLogger implements LoggerInterface -{ - /** - * @api - */ - public function emerg($message, array $context = array()) - { - } - - /** - * @api - */ - public function alert($message, array $context = array()) - { - } - - /** - * @api - */ - public function crit($message, array $context = array()) - { - } - - /** - * @api - */ - public function err($message, array $context = array()) - { - } - - /** - * @api - */ - public function warn($message, array $context = array()) - { - } - - /** - * @api - */ - public function notice($message, array $context = array()) - { - } - - /** - * @api - */ - public function info($message, array $context = array()) - { - } - - /** - * @api - */ - public function debug($message, array $context = array()) - { - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/core/vendor/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php deleted file mode 100644 index 588806b..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ /dev/null @@ -1,264 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * Storage for profiler using files. - * - * @author Alexandre Salomé - */ -class FileProfilerStorage implements ProfilerStorageInterface -{ - /** - * Folder where profiler data are stored. - * - * @var string - */ - private $folder; - - /** - * Constructs the file storage using a "dsn-like" path. - * - * Example : "file:/path/to/the/storage/folder" - * - * @param string $dsn The DSN - */ - public function __construct($dsn) - { - if (0 !== strpos($dsn, 'file:')) { - throw new \InvalidArgumentException("FileStorage DSN must start with file:"); - } - $this->folder = substr($dsn, 5); - - if (!is_dir($this->folder)) { - mkdir($this->folder); - } - } - - /** - * {@inheritdoc} - */ - public function find($ip, $url, $limit, $method) - { - $file = $this->getIndexFilename(); - - if (!file_exists($file)) { - return array(); - } - - $file = fopen($file, 'r'); - fseek($file, 0, SEEK_END); - - $result = array(); - - while ($limit > 0) { - $line = $this->readLineFromFile($file); - - if (false === $line) { - break; - } - - if ($line === '') { - continue; - } - - list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent) = str_getcsv($line); - - if ($ip && false === strpos($csvIp, $ip) || $url && false === strpos($csvUrl, $url) || $method && false === strpos($csvMethod, $method)) { - continue; - } - - $result[$csvToken] = array( - 'token' => $csvToken, - 'ip' => $csvIp, - 'method' => $csvMethod, - 'url' => $csvUrl, - 'time' => $csvTime, - 'parent' => $csvParent, - ); - --$limit; - } - - fclose($file); - - return array_values($result); - } - - /** - * {@inheritdoc} - */ - public function purge() - { - $flags = \FilesystemIterator::SKIP_DOTS; - $iterator = new \RecursiveDirectoryIterator($this->folder, $flags); - $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST); - - foreach ($iterator as $file) { - if (is_file($file)) { - unlink($file); - } else { - rmdir($file); - } - } - } - - /** - * {@inheritdoc} - */ - public function read($token) - { - if (!$token || !file_exists($file = $this->getFilename($token))) { - return null; - } - - return $this->createProfileFromData($token, unserialize(file_get_contents($file))); - } - - /** - * {@inheritdoc} - */ - public function write(Profile $profile) - { - $file = $this->getFilename($profile->getToken()); - - // Create directory - $dir = dirname($file); - if (!is_dir($dir)) { - mkdir($dir, 0777, true); - } - - // Store profile - $data = array( - 'token' => $profile->getToken(), - 'parent' => $profile->getParentToken(), - 'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()), - 'data' => $profile->getCollectors(), - 'ip' => $profile->getIp(), - 'method' => $profile->getMethod(), - 'url' => $profile->getUrl(), - 'time' => $profile->getTime(), - ); - - if (false === file_put_contents($file, serialize($data))) { - return false; - } - - // Add to index - if (false === $file = fopen($this->getIndexFilename(), 'a')) { - return false; - } - - fputcsv($file, array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - )); - fclose($file); - - return true; - } - - /** - * Gets filename to store data, associated to the token. - * - * @return string The profile filename - */ - protected function getFilename($token) - { - // Uses 4 last characters, because first are mostly the same. - $folderA = substr($token, -2, 2); - $folderB = substr($token, -4, 2); - - return $this->folder.'/'.$folderA.'/'.$folderB.'/'.$token; - } - - /** - * Gets the index filename. - * - * @return string The index filename - */ - protected function getIndexFilename() - { - return $this->folder.'/index.csv'; - } - - /** - * Reads a line in the file, ending with the current position. - * - * This function automatically skips the empty lines and do not include the line return in result value. - * - * @param resource $file The file resource, with the pointer placed at the end of the line to read - * - * @return mixed A string representating the line or FALSE if beginning of file is reached - */ - protected function readLineFromFile($file) - { - if (ftell($file) === 0) { - return false; - } - - fseek($file, -1, SEEK_CUR); - $str = ''; - - while (true) { - $char = fgetc($file); - - if ($char === "\n") { - // Leave the file with cursor before the line return - fseek($file, -1, SEEK_CUR); - break; - } - - $str = $char.$str; - - if (ftell($file) === 1) { - // All file is read, so we move cursor to the position 0 - fseek($file, -1, SEEK_CUR); - break; - } - - fseek($file, -2, SEEK_CUR); - } - - return $str === '' ? $this->readLineFromFile($file) : $str; - } - - protected function createProfileFromData($token, $data, $parent = null) - { - $profile = new Profile($token); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors($data['data']); - - if (!$parent && $data['parent']) { - $parent = $this->read($data['parent']); - } - - if ($parent) { - $profile->setParent($parent); - } - - foreach ($data['children'] as $token) { - if (!$token || !file_exists($file = $this->getFilename($token))) { - continue; - } - - $profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile)); - } - - return $profile; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php b/core/vendor/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php deleted file mode 100644 index ba03aa3..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php +++ /dev/null @@ -1,227 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -class MongoDbProfilerStorage implements ProfilerStorageInterface -{ - protected $dsn; - protected $lifetime; - private $mongo; - - /** - * Constructor. - * - * @param string $dsn A data source name - * @param string $username Not used - * @param string $password Not used - * @param integer $lifetime The lifetime to use for the purge - */ - public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) - { - $this->dsn = $dsn; - $this->lifetime = (int) $lifetime; - } - - /** - * Finds profiler tokens for the given criteria. - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * - * @return array An array of tokens - */ - public function find($ip, $url, $limit, $method) - { - $cursor = $this->getMongo()->find($this->buildQuery($ip, $url, $method), array('_id', 'parent', 'ip', 'method', 'url', 'time'))->sort(array('time' => -1))->limit($limit); - - $tokens = array(); - foreach ($cursor as $profile) { - $tokens[] = $this->getData($profile); - } - - return $tokens; - } - - /** - * Purges all data from the database. - */ - public function purge() - { - $this->getMongo()->remove(array()); - } - - /** - * Reads data associated with the given token. - * - * The method returns false if the token does not exists in the storage. - * - * @param string $token A token - * - * @return Profile The profile associated with token - */ - public function read($token) - { - $profile = $this->getMongo()->findOne(array('_id' => $token, 'data' => array('$exists' => true))); - - if (null !== $profile) { - $profile = $this->createProfileFromData($this->getData($profile)); - } - - return $profile; - } - - /** - * Saves a Profile. - * - * @param Profile $profile A Profile instance - * - * @return Boolean Write operation successful - */ - public function write(Profile $profile) - { - $this->cleanup(); - - $record = array( - '_id' => $profile->getToken(), - 'parent' => $profile->getParentToken(), - 'data' => serialize($profile->getCollectors()), - 'ip' => $profile->getIp(), - 'method' => $profile->getMethod(), - 'url' => $profile->getUrl(), - 'time' => $profile->getTime() - ); - - return $this->getMongo()->insert(array_filter($record, function ($v) { return !empty($v); })); - } - - /** - * Internal convenience method that returns the instance of the MongoDB Collection - * - * @return \MongoCollection - */ - protected function getMongo() - { - if ($this->mongo === null) { - if (preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $this->dsn, $matches)) { - $mongo = new \Mongo($matches[1]); - $database = $matches[2]; - $collection = $matches[3]; - $this->mongo = $mongo->selectCollection($database, $collection); - } else { - throw new \RuntimeException('Please check your configuration. You are trying to use MongoDB with an invalid dsn. "'.$this->dsn.'"'); - } - } - - return $this->mongo; - } - - /** - * @param array $data - * @return Profile - */ - protected function createProfileFromData(array $data) - { - $profile = $this->getProfile($data); - - if ($data['parent']) { - $parent = $this->getMongo()->findOne(array('_id' => $data['parent'], 'data' => array('$exists' => true))); - if ($parent) { - $profile->setParent($this->getProfile($this->getData($parent))); - } - } - - $profile->setChildren($this->readChildren($data['token'])); - - return $profile; - } - - /** - * @param string $token - * @return array - */ - protected function readChildren($token) - { - $profiles = array(); - - $cursor = $this->getMongo()->find(array('parent' => $token, 'data' => array('$exists' => true))); - foreach ($cursor as $d) { - $profiles[] = $this->getProfile($this->getData($d)); - } - - return $profiles; - } - - protected function cleanup() - { - $this->getMongo()->remove(array('time' => array('$lt' => time() - $this->lifetime))); - } - - /** - * @param string $ip - * @param string $url - * @param string $method - * @return array - */ - private function buildQuery($ip, $url, $method) - { - $query = array(); - - if (!empty($ip)) { - $query['ip'] = $ip; - } - - if (!empty($url)) { - $query['url'] = $url; - } - - if (!empty($method)) { - $query['method'] = $method; - } - - return $query; - } - - /** - * @param array $data - * @return array - */ - private function getData(array $data) - { - return array( - 'token' => $data['_id'], - 'parent' => isset($data['parent']) ? $data['parent'] : null, - 'ip' => isset($data['ip']) ? $data['ip'] : null, - 'method' => isset($data['method']) ? $data['method'] : null, - 'url' => isset($data['url']) ? $data['url'] : null, - 'time' => isset($data['time']) ? $data['time'] : null, - 'data' => isset($data['data']) ? $data['data'] : null, - ); - } - - /** - * @param array $data - * @return Profile - */ - private function getProfile(array $data) - { - $profile = new Profile($data['token']); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors(unserialize($data['data'])); - - return $profile; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php b/core/vendor/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php deleted file mode 100644 index 8530a2b..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * A ProfilerStorage for Mysql - * - * @author Jan Schumann - */ -class MysqlProfilerStorage extends PdoProfilerStorage -{ - /** - * {@inheritdoc} - */ - protected function initDb() - { - if (null === $this->db) { - if (0 !== strpos($this->dsn, 'mysql')) { - throw new \RuntimeException('Please check your configuration. You are trying to use Mysql with a wrong dsn. "'.$this->dsn.'"'); - } - - if (!class_exists('PDO') || !in_array('mysql', \PDO::getAvailableDrivers(), true)) { - throw new \RuntimeException('You need to enable PDO_Mysql extension for the profiler to run properly.'); - } - - $db = new \PDO($this->dsn, $this->username, $this->password); - $db->exec('CREATE TABLE IF NOT EXISTS sf_profiler_data (token VARCHAR(255) PRIMARY KEY, data LONGTEXT, ip VARCHAR(64), method VARCHAR(6), url VARCHAR(255), time INTEGER UNSIGNED, parent VARCHAR(255), created_at INTEGER UNSIGNED, KEY (created_at), KEY (ip), KEY (method), KEY (url), KEY (parent))'); - - $this->db = $db; - } - - return $this->db; - } - - /** - * {@inheritdoc} - */ - protected function buildCriteria($ip, $url, $limit, $method) - { - $criteria = array(); - $args = array(); - - if ($ip = preg_replace('/[^\d\.]/', '', $ip)) { - $criteria[] = 'ip LIKE :ip'; - $args[':ip'] = '%'.$ip.'%'; - } - - if ($url) { - $criteria[] = 'url LIKE :url'; - $args[':url'] = '%'.addcslashes($url, '%_\\').'%'; - } - - if ($method) { - $criteria[] = 'method = :method'; - $args[':method'] = $method; - } - - return array($criteria, $args); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php b/core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php deleted file mode 100644 index c87b871..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php +++ /dev/null @@ -1,245 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - - -/** - * Base PDO storage for profiling information in a PDO database. - * - * @author Fabien Potencier - * @author Jan Schumann - */ -abstract class PdoProfilerStorage implements ProfilerStorageInterface -{ - protected $dsn; - protected $username; - protected $password; - protected $lifetime; - protected $db; - - /** - * Constructor. - * - * @param string $dsn A data source name - * @param string $username The username for the database - * @param string $password The password for the database - * @param integer $lifetime The lifetime to use for the purge - */ - public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) - { - $this->dsn = $dsn; - $this->username = $username; - $this->password = $password; - $this->lifetime = (int) $lifetime; - } - - /** - * {@inheritdoc} - */ - public function find($ip, $url, $limit, $method) - { - list($criteria, $args) = $this->buildCriteria($ip, $url, $limit, $method); - - $criteria = $criteria ? 'WHERE '.implode(' AND ', $criteria) : ''; - - $db = $this->initDb(); - $tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent FROM sf_profiler_data '.$criteria.' ORDER BY time DESC LIMIT '.((integer) $limit), $args); - $this->close($db); - - return $tokens; - } - - /** - * {@inheritdoc} - */ - public function read($token) - { - $db = $this->initDb(); - $args = array(':token' => $token); - $data = $this->fetch($db, 'SELECT data, parent, ip, method, url, time FROM sf_profiler_data WHERE token = :token LIMIT 1', $args); - $this->close($db); - if (isset($data[0]['data'])) { - return $this->createProfileFromData($token, $data[0]); - } - - return null; - } - - /** - * {@inheritdoc} - */ - public function write(Profile $profile) - { - $db = $this->initDb(); - $args = array( - ':token' => $profile->getToken(), - ':parent' => $profile->getParentToken(), - ':data' => base64_encode(serialize($profile->getCollectors())), - ':ip' => $profile->getIp(), - ':method' => $profile->getMethod(), - ':url' => $profile->getUrl(), - ':time' => $profile->getTime(), - ':created_at' => time(), - ); - - if ($this->read($profile->getToken())) { - try { - $this->exec($db, 'UPDATE sf_profiler_data SET parent = :parent, data = :data, ip = :ip, method = :method, url = :url, time = :time, created_at = :created_at WHERE token = :token', $args); - $this->cleanup(); - $status = true; - } catch (\Exception $e) { - $status = false; - } - } else { - try { - $this->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, method, url, time, created_at) VALUES (:token, :parent, :data, :ip, :method, :url, :time, :created_at)', $args); - $this->cleanup(); - $status = true; - } catch (\Exception $e) { - $status = false; - } - } - - $this->close($db); - - return $status; - } - - /** - * {@inheritdoc} - */ - public function purge() - { - $db = $this->initDb(); - $this->exec($db, 'DELETE FROM sf_profiler_data'); - $this->close($db); - } - - /** - * Build SQL criteria to fetch records by ip and url - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * - * @return array An array with (criteria, args) - */ - abstract protected function buildCriteria($ip, $url, $limit, $method); - - /** - * Initializes the database - * - * @throws \RuntimeException When the requested database driver is not installed - */ - abstract protected function initDb(); - - protected function cleanup() - { - $db = $this->initDb(); - $this->exec($db, 'DELETE FROM sf_profiler_data WHERE created_at < :time', array(':time' => time() - $this->lifetime)); - $this->close($db); - } - - protected function exec($db, $query, array $args = array()) - { - $stmt = $this->prepareStatement($db, $query); - - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); - } - $success = $stmt->execute(); - if (!$success) { - throw new \RuntimeException(sprintf('Error executing query "%s"', $query)); - } - } - - protected function prepareStatement($db, $query) - { - try { - $stmt = $db->prepare($query); - } catch (\Exception $e) { - $stmt = false; - } - - if (false === $stmt) { - throw new \RuntimeException('The database cannot successfully prepare the statement'); - } - - return $stmt; - } - - protected function fetch($db, $query, array $args = array()) - { - $stmt = $this->prepareStatement($db, $query); - - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); - } - $stmt->execute(); - $return = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - return $return; - } - - protected function close($db) - { - } - - protected function createProfileFromData($token, $data, $parent = null) - { - $profile = new Profile($token); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors(unserialize(base64_decode($data['data']))); - - if (!$parent && !empty($data['parent'])) { - $parent = $this->read($data['parent']); - } - - if ($parent) { - $profile->setParent($parent); - } - - $profile->setChildren($this->readChildren($token, $profile)); - - return $profile; - } - - /** - * Reads the child profiles for the given token. - * - * @param string $token The parent token - * @param string $parent The parent instance - * - * @return array An array of Profile instance - */ - protected function readChildren($token, $parent) - { - $db = $this->initDb(); - $data = $this->fetch($db, 'SELECT token, data, ip, method, url, time FROM sf_profiler_data WHERE parent = :token', array(':token' => $token)); - $this->close($db); - - if (!$data) { - return array(); - } - - $profiles = array(); - foreach ($data as $d) { - $profiles[] = $this->createProfileFromData($d['token'], $d, $parent); - } - - return $profiles; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/Profile.php b/core/vendor/Symfony/Component/HttpKernel/Profiler/Profile.php deleted file mode 100644 index bed24f1..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/Profile.php +++ /dev/null @@ -1,219 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; - -/** - * Profile. - * - * @author Fabien Potencier - */ -class Profile -{ - private $token; - private $collectors; - private $ip; - private $method; - private $url; - private $time; - private $parent; - private $children; - - /** - * Constructor. - * - * @param string $token The token - */ - public function __construct($token) - { - $this->token = $token; - $this->collectors = array(); - $this->children = array(); - } - - /** - * Sets the token. - * - * @param string $token The token - */ - public function setToken($token) - { - $this->token = $token; - } - - /** - * Gets the token. - * - * @return string The token - */ - public function getToken() - { - return $this->token; - } - - /** - * Sets the parent token - * - * @param Profile $parent The parent Profile - */ - public function setParent(Profile $parent) - { - $this->parent = $parent; - } - - /** - * Returns the parent profile. - * - * @return Profile The parent profile - */ - public function getParent() - { - return $this->parent; - } - - /** - * Returns the parent token. - * - * @return null|string The parent token - */ - public function getParentToken() - { - return $this->parent ? $this->parent->getToken() : null; - } - - /** - * Returns the IP. - * - * @return string The IP - */ - public function getIp() - { - return $this->ip; - } - - public function setIp($ip) - { - $this->ip = $ip; - } - - /** - * Returns the request method. - * - * @return string The request method - */ - public function getMethod() - { - return $this->method; - } - - public function setMethod($method) - { - $this->method = $method; - } - - /** - * Returns the URL. - * - * @return string The URL - */ - public function getUrl() - { - return $this->url; - } - - public function setUrl($url) - { - $this->url = $url; - } - - /** - * Returns the time. - * - * @return string The time - */ - public function getTime() - { - return $this->time; - } - - public function setTime($time) - { - $this->time = $time; - } - - /** - * Finds children profilers. - * - * @return array An array of Profile - */ - public function getChildren() - { - return $this->children; - } - - public function setChildren(array $children) - { - $this->children = array(); - foreach ($children as $child) { - $this->addChild($child); - } - } - - /** - * Adds the child token - * - * @param Profile $child The child Profile - */ - public function addChild(Profile $child) - { - $this->children[] = $child; - $child->setParent($this); - } - - public function getCollector($name) - { - if (!isset($this->collectors[$name])) { - throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name)); - } - - return $this->collectors[$name]; - } - - public function getCollectors() - { - return $this->collectors; - } - - public function setCollectors(array $collectors) - { - $this->collectors = array(); - foreach ($collectors as $collector) { - $this->addCollector($collector); - } - } - - public function addCollector(DataCollectorInterface $collector) - { - $this->collectors[$collector->getName()] = $collector; - } - - public function hasCollector($name) - { - return isset($this->collectors[$name]); - } - - public function __sleep() - { - return array('token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time'); - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/Profiler.php b/core/vendor/Symfony/Component/HttpKernel/Profiler/Profiler.php deleted file mode 100644 index 966111c..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/Profiler.php +++ /dev/null @@ -1,248 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface; -use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; -use Symfony\Component\HttpKernel\Log\LoggerInterface; - -/** - * Profiler. - * - * @author Fabien Potencier - */ -class Profiler -{ - private $storage; - private $collectors; - private $logger; - private $enabled; - - /** - * Constructor. - * - * @param ProfilerStorageInterface $storage A ProfilerStorageInterface instance - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null) - { - $this->storage = $storage; - $this->logger = $logger; - $this->collectors = array(); - $this->enabled = true; - } - - /** - * Disables the profiler. - */ - public function disable() - { - $this->enabled = false; - } - - /** - * Loads the Profile for the given Response. - * - * @param Response $response A Response instance - * - * @return Profile A Profile instance - */ - public function loadProfileFromResponse(Response $response) - { - if (!$token = $response->headers->get('X-Debug-Token')) { - return false; - } - - return $this->loadProfile($token); - } - - /** - * Loads the Profile for the given token. - * - * @param string $token A token - * - * @return Profile A Profile instance - */ - public function loadProfile($token) - { - return $this->storage->read($token); - } - - /** - * Saves a Profile. - * - * @param Profile $profile A Profile instance - * - * @return Boolean - */ - public function saveProfile(Profile $profile) - { - if (!($ret = $this->storage->write($profile)) && null !== $this->logger) { - $this->logger->warn('Unable to store the profiler information.'); - } - - return $ret; - } - - /** - * Purges all data from the storage. - */ - public function purge() - { - $this->storage->purge(); - } - - /** - * Exports the current profiler data. - * - * @param Profile $profile A Profile instance - * - * @return string The exported data - */ - public function export(Profile $profile) - { - return base64_encode(serialize($profile)); - } - - /** - * Imports data into the profiler storage. - * - * @param string $data A data string as exported by the export() method - * - * @return Profile A Profile instance - */ - public function import($data) - { - $profile = unserialize(base64_decode($data)); - - if ($this->storage->read($profile->getToken())) { - return false; - } - - $this->saveProfile($profile); - - return $profile; - } - - /** - * Finds profiler tokens for the given criteria. - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * - * @return array An array of tokens - */ - public function find($ip, $url, $limit, $method) - { - return $this->storage->find($ip, $url, $limit, $method); - } - - /** - * Collects data for the given Response. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An exception instance if the request threw one - * - * @return Profile|false A Profile instance or false if the profiler is disabled - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (false === $this->enabled) { - return; - } - - $profile = new Profile(uniqid()); - $profile->setTime(time()); - $profile->setUrl($request->getUri()); - $profile->setIp($request->server->get('REMOTE_ADDR')); - $profile->setMethod($request->getMethod()); - - $response->headers->set('X-Debug-Token', $profile->getToken()); - - foreach ($this->collectors as $collector) { - $collector->collect($request, $response, $exception); - - // forces collectors to become "read/only" (they loose their object dependencies) - $profile->addCollector(unserialize(serialize($collector))); - } - - return $profile; - } - - /** - * Gets the Collectors associated with this profiler. - * - * @return array An array of collectors - */ - public function all() - { - return $this->collectors; - } - - /** - * Sets the Collectors associated with this profiler. - * - * @param array $collectors An array of collectors - */ - public function set(array $collectors = array()) - { - $this->collectors = array(); - foreach ($collectors as $collector) { - $this->add($collector); - } - } - - /** - * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance - */ - public function add(DataCollectorInterface $collector) - { - $this->collectors[$collector->getName()] = $collector; - } - - /** - * Returns true if a Collector for the given name exists. - * - * @param string $name A collector name - * - * @return Boolean - */ - public function has($name) - { - return isset($this->collectors[$name]); - } - - /** - * Gets a Collector by name. - * - * @param string $name A collector name - * - * @return DataCollectorInterface A DataCollectorInterface instance - * - * @throws \InvalidArgumentException if the collector does not exist - */ - public function get($name) - { - if (!isset($this->collectors[$name])) { - throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name)); - } - - return $this->collectors[$name]; - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php b/core/vendor/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php deleted file mode 100644 index db608ea..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * ProfilerStorageInterface. - * - * @author Fabien Potencier - */ -interface ProfilerStorageInterface -{ - /** - * Finds profiler tokens for the given criteria. - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * - * @return array An array of tokens - */ - function find($ip, $url, $limit, $method); - - /** - * Reads data associated with the given token. - * - * The method returns false if the token does not exists in the storage. - * - * @param string $token A token - * - * @return Profile The profile associated with token - */ - function read($token); - - /** - * Saves a Profile. - * - * @param Profile $profile A Profile instance - * - * @return Boolean Write operation successful - */ - function write(Profile $profile); - - /** - * Purges all data from the database. - */ - function purge(); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php b/core/vendor/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php deleted file mode 100644 index 638d0cb..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - - -/** - * SqliteProfilerStorage stores profiling information in a SQLite database. - * - * @author Fabien Potencier - */ -class SqliteProfilerStorage extends PdoProfilerStorage -{ - /** - * @throws \RuntimeException When neither of SQLite3 or PDO_SQLite extension is enabled - */ - protected function initDb() - { - if (null === $this->db || $this->db instanceof \SQLite3) { - if (0 !== strpos($this->dsn, 'sqlite')) { - throw new \RuntimeException('You are trying to use Sqlite with a wrong dsn. "'.$this->dsn.'"'); - } - if (class_exists('SQLite3')) { - $db = new \SQLite3(substr($this->dsn, 7, strlen($this->dsn)), \SQLITE3_OPEN_READWRITE | \SQLITE3_OPEN_CREATE); - if (method_exists($db, 'busyTimeout')) { - // busyTimeout only exists for PHP >= 5.3.3 - $db->busyTimeout(1000); - } - } elseif (class_exists('PDO') && in_array('sqlite', \PDO::getAvailableDrivers(), true)) { - $db = new \PDO($this->dsn); - } else { - throw new \RuntimeException('You need to enable either the SQLite3 or PDO_SQLite extension for the profiler to run properly.'); - } - - $db->exec('PRAGMA temp_store=MEMORY; PRAGMA journal_mode=MEMORY;'); - $db->exec('CREATE TABLE IF NOT EXISTS sf_profiler_data (token STRING, data STRING, ip STRING, method STRING, url STRING, time INTEGER, parent STRING, created_at INTEGER)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_created_at ON sf_profiler_data (created_at)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_ip ON sf_profiler_data (ip)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_method ON sf_profiler_data (method)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_url ON sf_profiler_data (url)'); - $db->exec('CREATE INDEX IF NOT EXISTS data_parent ON sf_profiler_data (parent)'); - $db->exec('CREATE UNIQUE INDEX IF NOT EXISTS data_token ON sf_profiler_data (token)'); - - $this->db = $db; - } - - return $this->db; - } - - protected function exec($db, $query, array $args = array()) - { - if ($db instanceof \SQLite3) { - $stmt = $this->prepareStatement($db, $query); - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT); - } - - $res = $stmt->execute(); - if (false === $res) { - throw new \RuntimeException(sprintf('Error executing SQLite query "%s"', $query)); - } - $res->finalize(); - } else { - parent::exec($db, $query, $args); - } - } - - protected function fetch($db, $query, array $args = array()) - { - $return = array(); - - if ($db instanceof \SQLite3) { - $stmt = $this->prepareStatement($db, $query, true); - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT); - } - $res = $stmt->execute(); - while ($row = $res->fetchArray(\SQLITE3_ASSOC)) { - $return[] = $row; - } - $res->finalize(); - $stmt->close(); - } else { - $return = parent::fetch($db, $query, $args); - } - - return $return; - } - - /** - * {@inheritdoc} - */ - protected function buildCriteria($ip, $url, $limit, $method) - { - $criteria = array(); - $args = array(); - - if ($ip = preg_replace('/[^\d\.]/', '', $ip)) { - $criteria[] = 'ip LIKE :ip'; - $args[':ip'] = '%'.$ip.'%'; - } - - if ($url) { - $criteria[] = 'url LIKE :url ESCAPE "\"'; - $args[':url'] = '%'.addcslashes($url, '%_\\').'%'; - } - - if ($method) { - $criteria[] = 'method = :method'; - $args[':method'] = $method; - } - - return array($criteria, $args); - } - - protected function close($db) - { - if ($db instanceof \SQLite3) { - $db->close(); - } - } -} diff --git a/core/vendor/Symfony/Component/HttpKernel/README.md b/core/vendor/Symfony/Component/HttpKernel/README.md deleted file mode 100644 index 64b1944..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/README.md +++ /dev/null @@ -1,87 +0,0 @@ -HttpKernel Component -==================== - -HttpKernel provides the building blocks to create flexible and fast HTTP-based -frameworks. - -``HttpKernelInterface`` is the core interface of the Symfony2 full-stack -framework: - - interface HttpKernelInterface - { - /** - * Handles a Request to convert it to a Response. - * - * @param Request $request A Request instance - * - * @return Response A Response instance - */ - function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); - } - -It takes a ``Request`` as an input and should return a ``Response`` as an -output. Using this interface makes your code compatible with all frameworks -using the Symfony2 components. And this will gives you many cool features for -free. - -Creating a framework based on the Symfony2 components is really easy. Here is -a very simple, but fully-featured framework based on the Symfony2 components: - - $routes = new RouteCollection(); - $routes->add('hello', new Route('/hello', array('_controller' => - function (Request $request) { - return new Response(sprintf("Hello %s", $request->get('name'))); - } - ))); - - $request = Request::createFromGlobals(); - - $context = new RequestContext(); - $context->fromRequest($request); - - $matcher = new UrlMatcher($routes, $context); - - $dispatcher = new EventDispatcher(); - $dispatcher->addSubscriber(new RouterListener($matcher)); - - $resolver = new ControllerResolver(); - - $kernel = new HttpKernel($dispatcher, $resolver); - - $kernel->handle($request)->send(); - -This is all you need to create a flexible framework with the Symfony2 -components. - -Want to add an HTTP reverse proxy and benefit from HTTP caching and Edge Side -Includes? - - $kernel = new HttpKernel($dispatcher, $resolver); - - $kernel = new HttpCache($kernel, new Store(__DIR__.'/cache')); - -Want to functional test this small framework? - - $client = new Client($kernel); - $crawler = $client->request('GET', '/hello/Fabien'); - - $this->assertEquals('Fabien', $crawler->filter('p > span')->text()); - -Want nice error pages instead of ugly PHP exceptions? - - $dispatcher->addSubscriber(new ExceptionListener(function (Request $request) { - $msg = 'Something went wrong! ('.$request->get('exception')->getMessage().')'; - - return new Response($msg, 500); - })); - -And that's why the simple looking ``HttpKernelInterface`` is so powerful. It -gives you access to a lot of cool features, ready to be used out of the box, -with no efforts. - -Resources ---------- - -Unit tests: - -https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/HttpKernel diff --git a/core/vendor/Symfony/Component/HttpKernel/TerminableInterface.php b/core/vendor/Symfony/Component/HttpKernel/TerminableInterface.php deleted file mode 100644 index 78a362f..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/TerminableInterface.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\HttpKernel; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Terminable extends the Kernel request/response cycle with dispatching a post - * response event after sending the response and before shutting down the kernel. - * - * @author Jordi Boggiano - * @author Pierre Minnieur - * - * @api - */ -interface TerminableInterface -{ - /** - * Terminates a request/response cycle. - * - * Should be called after sending the response and before shutting down the kernel. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @api - */ - function terminate(Request $request, Response $response); -} diff --git a/core/vendor/Symfony/Component/HttpKernel/composer.json b/core/vendor/Symfony/Component/HttpKernel/composer.json deleted file mode 100644 index d48cc2d..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/composer.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "symfony/http-kernel", - "type": "library", - "description": "Symfony HttpKernel Component", - "keywords": [], - "homepage": "http://symfony.com", - "version": "2.1.0", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.2", - "symfony/event-dispatcher": "self.version", - "symfony/http-foundation": "self.version" - }, - "suggest": { - "symfony/browser-kit": "self.version", - "symfony/class-loader": "self.version", - "symfony/config": "self.version", - "symfony/console": "self.version", - "symfony/dependency-injection": "self.version", - "symfony/finder": "self.version" - }, - "autoload": { - "psr-0": { "Symfony\\Component\\HttpKernel": "" } - }, - "target-dir": "Symfony/Component/HttpKernel" -} diff --git a/core/vendor/Symfony/Component/Routing/Annotation/Route.php b/core/vendor/Symfony/Component/Routing/Annotation/Route.php deleted file mode 100644 index f60af46..0000000 --- a/core/vendor/Symfony/Component/Routing/Annotation/Route.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\Routing\Annotation; - -/** - * Annotation class for @Route(). - * - * @Annotation - * - * @author Fabien Potencier - */ -class Route -{ - private $pattern; - private $name; - private $requirements; - private $options; - private $defaults; - - /** - * Constructor. - * - * @param array $data An array of key/value parameters. - */ - public function __construct(array $data) - { - $this->requirements = array(); - $this->options = array(); - $this->defaults = array(); - - if (isset($data['value'])) { - $data['pattern'] = $data['value']; - unset($data['value']); - } - - foreach ($data as $key => $value) { - $method = 'set'.$key; - if (!method_exists($this, $method)) { - throw new \BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $key, get_class($this))); - } - $this->$method($value); - } - } - - public function setPattern($pattern) - { - $this->pattern = $pattern; - } - - public function getPattern() - { - return $this->pattern; - } - - public function setName($name) - { - $this->name = $name; - } - - public function getName() - { - return $this->name; - } - - public function setRequirements($requirements) - { - $this->requirements = $requirements; - } - - public function getRequirements() - { - return $this->requirements; - } - - public function setOptions($options) - { - $this->options = $options; - } - - public function getOptions() - { - return $this->options; - } - - public function setDefaults($defaults) - { - $this->defaults = $defaults; - } - - public function getDefaults() - { - return $this->defaults; - } -} diff --git a/core/vendor/Symfony/Component/Routing/CompiledRoute.php b/core/vendor/Symfony/Component/Routing/CompiledRoute.php deleted file mode 100644 index c86c9ec..0000000 --- a/core/vendor/Symfony/Component/Routing/CompiledRoute.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * CompiledRoutes are returned by the RouteCompiler class. - * - * @author Fabien Potencier - */ -class CompiledRoute -{ - private $route; - private $variables; - private $tokens; - private $staticPrefix; - private $regex; - - /** - * Constructor. - * - * @param Route $route A original Route instance - * @param string $staticPrefix The static prefix of the compiled route - * @param string $regex The regular expression to use to match this route - * @param array $tokens An array of tokens to use to generate URL for this route - * @param array $variables An array of variables - */ - public function __construct(Route $route, $staticPrefix, $regex, array $tokens, array $variables) - { - $this->route = $route; - $this->staticPrefix = $staticPrefix; - $this->regex = $regex; - $this->tokens = $tokens; - $this->variables = $variables; - } - - /** - * Returns the Route instance. - * - * @return Route A Route instance - */ - public function getRoute() - { - return $this->route; - } - - /** - * Returns the static prefix. - * - * @return string The static prefix - */ - public function getStaticPrefix() - { - return $this->staticPrefix; - } - - /** - * Returns the regex. - * - * @return string The regex - */ - public function getRegex() - { - return $this->regex; - } - - /** - * Returns the tokens. - * - * @return array The tokens - */ - public function getTokens() - { - return $this->tokens; - } - - /** - * Returns the variables. - * - * @return array The variables - */ - public function getVariables() - { - return $this->variables; - } - - /** - * Returns the pattern. - * - * @return string The pattern - */ - public function getPattern() - { - return $this->route->getPattern(); - } - - /** - * Returns the options. - * - * @return array The options - */ - public function getOptions() - { - return $this->route->getOptions(); - } - - /** - * Returns the defaults. - * - * @return array The defaults - */ - public function getDefaults() - { - return $this->route->getDefaults(); - } - - /** - * Returns the requirements. - * - * @return array The requirements - */ - public function getRequirements() - { - return $this->route->getRequirements(); - } -} diff --git a/core/vendor/Symfony/Component/Routing/Exception/ExceptionInterface.php b/core/vendor/Symfony/Component/Routing/Exception/ExceptionInterface.php deleted file mode 100644 index 5289f52..0000000 --- a/core/vendor/Symfony/Component/Routing/Exception/ExceptionInterface.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\Routing\Exception; - -/** - * ExceptionInterface - * - * @author Alexandre Salomé - * - * @api - */ -interface ExceptionInterface -{ -} diff --git a/core/vendor/Symfony/Component/Routing/Exception/InvalidParameterException.php b/core/vendor/Symfony/Component/Routing/Exception/InvalidParameterException.php deleted file mode 100644 index 4f12469..0000000 --- a/core/vendor/Symfony/Component/Routing/Exception/InvalidParameterException.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\Routing\Exception; - -/** - * Exception thrown when a parameter is not valid - * - * @author Alexandre Salomé - * - * @api - */ -class InvalidParameterException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/core/vendor/Symfony/Component/Routing/Exception/MethodNotAllowedException.php b/core/vendor/Symfony/Component/Routing/Exception/MethodNotAllowedException.php deleted file mode 100644 index 470ce52..0000000 --- a/core/vendor/Symfony/Component/Routing/Exception/MethodNotAllowedException.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\Routing\Exception; - -/** - * The resource was found but the request method is not allowed. - * - * This exception should trigger an HTTP 405 response in your application code. - * - * @author Kris Wallsmith - * - * @api - */ -class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface -{ - protected $allowedMethods; - - public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null) - { - $this->allowedMethods = array_map('strtoupper', $allowedMethods); - - parent::__construct($message, $code, $previous); - } - - public function getAllowedMethods() - { - return $this->allowedMethods; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php b/core/vendor/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php deleted file mode 100644 index 5a523fa..0000000 --- a/core/vendor/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.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\Routing\Exception; - -/** - * Exception thrown when a route cannot be generated because of missing - * mandatory parameters. - * - * @author Alexandre Salomé - * - * @api - */ -class MissingMandatoryParametersException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/core/vendor/Symfony/Component/Routing/Exception/ResourceNotFoundException.php b/core/vendor/Symfony/Component/Routing/Exception/ResourceNotFoundException.php deleted file mode 100644 index 362a0d6..0000000 --- a/core/vendor/Symfony/Component/Routing/Exception/ResourceNotFoundException.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * The resource was not found. - * - * This exception should trigger an HTTP 404 response in your application code. - * - * @author Kris Wallsmith - * - * @api - */ -class ResourceNotFoundException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/core/vendor/Symfony/Component/Routing/Exception/RouteNotFoundException.php b/core/vendor/Symfony/Component/Routing/Exception/RouteNotFoundException.php deleted file mode 100644 index 4d5f288..0000000 --- a/core/vendor/Symfony/Component/Routing/Exception/RouteNotFoundException.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\Routing\Exception; - -/** - * Exception thrown when a route does not exists - * - * @author Alexandre Salomé - * - * @api - */ -class RouteNotFoundException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php b/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php deleted file mode 100644 index 1291bd1..0000000 --- a/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.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\Routing\Generator\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * GeneratorDumper is the base class for all built-in generator dumpers. - * - * @author Fabien Potencier - */ -abstract class GeneratorDumper implements GeneratorDumperInterface -{ - private $routes; - - /** - * Constructor. - * - * @param RouteCollection $routes The RouteCollection to dump - */ - public function __construct(RouteCollection $routes) - { - $this->routes = $routes; - } - - public function getRoutes() - { - return $this->routes; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php b/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php deleted file mode 100644 index 7179af2..0000000 --- a/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.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\Routing\Generator\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * GeneratorDumperInterface is the interface that all generator dumper classes must implement. - * - * @author Fabien Potencier - * - * @api - */ -interface GeneratorDumperInterface -{ - /** - * Dumps a set of routes to a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the generator class - */ - function dump(array $options = array()); - - /** - * Gets the routes to dump. - * - * @return RouteCollection A RouteCollection instance - */ - function getRoutes(); -} diff --git a/core/vendor/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php b/core/vendor/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php deleted file mode 100644 index 0725ca6..0000000 --- a/core/vendor/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator\Dumper; - -use Symfony\Component\Routing\Route; - -/** - * PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes. - * - * @author Fabien Potencier - * - * @api - */ -class PhpGeneratorDumper extends GeneratorDumper -{ - /** - * Dumps a set of routes to a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the generator class - * - * @api - */ - public function dump(array $options = array()) - { - $options = array_merge(array( - 'class' => 'ProjectUrlGenerator', - 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - ), $options); - - return - $this->startClass($options['class'], $options['base_class']). - $this->addConstructor(). - $this->addGenerator(). - $this->endClass() - ; - } - - private function addGenerator() - { - $methods = array(); - foreach ($this->getRoutes()->all() as $name => $route) { - $compiledRoute = $route->compile(); - - $variables = str_replace("\n", '', var_export($compiledRoute->getVariables(), true)); - $defaults = str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)); - $requirements = str_replace("\n", '', var_export($compiledRoute->getRequirements(), true)); - $tokens = str_replace("\n", '', var_export($compiledRoute->getTokens(), true)); - - $escapedName = str_replace('.', '__', $name); - - $methods[] = <<{'get'.\$escapedName.'RouteInfo'}(); - - return \$this->doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$absolute); - } - -$methods -EOF; - } - - private function startClass($class, $baseClass) - { - $routes = array(); - foreach ($this->getRoutes()->all() as $name => $route) { - $routes[] = " '$name' => true,"; - } - $routes = implode("\n", $routes); - - return <<context = \$context; - } - -EOF; - } - - private function endClass() - { - return << - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator; - -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Exception\InvalidParameterException; -use Symfony\Component\Routing\Exception\RouteNotFoundException; -use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; - -/** - * UrlGenerator generates URL based on a set of routes. - * - * @author Fabien Potencier - * - * @api - */ -class UrlGenerator implements UrlGeneratorInterface -{ - protected $context; - protected $decodedChars = array( - // %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitely allowed it) - '%2F' => '/', - ); - - protected $routes; - protected $cache; - - /** - * Constructor. - * - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - * - * @api - */ - public function __construct(RouteCollection $routes, RequestContext $context) - { - $this->routes = $routes; - $this->context = $context; - $this->cache = array(); - } - - /** - * Sets the request context. - * - * @param RequestContext $context The context - * - * @api - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - } - - /** - * Gets the request context. - * - * @return RequestContext The context - */ - public function getContext() - { - return $this->context; - } - - /** - * {@inheritDoc} - * - * @api - */ - public function generate($name, $parameters = array(), $absolute = false) - { - if (null === $route = $this->routes->get($name)) { - throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name)); - } - - if (!isset($this->cache[$name])) { - $this->cache[$name] = $route->compile(); - } - - return $this->doGenerate($this->cache[$name]->getVariables(), $route->getDefaults(), $route->getRequirements(), $this->cache[$name]->getTokens(), $parameters, $name, $absolute); - } - - /** - * @throws MissingMandatoryParametersException When route has some missing mandatory parameters - * @throws InvalidParameterException When a parameter value is not correct - */ - protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $absolute) - { - $variables = array_flip($variables); - - $originParameters = $parameters; - $parameters = array_replace($this->context->getParameters(), $parameters); - $tparams = array_replace($defaults, $parameters); - - // all params must be given - if ($diff = array_diff_key($variables, $tparams)) { - throw new MissingMandatoryParametersException(sprintf('The "%s" route has some missing mandatory parameters ("%s").', $name, implode('", "', array_keys($diff)))); - } - - $url = ''; - $optional = true; - foreach ($tokens as $token) { - if ('variable' === $token[0]) { - if (false === $optional || !array_key_exists($token[3], $defaults) || (isset($parameters[$token[3]]) && (string) $parameters[$token[3]] != (string) $defaults[$token[3]])) { - if (!$isEmpty = in_array($tparams[$token[3]], array(null, '', false), true)) { - // check requirement - if ($tparams[$token[3]] && !preg_match('#^'.$token[2].'$#', $tparams[$token[3]])) { - throw new InvalidParameterException(sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given).', $token[3], $name, $token[2], $tparams[$token[3]])); - } - } - - if (!$isEmpty || !$optional) { - $url = $token[1].strtr(rawurlencode($tparams[$token[3]]), $this->decodedChars).$url; - } - - $optional = false; - } - } elseif ('text' === $token[0]) { - $url = $token[1].$url; - $optional = false; - } - } - - if (!$url) { - $url = '/'; - } - - // add a query string if needed - $extra = array_diff_key($originParameters, $variables, $defaults); - if ($extra && $query = http_build_query($extra)) { - $url .= '?'.$query; - } - - $url = $this->context->getBaseUrl().$url; - - if ($this->context->getHost()) { - $scheme = $this->context->getScheme(); - if (isset($requirements['_scheme']) && ($req = strtolower($requirements['_scheme'])) && $scheme != $req) { - $absolute = true; - $scheme = $req; - } - - if ($absolute) { - $port = ''; - if ('http' === $scheme && 80 != $this->context->getHttpPort()) { - $port = ':'.$this->context->getHttpPort(); - } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { - $port = ':'.$this->context->getHttpsPort(); - } - - $url = $scheme.'://'.$this->context->getHost().$port.$url; - } - } - - return $url; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php b/core/vendor/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php deleted file mode 100644 index 220334f..0000000 --- a/core/vendor/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator; - -use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\Routing\Exception\RouteNotFoundException; - -/** - * UrlGeneratorInterface is the interface that all URL generator classes must implement. - * - * @author Fabien Potencier - * - * @api - */ -interface UrlGeneratorInterface extends RequestContextAwareInterface -{ - /** - * Generates a URL from the given parameters. - * - * If the generator is not able to generate the url, it must throw the RouteNotFoundException - * as documented below. - * - * @param string $name The name of the route - * @param mixed $parameters An array of parameters - * @param Boolean $absolute Whether to generate an absolute URL - * - * @return string The generated URL - * - * @throws RouteNotFoundException if route doesn't exist - * - * @api - */ - function generate($name, $parameters = array(), $absolute = false); -} diff --git a/core/vendor/Symfony/Component/Routing/LICENSE b/core/vendor/Symfony/Component/Routing/LICENSE deleted file mode 100644 index 89df448..0000000 --- a/core/vendor/Symfony/Component/Routing/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2011 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/core/vendor/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/core/vendor/Symfony/Component/Routing/Loader/AnnotationClassLoader.php deleted file mode 100644 index 28fa896..0000000 --- a/core/vendor/Symfony/Component/Routing/Loader/AnnotationClassLoader.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\Routing\Loader; - -use Doctrine\Common\Annotations\Reader; -use Symfony\Component\Routing\Annotation\Route as RouteAnnotation; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolverInterface; - -/** - * AnnotationClassLoader loads routing information from a PHP class and its methods. - * - * You need to define an implementation for the getRouteDefaults() method. Most of the - * time, this method should define some PHP callable to be called for the route - * (a controller in MVC speak). - * - * The @Route annotation can be set on the class (for global parameters), - * and on each method. - * - * The @Route annotation main value is the route pattern. The annotation also - * recognizes three parameters: requirements, options, and name. The name parameter - * is mandatory. Here is an example of how you should be able to use it: - * - * /** - * * @Route("/Blog") - * * / - * class Blog - * { - * /** - * * @Route("/", name="blog_index") - * * / - * public function index() - * { - * } - * - * /** - * * @Route("/{id}", name="blog_post", requirements = {"id" = "\d+"}) - * * / - * public function show() - * { - * } - * } - * - * @author Fabien Potencier - */ -abstract class AnnotationClassLoader implements LoaderInterface -{ - protected $reader; - protected $routeAnnotationClass = 'Symfony\\Component\\Routing\\Annotation\\Route'; - protected $defaultRouteIndex; - - /** - * Constructor. - * - * @param Reader $reader - */ - public function __construct(Reader $reader) - { - $this->reader = $reader; - } - - /** - * Sets the annotation class to read route properties from. - * - * @param string $class A fully-qualified class name - */ - public function setRouteAnnotationClass($class) - { - $this->routeAnnotationClass = $class; - } - - /** - * Loads from annotations from a class. - * - * @param string $class A class name - * @param string $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When route can't be parsed - */ - public function load($class, $type = null) - { - if (!class_exists($class)) { - throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); - } - - $globals = array( - 'pattern' => '', - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - ); - - $class = new \ReflectionClass($class); - if ($class->isAbstract()) { - throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class)); - } - - if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { - if (null !== $annot->getPattern()) { - $globals['pattern'] = $annot->getPattern(); - } - - if (null !== $annot->getRequirements()) { - $globals['requirements'] = $annot->getRequirements(); - } - - if (null !== $annot->getOptions()) { - $globals['options'] = $annot->getOptions(); - } - - if (null !== $annot->getDefaults()) { - $globals['defaults'] = $annot->getDefaults(); - } - } - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($class->getFileName())); - - foreach ($class->getMethods() as $method) { - $this->defaultRouteIndex = 0; - foreach ($this->reader->getMethodAnnotations($method) as $annot) { - if ($annot instanceof $this->routeAnnotationClass) { - $this->addRoute($collection, $annot, $globals, $class, $method); - } - } - } - - return $collection; - } - - protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method) - { - $name = $annot->getName(); - if (null === $name) { - $name = $this->getDefaultRouteName($class, $method); - } - - $defaults = array_merge($globals['defaults'], $annot->getDefaults()); - $requirements = array_merge($globals['requirements'], $annot->getRequirements()); - $options = array_merge($globals['options'], $annot->getOptions()); - - $route = new Route($globals['pattern'].$annot->getPattern(), $defaults, $requirements, $options); - - $this->configureRoute($route, $class, $method, $annot); - - $collection->add($name, $route); - } - - /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise - */ - public function supports($resource, $type = null) - { - return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type); - } - - /** - * Sets the loader resolver. - * - * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance - */ - public function setResolver(LoaderResolverInterface $resolver) - { - } - - /** - * Gets the loader resolver. - * - * @return LoaderResolverInterface A LoaderResolverInterface instance - */ - public function getResolver() - { - } - - /** - * Gets the default route name for a class method. - * - * @param \ReflectionClass $class - * @param \ReflectionMethod $method - * - * @return string - */ - protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) - { - $name = strtolower(str_replace('\\', '_', $class->getName()).'_'.$method->getName()); - if ($this->defaultRouteIndex > 0) { - $name .= '_'.$this->defaultRouteIndex; - } - $this->defaultRouteIndex++; - - return $name; - } - - abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot); -} diff --git a/core/vendor/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php b/core/vendor/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php deleted file mode 100644 index 8097cd6..0000000 --- a/core/vendor/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Resource\DirectoryResource; - -/** - * AnnotationDirectoryLoader loads routing information from annotations set - * on PHP classes and methods. - * - * @author Fabien Potencier - */ -class AnnotationDirectoryLoader extends AnnotationFileLoader -{ - /** - * Loads from annotations from a directory. - * - * @param string $path A directory path - * @param string $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed - */ - public function load($path, $type = null) - { - $dir = $this->locator->locate($path); - - $collection = new RouteCollection(); - $collection->addResource(new DirectoryResource($dir, '/\.php$/')); - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) { - continue; - } - - if ($class = $this->findClass($file)) { - $refl = new \ReflectionClass($class); - if ($refl->isAbstract()) { - continue; - } - - $collection->addCollection($this->loader->load($class, $type)); - } - } - - return $collection; - } - - /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise - */ - public function supports($resource, $type = null) - { - try { - $path = $this->locator->locate($resource); - } catch (\Exception $e) { - return false; - } - - return is_string($resource) && is_dir($path) && (!$type || 'annotation' === $type); - } -} diff --git a/core/vendor/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/core/vendor/Symfony/Component/Routing/Loader/AnnotationFileLoader.php deleted file mode 100644 index 49e1cb2..0000000 --- a/core/vendor/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Config\FileLocator; - -/** - * AnnotationFileLoader loads routing information from annotations set - * on a PHP class and its methods. - * - * @author Fabien Potencier - */ -class AnnotationFileLoader extends FileLoader -{ - protected $loader; - - /** - * Constructor. - * - * @param FileLocator $locator A FileLocator instance - * @param AnnotationClassLoader $loader An AnnotationClassLoader instance - * @param string|array $paths A path or an array of paths where to look for resources - */ - public function __construct(FileLocator $locator, AnnotationClassLoader $loader, $paths = array()) - { - if (!function_exists('token_get_all')) { - throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.'); - } - - parent::__construct($locator, $paths); - - $this->loader = $loader; - } - - /** - * Loads from annotations from a file. - * - * @param string $file A PHP file path - * @param string $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - $collection = new RouteCollection(); - if ($class = $this->findClass($path)) { - $collection->addResource(new FileResource($path)); - $collection->addCollection($this->loader->load($class, $type)); - } - - return $collection; - } - - /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type); - } - - /** - * Returns the full class name for the first class in the file. - * - * @param string $file A PHP file path - * - * @return string|false Full class name if found, false otherwise - */ - protected function findClass($file) - { - $class = false; - $namespace = false; - $tokens = token_get_all(file_get_contents($file)); - for ($i = 0, $count = count($tokens); $i < $count; $i++) { - $token = $tokens[$i]; - - if (!is_array($token)) { - continue; - } - - if (true === $class && T_STRING === $token[0]) { - return $namespace.'\\'.$token[1]; - } - - if (true === $namespace && T_STRING === $token[0]) { - $namespace = ''; - do { - $namespace .= $token[1]; - $token = $tokens[++$i]; - } while ($i < $count && is_array($token) && in_array($token[0], array(T_NS_SEPARATOR, T_STRING))); - } - - if (T_CLASS === $token[0]) { - $class = true; - } - - if (T_NAMESPACE === $token[0]) { - $namespace = true; - } - } - - return false; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Loader/ClosureLoader.php b/core/vendor/Symfony/Component/Routing/Loader/ClosureLoader.php deleted file mode 100644 index ca49c8f..0000000 --- a/core/vendor/Symfony/Component/Routing/Loader/ClosureLoader.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Config\Loader\Loader; - -/** - * ClosureLoader loads routes from a PHP closure. - * - * The Closure must return a RouteCollection instance. - * - * @author Fabien Potencier - * - * @api - */ -class ClosureLoader extends Loader -{ - /** - * Loads a Closure. - * - * @param \Closure $closure A Closure - * @param string $type The resource type - * - * @api - */ - public function load($closure, $type = null) - { - return call_user_func($closure); - } - - /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise - * - * @api - */ - public function supports($resource, $type = null) - { - return $resource instanceof \Closure && (!$type || 'closure' === $type); - } -} diff --git a/core/vendor/Symfony/Component/Routing/Loader/PhpFileLoader.php b/core/vendor/Symfony/Component/Routing/Loader/PhpFileLoader.php deleted file mode 100644 index ffd31f9..0000000 --- a/core/vendor/Symfony/Component/Routing/Loader/PhpFileLoader.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Loader\FileLoader; - -/** - * PhpFileLoader loads routes from a PHP file. - * - * The file must return a RouteCollection instance. - * - * @author Fabien Potencier - * - * @api - */ -class PhpFileLoader extends FileLoader -{ - /** - * Loads a PHP file. - * - * @param mixed $file A PHP file path - * @param string $type The resource type - * - * @api - */ - public function load($file, $type = null) - { - // the loader variable is exposed to the included file below - $loader = $this; - - $path = $this->locator->locate($file); - $this->setCurrentDir(dirname($path)); - - $collection = include $path; - $collection->addResource(new FileResource($path)); - - return $collection; - } - - /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise - * - * @api - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type); - } -} diff --git a/core/vendor/Symfony/Component/Routing/Loader/XmlFileLoader.php b/core/vendor/Symfony/Component/Routing/Loader/XmlFileLoader.php deleted file mode 100644 index 913deab..0000000 --- a/core/vendor/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ /dev/null @@ -1,228 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Loader\FileLoader; - -/** - * XmlFileLoader loads XML routing files. - * - * @author Fabien Potencier - * - * @api - */ -class XmlFileLoader extends FileLoader -{ - /** - * Loads an XML file. - * - * @param string $file An XML file path - * @param string $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When a tag can't be parsed - * - * @api - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - $xml = $this->loadFile($path); - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($path)); - - // process routes and imports - foreach ($xml->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement) { - continue; - } - - $this->parseNode($collection, $node, $path, $file); - } - - return $collection; - } - - /** - * Parses a node from a loaded XML file. - * - * @param RouteCollection $collection the collection to associate with the node - * @param DOMElement $node the node to parse - * @param string $path the path of the XML file being processed - * @param string $file - */ - protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file) - { - switch ($node->tagName) { - case 'route': - $this->parseRoute($collection, $node, $path); - break; - case 'import': - $resource = (string) $node->getAttribute('resource'); - $type = (string) $node->getAttribute('type'); - $prefix = (string) $node->getAttribute('prefix'); - - $defaults = array(); - $requirements = array(); - - foreach ($node->childNodes as $n) { - if (!$n instanceof \DOMElement) { - continue; - } - - switch ($n->tagName) { - case 'default': - $defaults[(string) $n->getAttribute('key')] = trim((string) $n->nodeValue); - break; - case 'requirement': - $requirements[(string) $n->getAttribute('key')] = trim((string) $n->nodeValue); - break; - default: - throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $n->tagName)); - } - } - - $this->setCurrentDir(dirname($path)); - $collection->addCollection($this->import($resource, ('' !== $type ? $type : null), false, $file), $prefix, $defaults, $requirements); - break; - default: - throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $node->tagName)); - } - } - - /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise - * - * @api - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type); - } - - /** - * Parses a route and adds it to the RouteCollection. - * - * @param RouteCollection $collection A RouteCollection instance - * @param \DOMElement $definition Route definition - * @param string $file An XML file path - * - * @throws \InvalidArgumentException When the definition cannot be parsed - */ - protected function parseRoute(RouteCollection $collection, \DOMElement $definition, $file) - { - $defaults = array(); - $requirements = array(); - $options = array(); - - foreach ($definition->childNodes as $node) { - if (!$node instanceof \DOMElement) { - continue; - } - - switch ($node->tagName) { - case 'default': - $defaults[(string) $node->getAttribute('key')] = trim((string) $node->nodeValue); - break; - case 'option': - $options[(string) $node->getAttribute('key')] = trim((string) $node->nodeValue); - break; - case 'requirement': - $requirements[(string) $node->getAttribute('key')] = trim((string) $node->nodeValue); - break; - default: - throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $node->tagName)); - } - } - - $route = new Route((string) $definition->getAttribute('pattern'), $defaults, $requirements, $options); - - $collection->add((string) $definition->getAttribute('id'), $route); - } - - /** - * Loads an XML file. - * - * @param string $file An XML file path - * - * @return \DOMDocument - * - * @throws \InvalidArgumentException When loading of XML file returns error - */ - protected function loadFile($file) - { - $dom = new \DOMDocument(); - libxml_use_internal_errors(true); - if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) { - throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors())); - } - $dom->validateOnParse = true; - $dom->normalizeDocument(); - libxml_use_internal_errors(false); - $this->validate($dom); - - return $dom; - } - - /** - * Validates a loaded XML file. - * - * @param \DOMDocument $dom A loaded XML file - * - * @throws \InvalidArgumentException When XML doesn't validate its XSD schema - */ - protected function validate(\DOMDocument $dom) - { - $location = __DIR__.'/schema/routing/routing-1.0.xsd'; - - $current = libxml_use_internal_errors(true); - if (!$dom->schemaValidate($location)) { - throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors())); - } - libxml_use_internal_errors($current); - } - - /** - * Retrieves libxml errors and clears them. - * - * @return array An array of libxml error strings - */ - private function getXmlErrors() - { - $errors = array(); - foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', - $error->code, - trim($error->message), - $error->file ? $error->file : 'n/a', - $error->line, - $error->column - ); - } - - libxml_clear_errors(); - - return $errors; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Loader/YamlFileLoader.php b/core/vendor/Symfony/Component/Routing/Loader/YamlFileLoader.php deleted file mode 100644 index 5d8f02a..0000000 --- a/core/vendor/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Config\Loader\FileLoader; - -/** - * YamlFileLoader loads Yaml routing files. - * - * @author Fabien Potencier - * - * @api - */ -class YamlFileLoader extends FileLoader -{ - private static $availableKeys = array( - 'type', 'resource', 'prefix', 'pattern', 'options', 'defaults', 'requirements' - ); - - /** - * Loads a Yaml file. - * - * @param string $file A Yaml file path - * @param string $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When route can't be parsed - * - * @api - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - $config = Yaml::parse($path); - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($path)); - - // empty file - if (null === $config) { - $config = array(); - } - - // not an array - if (!is_array($config)) { - throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $file)); - } - - foreach ($config as $name => $config) { - $config = $this->normalizeRouteConfig($config); - - if (isset($config['resource'])) { - $type = isset($config['type']) ? $config['type'] : null; - $prefix = isset($config['prefix']) ? $config['prefix'] : null; - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - - $this->setCurrentDir(dirname($path)); - $collection->addCollection($this->import($config['resource'], $type, false, $file), $prefix, $defaults, $requirements); - } else { - $this->parseRoute($collection, $name, $config, $path); - } - } - - return $collection; - } - - /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise - * - * @api - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'yml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'yaml' === $type); - } - - /** - * Parses a route and adds it to the RouteCollection. - * - * @param RouteCollection $collection A RouteCollection instance - * @param string $name Route name - * @param array $config Route definition - * @param string $file A Yaml file path - * - * @throws \InvalidArgumentException When config pattern is not defined for the given route - */ - protected function parseRoute(RouteCollection $collection, $name, $config, $file) - { - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - $options = isset($config['options']) ? $config['options'] : array(); - - if (!isset($config['pattern'])) { - throw new \InvalidArgumentException(sprintf('You must define a "pattern" for the "%s" route.', $name)); - } - - $route = new Route($config['pattern'], $defaults, $requirements, $options); - - $collection->add($name, $route); - } - - /** - * Normalize route configuration. - * - * @param array $config A resource config - * - * @return array - * - * @throws InvalidArgumentException if one of the provided config keys is not supported - */ - private function normalizeRouteConfig(array $config) - { - foreach ($config as $key => $value) { - if (!in_array($key, self::$availableKeys)) { - throw new \InvalidArgumentException(sprintf( - 'Yaml routing loader does not support given key: "%s". Expected one of the (%s).', - $key, implode(', ', self::$availableKeys) - )); - } - } - - return $config; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd b/core/vendor/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd deleted file mode 100644 index 3b8fa3d..0000000 --- a/core/vendor/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/vendor/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php b/core/vendor/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php deleted file mode 100644 index 66ba493..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - -/** - * ApacheUrlMatcher matches URL based on Apache mod_rewrite matching (see ApacheMatcherDumper). - * - * @author Fabien Potencier - */ -class ApacheUrlMatcher extends UrlMatcher -{ - /** - * Tries to match a URL based on Apache mod_rewrite matching. - * - * Returns false if no route matches the URL. - * - * @param string $pathinfo The pathinfo to be parsed - * - * @return array An array of parameters - * - * @throws MethodNotAllowedException If the current method is not allowed - */ - public function match($pathinfo) - { - $parameters = array(); - $allow = array(); - $match = false; - - foreach ($_SERVER as $key => $value) { - $name = $key; - - if (0 === strpos($name, 'REDIRECT_')) { - $name = substr($name, 9); - } - - if (0 === strpos($name, '_ROUTING_')) { - $name = substr($name, 9); - } else { - continue; - } - - if ('_route' == $name) { - $match = true; - } elseif (0 === strpos($name, '_allow_')) { - $allow[] = substr($name, 7); - } else { - $parameters[$name] = $value; - } - - unset($_SERVER[$key]); - } - - if ($match) { - return $parameters; - } elseif (0 < count($allow)) { - throw new MethodNotAllowedException($allow); - } else { - return parent::match($pathinfo); - } - } -} diff --git a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/core/vendor/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php deleted file mode 100644 index 344abe2..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - - -/** - * Dumps a set of Apache mod_rewrite rules. - * - * @author Fabien Potencier - * @author Kris Wallsmith - */ -class ApacheMatcherDumper extends MatcherDumper -{ - /** - * Dumps a set of Apache mod_rewrite rules. - * - * Available options: - * - * * script_name: The script name (app.php by default) - * * base_uri: The base URI ("" by default) - * - * @param array $options An array of options - * - * @return string A string to be used as Apache rewrite rules - */ - public function dump(array $options = array()) - { - $options = array_merge(array( - 'script_name' => 'app.php', - 'base_uri' => '', - ), $options); - - $rules = array("# skip \"real\" requests\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule .* - [QSA,L]"); - $methodVars = array(); - - foreach ($this->getRoutes()->all() as $name => $route) { - $compiledRoute = $route->compile(); - - // prepare the apache regex - $regex = preg_replace('/\?P<.+?>/', '', substr(str_replace(array("\n", ' '), '', $compiledRoute->getRegex()), 1, -3)); - $regex = '^'.preg_quote($options['base_uri']).substr($regex, 1); - - $methods = array(); - if ($req = $route->getRequirement('_method')) { - $methods = explode('|', strtoupper($req)); - // GET and HEAD are equivalent - if (in_array('GET', $methods) && !in_array('HEAD', $methods)) { - $methods[] = 'HEAD'; - } - } - - $hasTrailingSlash = (!$methods || in_array('HEAD', $methods)) && '/$' == substr($regex, -2) && '^/$' != $regex; - - $variables = array('E=_ROUTING__route:'.$name); - foreach ($compiledRoute->getVariables() as $i => $variable) { - $variables[] = 'E=_ROUTING_'.$variable.':%'.($i + 1); - } - foreach ($route->getDefaults() as $key => $value) { - // todo: a more legit way to escape the value? - $variables[] = 'E=_ROUTING_'.$key.':'.strtr($value, array( - ':' => '\\:', - '=' => '\\=', - '\\' => '\\\\', - ' ' => '\\ ', - )); - } - $variables = implode(',', $variables); - - $rule = array("# $name"); - - // method mismatch - if ($req = $route->getRequirement('_method')) { - $methods = explode('|', strtoupper($req)); - // GET and HEAD are equivalent - if (in_array('GET', $methods) && !in_array('HEAD', $methods)) { - $methods[] = 'HEAD'; - } - $allow = array(); - foreach ($methods as $method) { - $methodVars[] = $method; - $allow[] = 'E=_ROUTING__allow_'.$method.':1'; - } - - $rule[] = "RewriteCond %{REQUEST_URI} $regex"; - $rule[] = sprintf("RewriteCond %%{REQUEST_METHOD} !^(%s)$ [NC]", implode('|', $methods)); - $rule[] = sprintf('RewriteRule .* - [S=%d,%s]', $hasTrailingSlash ? 2 : 1, implode(',', $allow)); - } - - // redirect with trailing slash appended - if ($hasTrailingSlash) { - $rule[] = 'RewriteCond %{REQUEST_URI} '.substr($regex, 0, -2).'$'; - $rule[] = 'RewriteRule .* $0/ [QSA,L,R=301]'; - } - - // the main rule - $rule[] = "RewriteCond %{REQUEST_URI} $regex"; - $rule[] = "RewriteRule .* {$options['script_name']} [QSA,L,$variables]"; - - $rules[] = implode("\n", $rule); - } - - if (0 < count($methodVars)) { - $rule = array('# 405 Method Not Allowed'); - $methodVars = array_values(array_unique($methodVars)); - foreach ($methodVars as $i => $methodVar) { - $rule[] = sprintf('RewriteCond %%{_ROUTING__allow_%s} !-z%s', $methodVar, isset($methodVars[$i + 1]) ? ' [OR]' : ''); - } - $rule[] = sprintf('RewriteRule .* %s [QSA,L]', $options['script_name']); - - $rules[] = implode("\n", $rule); - } - - return implode("\n\n", $rules)."\n"; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php b/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php deleted file mode 100644 index 423368b..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.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\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * MatcherDumper is the abstract class for all built-in matcher dumpers. - * - * @author Fabien Potencier - */ -abstract class MatcherDumper implements MatcherDumperInterface -{ - private $routes; - - /** - * Constructor. - * - * @param RouteCollection $routes The RouteCollection to dump - */ - public function __construct(RouteCollection $routes) - { - $this->routes = $routes; - } - - /** - * Gets the routes to dump. - * - * @return RouteCollection A RouteCollection instance - */ - public function getRoutes() - { - return $this->routes; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php b/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php deleted file mode 100644 index 950c396..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.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\Routing\Matcher\Dumper; - -/** - * MatcherDumperInterface is the interface that all matcher dumper classes must implement. - * - * @author Fabien Potencier - */ -interface MatcherDumperInterface -{ - /** - * Dumps a set of routes to a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the matcher class - */ - function dump(array $options = array()); - - /** - * Gets the routes to match. - * - * @return RouteCollection A RouteCollection instance - */ - function getRoutes(); -} diff --git a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/core/vendor/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php deleted file mode 100644 index 5c2fcb4..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ /dev/null @@ -1,298 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -/** - * PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes. - * - * @author Fabien Potencier - */ -class PhpMatcherDumper extends MatcherDumper -{ - /** - * Dumps a set of routes to a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the matcher class - */ - public function dump(array $options = array()) - { - $options = array_merge(array( - 'class' => 'ProjectUrlMatcher', - 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - ), $options); - - // trailing slash support is only enabled if we know how to redirect the user - $interfaces = class_implements($options['base_class']); - $supportsRedirections = isset($interfaces['Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface']); - - return - $this->startClass($options['class'], $options['base_class']). - $this->addConstructor(). - $this->addMatcher($supportsRedirections). - $this->endClass() - ; - } - - private function addMatcher($supportsRedirections) - { - // we need to deep clone the routes as we will modify the structure to optimize the dump - $code = implode("\n", $this->compileRoutes(clone $this->getRoutes(), $supportsRedirections)); - - return <<getIterator(); - $keys = array_keys($routeIterator->getArrayCopy()); - $keysCount = count($keys); - - $i = 0; - foreach ($routeIterator as $name => $route) { - $i++; - - if ($route instanceof RouteCollection) { - $prefix = $route->getPrefix(); - $optimizable = $prefix && count($route->all()) > 1 && false === strpos($route->getPrefix(), '{'); - $indent = ''; - if ($optimizable) { - for ($j = $i; $j < $keysCount; $j++) { - if ($keys[$j] === null) { - continue; - } - - $testRoute = $routeIterator->offsetGet($keys[$j]); - $isCollection = ($testRoute instanceof RouteCollection); - - $testPrefix = $isCollection ? $testRoute->getPrefix() : $testRoute->getPattern(); - - if (0 === strpos($testPrefix, $prefix)) { - $routeIterator->offsetUnset($keys[$j]); - - if ($isCollection) { - $route->addCollection($testRoute); - } else { - $route->add($keys[$j], $testRoute); - } - - $i++; - $keys[$j] = null; - } - } - - if ($prefix !== $parentPrefix) { - $code[] = sprintf(" if (0 === strpos(\$pathinfo, %s)) {", var_export($prefix, true)); - $indent = ' '; - } - } - - foreach ($this->compileRoutes($route, $supportsRedirections, $prefix) as $line) { - foreach (explode("\n", $line) as $l) { - if ($l) { - $code[] = $indent.$l; - } else { - $code[] = $l; - } - } - } - - if ($optimizable && $prefix !== $parentPrefix) { - $code[] = " }\n"; - } - } else { - foreach ($this->compileRoute($route, $name, $supportsRedirections, $parentPrefix) as $line) { - $code[] = $line; - } - } - } - - return $code; - } - - private function compileRoute(Route $route, $name, $supportsRedirections, $parentPrefix = null) - { - $code = array(); - $compiledRoute = $route->compile(); - $conditions = array(); - $hasTrailingSlash = false; - $matches = false; - $methods = array(); - if ($req = $route->getRequirement('_method')) { - $methods = explode('|', strtoupper($req)); - // GET and HEAD are equivalent - if (in_array('GET', $methods) && !in_array('HEAD', $methods)) { - $methods[] = 'HEAD'; - } - } - $supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('HEAD', $methods)); - - if (!count($compiledRoute->getVariables()) && false !== preg_match('#^(.)\^(?P.*?)\$\1#', str_replace(array("\n", ' '), '', $compiledRoute->getRegex()), $m)) { - if ($supportsTrailingSlash && substr($m['url'], -1) === '/') { - $conditions[] = sprintf("rtrim(\$pathinfo, '/') === %s", var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true)); - $hasTrailingSlash = true; - } else { - $conditions[] = sprintf("\$pathinfo === %s", var_export(str_replace('\\', '', $m['url']), true)); - } - } else { - if ($compiledRoute->getStaticPrefix() && $compiledRoute->getStaticPrefix() != $parentPrefix) { - $conditions[] = sprintf("0 === strpos(\$pathinfo, %s)", var_export($compiledRoute->getStaticPrefix(), true)); - } - - $regex = str_replace(array("\n", ' '), '', $compiledRoute->getRegex()); - if ($supportsTrailingSlash && $pos = strpos($regex, '/$')) { - $regex = substr($regex, 0, $pos).'/?$'.substr($regex, $pos + 2); - $hasTrailingSlash = true; - } - $conditions[] = sprintf("preg_match(%s, \$pathinfo, \$matches)", var_export($regex, true)); - - $matches = true; - } - - $conditions = implode(' && ', $conditions); - - $gotoname = 'not_'.preg_replace('/[^A-Za-z0-9_]/', '', $name); - - $code[] = <<context->getMethod() != '$methods[0]') { - \$allow[] = '$methods[0]'; - goto $gotoname; - } -EOF; - } else { - $methods = implode('\', \'', $methods); - $code[] = <<context->getMethod(), array('$methods'))) { - \$allow = array_merge(\$allow, array('$methods')); - goto $gotoname; - } -EOF; - } - } - - if ($hasTrailingSlash) { - $code[] = sprintf(<<redirect(\$pathinfo.'/', '%s'); - } -EOF - , $name); - } - - if ($scheme = $route->getRequirement('_scheme')) { - if (!$supportsRedirections) { - throw new \LogicException('The "_scheme" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.'); - } - - $code[] = sprintf(<<context->getScheme() !== '$scheme') { - return \$this->redirect(\$pathinfo, '%s', '$scheme'); - } -EOF - , $name); - } - - // optimize parameters array - if (true === $matches && $compiledRoute->getDefaults()) { - $code[] = sprintf(" return array_merge(\$this->mergeDefaults(\$matches, %s), array('_route' => '%s'));" - , str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)), $name); - } elseif (true === $matches) { - $code[] = sprintf(" \$matches['_route'] = '%s';", $name); - $code[] = sprintf(" return \$matches;", $name); - } elseif ($compiledRoute->getDefaults()) { - $code[] = sprintf(' return %s;', str_replace("\n", '', var_export(array_merge($compiledRoute->getDefaults(), array('_route' => $name)), true))); - } else { - $code[] = sprintf(" return array('_route' => '%s');", $name); - } - $code[] = " }"; - - if ($methods) { - $code[] = " $gotoname:"; - } - - $code[] = ''; - - return $code; - } - - private function startClass($class, $baseClass) - { - return <<context = \$context; - } - -EOF; - } - - private function endClass() - { - return << - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\ResourceNotFoundException; - -/** - * @author Fabien Potencier - * - * @api - */ -abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface -{ - private $trailingSlashTest = false; - - /** - * @see UrlMatcher::match() - * - * @api - */ - public function match($pathinfo) - { - try { - $parameters = parent::match($pathinfo); - } catch (ResourceNotFoundException $e) { - if ('/' === substr($pathinfo, -1)) { - throw $e; - } - - // try with a / at the end - $this->trailingSlashTest = true; - - return $this->match($pathinfo.'/'); - } - - if ($this->trailingSlashTest) { - $this->trailingSlashTest = false; - - return $this->redirect($pathinfo, null); - } - - return $parameters; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php b/core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php deleted file mode 100644 index 72a2ec4..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -/** - * RedirectableUrlMatcherInterface knows how to redirect the user. - * - * @author Fabien Potencier - * - * @api - */ -interface RedirectableUrlMatcherInterface -{ - /** - * Redirects the user to another URL. - * - * @param string $path The path info to redirect to. - * @param string $route The route that matched - * @param string $scheme The URL scheme (null to keep the current one) - * - * @return array An array of parameters - * - * @api - */ - function redirect($path, $route, $scheme = null); -} diff --git a/core/vendor/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php b/core/vendor/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php deleted file mode 100644 index ec00380..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\ExceptionInterface; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Matcher\UrlMatcher; - -/** - * TraceableUrlMatcher helps debug path info matching by tracing the match. - * - * @author Fabien Potencier - */ -class TraceableUrlMatcher extends UrlMatcher -{ - const ROUTE_DOES_NOT_MATCH = 0; - const ROUTE_ALMOST_MATCHES = 1; - const ROUTE_MATCHES = 2; - - protected $traces; - - public function getTraces($pathinfo) - { - $this->traces = array(); - - try { - $this->match($pathinfo); - } catch (ExceptionInterface $e) { - } - - return $this->traces; - } - - protected function matchCollection($pathinfo, RouteCollection $routes) - { - $pathinfo = urldecode($pathinfo); - - foreach ($routes as $name => $route) { - if ($route instanceof RouteCollection) { - if (!$ret = $this->matchCollection($pathinfo, $route)) { - continue; - } - - return true; - } - - $compiledRoute = $route->compile(); - - if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { - // does it match without any requirements? - $r = new Route($route->getPattern(), $route->getDefaults(), array(), $route->getOptions()); - $cr = $r->compile(); - if (!preg_match($cr->getRegex(), $pathinfo)) { - $this->addTrace(sprintf('Pattern "%s" does not match', $route->getPattern()), self::ROUTE_DOES_NOT_MATCH, $name, $route); - - continue; - } - - foreach ($route->getRequirements() as $n => $regex) { - $r = new Route($route->getPattern(), $route->getDefaults(), array($n => $regex), $route->getOptions()); - $cr = $r->compile(); - - if (in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) { - $this->addTrace(sprintf('Requirement for "%s" does not match (%s)', $n, $regex), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue; - } - } - - continue; - } - - // check HTTP method requirement - if ($req = $route->getRequirement('_method')) { - // HEAD and GET are equivalent as per RFC - if ('HEAD' === $method = $this->context->getMethod()) { - $method = 'GET'; - } - - if (!in_array($method, $req = explode('|', strtoupper($req)))) { - $this->allow = array_merge($this->allow, $req); - - $this->addTrace(sprintf('Method "%s" does not match the requirement ("%s")', $this->context->getMethod(), implode(', ', $req)), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue; - } - } - - // check HTTP scheme requirement - if ($scheme = $route->getRequirement('_scheme')) { - if ($this->context->getScheme() !== $scheme) { - $this->addTrace(sprintf('Scheme "%s" does not match the requirement ("%s"); the user will be redirected', $this->context->getScheme(), $scheme), self::ROUTE_ALMOST_MATCHES, $name, $route); - - return true; - } - } - - $this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route); - - return true; - } - } - - private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null) - { - $this->traces[] = array( - 'log' => $log, - 'name' => $name, - 'level' => $level, - 'pattern' => null !== $route ? $route->getPattern() : null, - ); - } -} diff --git a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcher.php b/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcher.php deleted file mode 100644 index 5d30ae9..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\MethodNotAllowedException; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface; - -/** - * UrlMatcher matches URL based on a set of routes. - * - * @author Fabien Potencier - * - * @api - */ -class UrlMatcher implements UrlMatcherInterface -{ - protected $context; - - private $routes; - - /** - * Constructor. - * - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - * - * @api - */ - public function __construct(RouteCollection $routes, RequestContext $context) - { - $this->routes = $routes; - $this->context = $context; - } - - /** - * Sets the request context. - * - * @param RequestContext $context The context - * - * @api - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - } - - /** - * Gets the request context. - * - * @return RequestContext The context - */ - public function getContext() - { - return $this->context; - } - - /** - * {@inheritDoc} - * - * @api - */ - public function match($pathinfo) - { - $this->allow = array(); - - if ($ret = $this->matchCollection($pathinfo, $this->routes)) { - return $ret; - } - - throw 0 < count($this->allow) - ? new MethodNotAllowedException(array_unique(array_map('strtoupper', $this->allow))) - : new ResourceNotFoundException(); - } - - protected function matchCollection($pathinfo, RouteCollection $routes) - { - $pathinfo = urldecode($pathinfo); - - foreach ($routes as $name => $route) { - if ($route instanceof RouteCollection) { - if (false === strpos($route->getPrefix(), '{') && $route->getPrefix() !== substr($pathinfo, 0, strlen($route->getPrefix()))) { - continue; - } - - if (!$ret = $this->matchCollection($pathinfo, $route)) { - continue; - } - - return $ret; - } - - $compiledRoute = $route->compile(); - - // check the static prefix of the URL first. Only use the more expensive preg_match when it matches - if ('' !== $compiledRoute->getStaticPrefix() && 0 !== strpos($pathinfo, $compiledRoute->getStaticPrefix())) { - continue; - } - - if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { - continue; - } - - // check HTTP method requirement - if ($req = $route->getRequirement('_method')) { - // HEAD and GET are equivalent as per RFC - if ('HEAD' === $method = $this->context->getMethod()) { - $method = 'GET'; - } - - if (!in_array($method, $req = explode('|', strtoupper($req)))) { - $this->allow = array_merge($this->allow, $req); - - continue; - } - } - - // check HTTP scheme requirement - if ($scheme = $route->getRequirement('_scheme')) { - if (!$this instanceof RedirectableUrlMatcherInterface) { - throw new \LogicException('The "_scheme" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.'); - } - - if ($this->context->getScheme() !== $scheme) { - return $this->redirect($pathinfo, $name, $scheme); - } - } - - return array_merge($this->mergeDefaults($matches, $route->getDefaults()), array('_route' => $name)); - } - } - - protected function mergeDefaults($params, $defaults) - { - $parameters = $defaults; - foreach ($params as $key => $value) { - if (!is_int($key)) { - $parameters[$key] = rawurldecode($value); - } - } - - return $parameters; - } -} diff --git a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php b/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php deleted file mode 100644 index ce998ea..0000000 --- a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - -/** - * UrlMatcherInterface is the interface that all URL matcher classes must implement. - * - * @author Fabien Potencier - * - * @api - */ -interface UrlMatcherInterface extends RequestContextAwareInterface -{ - /** - * Tries to match a URL with a set of routes. - * - * If the matcher can not find information, it must throw one of the exceptions documented - * below. - * - * @param string $pathinfo The path info to be parsed - * - * @return array An array of parameters - * - * @throws ResourceNotFoundException If the resource could not be found - * @throws MethodNotAllowedException If the resource was found but the request method is not allowed - * - * @api - */ - function match($pathinfo); -} diff --git a/core/vendor/Symfony/Component/Routing/README.md b/core/vendor/Symfony/Component/Routing/README.md deleted file mode 100644 index eb72334..0000000 --- a/core/vendor/Symfony/Component/Routing/README.md +++ /dev/null @@ -1,32 +0,0 @@ -Routing Component -================= - -Routing associates a request with the code that will convert it to a response. - -The example below demonstrates how you can set up a fully working routing -system: - - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\Routing\Matcher\UrlMatcher; - use Symfony\Component\Routing\RequestContext; - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $routes = new RouteCollection(); - $routes->add('hello', new Route('/hello', array('controller' => 'foo'))); - - $context = new RequestContext(); - - // this is optional and can be done without a Request instance - $context->fromRequest(Request::createFromGlobals()); - - $matcher = new UrlMatcher($routes, $context); - - $parameters = $matcher->match('/hello'); - -Resources ---------- - -Unit tests: - -https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/Routing diff --git a/core/vendor/Symfony/Component/Routing/RequestContext.php b/core/vendor/Symfony/Component/Routing/RequestContext.php deleted file mode 100644 index 013d942..0000000 --- a/core/vendor/Symfony/Component/Routing/RequestContext.php +++ /dev/null @@ -1,262 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\HttpFoundation\Request; - -/** - * Holds information about the current request. - * - * @author Fabien Potencier - * - * @api - */ -class RequestContext -{ - private $baseUrl; - private $method; - private $host; - private $scheme; - private $httpPort; - private $httpsPort; - private $parameters; - - /** - * Constructor. - * - * @param string $baseUrl The base URL - * @param string $method The HTTP method - * @param string $host The HTTP host name - * @param string $scheme The HTTP scheme - * @param integer $httpPort The HTTP port - * @param integer $httpsPort The HTTPS port - * - * @api - */ - public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443) - { - $this->baseUrl = $baseUrl; - $this->method = strtoupper($method); - $this->host = $host; - $this->scheme = strtolower($scheme); - $this->httpPort = $httpPort; - $this->httpsPort = $httpsPort; - $this->parameters = array(); - } - - public function fromRequest(Request $request) - { - $this->setBaseUrl($request->getBaseUrl()); - $this->setMethod($request->getMethod()); - $this->setHost($request->getHost()); - $this->setScheme($request->getScheme()); - $this->setHttpPort($request->isSecure() ? $this->httpPort : $request->getPort()); - $this->setHttpsPort($request->isSecure() ? $request->getPort() : $this->httpsPort); - } - - /** - * Gets the base URL. - * - * @return string The base URL - */ - public function getBaseUrl() - { - return $this->baseUrl; - } - - /** - * Sets the base URL. - * - * @param string $baseUrl The base URL - * - * @api - */ - public function setBaseUrl($baseUrl) - { - $this->baseUrl = $baseUrl; - } - - /** - * Gets the HTTP method. - * - * The method is always an uppercased string. - * - * @return string The HTTP method - */ - public function getMethod() - { - return $this->method; - } - - /** - * Sets the HTTP method. - * - * @param string $method The HTTP method - * - * @api - */ - public function setMethod($method) - { - $this->method = strtoupper($method); - } - - /** - * Gets the HTTP host. - * - * @return string The HTTP host - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the HTTP host. - * - * @param string $host The HTTP host - * - * @api - */ - public function setHost($host) - { - $this->host = $host; - } - - /** - * Gets the HTTP scheme. - * - * @return string The HTTP scheme - */ - public function getScheme() - { - return $this->scheme; - } - - /** - * Sets the HTTP scheme. - * - * @param string $scheme The HTTP scheme - * - * @api - */ - public function setScheme($scheme) - { - $this->scheme = strtolower($scheme); - } - - /** - * Gets the HTTP port. - * - * @return string The HTTP port - */ - public function getHttpPort() - { - return $this->httpPort; - } - - /** - * Sets the HTTP port. - * - * @param string $httpPort The HTTP port - * - * @api - */ - public function setHttpPort($httpPort) - { - $this->httpPort = $httpPort; - } - - /** - * Gets the HTTPS port. - * - * @return string The HTTPS port - */ - public function getHttpsPort() - { - return $this->httpsPort; - } - - /** - * Sets the HTTPS port. - * - * @param string $httpsPort The HTTPS port - * - * @api - */ - public function setHttpsPort($httpsPort) - { - $this->httpsPort = $httpsPort; - } - - /** - * Returns the parameters. - * - * @return array The parameters - */ - public function getParameters() - { - return $this->parameters; - } - - /** - * Sets the parameters. - * - * This method implements a fluent interface. - * - * @param array $parameters The parameters - * - * @return Route The current Route instance - */ - public function setParameters(array $parameters) - { - $this->parameters = $parameters; - - return $this; - } - - /** - * Gets a parameter value. - * - * @param string $name A parameter name - * - * @return mixed The parameter value - */ - public function getParameter($name) - { - return isset($this->parameters[$name]) ? $this->parameters[$name] : null; - } - - /** - * Checks if a parameter value is set for the given parameter. - * - * @param string $name A parameter name - * - * @return Boolean true if the parameter value is set, false otherwise - */ - public function hasParameter($name) - { - return array_key_exists($name, $this->parameters); - } - - /** - * Sets a parameter value. - * - * @param string $name A parameter name - * @param mixed $parameter The parameter value - * - * @api - */ - public function setParameter($name, $parameter) - { - $this->parameters[$name] = $parameter; - } -} diff --git a/core/vendor/Symfony/Component/Routing/RequestContextAwareInterface.php b/core/vendor/Symfony/Component/Routing/RequestContextAwareInterface.php deleted file mode 100644 index 8357b52..0000000 --- a/core/vendor/Symfony/Component/Routing/RequestContextAwareInterface.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\Routing; - -/** - * @api - */ -interface RequestContextAwareInterface -{ - /** - * Sets the request context. - * - * @param RequestContext $context The context - * - * @api - */ - function setContext(RequestContext $context); - - /** - * Gets the request context. - * - * @return RequestContext The context - * - * @api - */ - function getContext(); -} diff --git a/core/vendor/Symfony/Component/Routing/Route.php b/core/vendor/Symfony/Component/Routing/Route.php deleted file mode 100644 index 02131f4..0000000 --- a/core/vendor/Symfony/Component/Routing/Route.php +++ /dev/null @@ -1,342 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * A Route describes a route and its parameters. - * - * @author Fabien Potencier - * - * @api - */ -class Route -{ - private $pattern; - private $defaults; - private $requirements; - private $options; - private $compiled; - - static private $compilers = array(); - - /** - * Constructor. - * - * Available options: - * - * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) - * - * @param string $pattern The pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @param array $options An array of options - * - * @api - */ - public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array()) - { - $this->setPattern($pattern); - $this->setDefaults($defaults); - $this->setRequirements($requirements); - $this->setOptions($options); - } - - public function __clone() - { - $this->compiled = null; - } - - /** - * Returns the pattern. - * - * @return string The pattern - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * Sets the pattern. - * - * This method implements a fluent interface. - * - * @param string $pattern The pattern - * - * @return Route The current Route instance - */ - public function setPattern($pattern) - { - $this->pattern = trim($pattern); - - // a route must start with a slash - if (empty($this->pattern) || '/' !== $this->pattern[0]) { - $this->pattern = '/'.$this->pattern; - } - - return $this; - } - - /** - * Returns the options. - * - * @return array The options - */ - public function getOptions() - { - return $this->options; - } - - /** - * Sets the options. - * - * This method implements a fluent interface. - * - * @param array $options The options - * - * @return Route The current Route instance - */ - public function setOptions(array $options) - { - $this->options = array_merge(array( - 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler', - ), $options); - - return $this; - } - - /** - * Sets an option value. - * - * This method implements a fluent interface. - * - * @param string $name An option name - * @param mixed $value The option value - * - * @return Route The current Route instance - * - * @api - */ - public function setOption($name, $value) - { - $this->options[$name] = $value; - - return $this; - } - - /** - * Get an option value. - * - * @param string $name An option name - * - * @return mixed The option value - */ - public function getOption($name) - { - return isset($this->options[$name]) ? $this->options[$name] : null; - } - - /** - * Returns the defaults. - * - * @return array The defaults - */ - public function getDefaults() - { - return $this->defaults; - } - - /** - * Sets the defaults. - * - * This method implements a fluent interface. - * - * @param array $defaults The defaults - * - * @return Route The current Route instance - */ - public function setDefaults(array $defaults) - { - $this->defaults = array(); - - return $this->addDefaults($defaults); - } - - /** - * Adds defaults. - * - * This method implements a fluent interface. - * - * @param array $defaults The defaults - * - * @return Route The current Route instance - */ - public function addDefaults(array $defaults) - { - foreach ($defaults as $name => $default) { - $this->defaults[(string) $name] = $default; - } - - return $this; - } - - /** - * Gets a default value. - * - * @param string $name A variable name - * - * @return mixed The default value - */ - public function getDefault($name) - { - return isset($this->defaults[$name]) ? $this->defaults[$name] : null; - } - - /** - * Checks if a default value is set for the given variable. - * - * @param string $name A variable name - * - * @return Boolean true if the default value is set, false otherwise - */ - public function hasDefault($name) - { - return array_key_exists($name, $this->defaults); - } - - /** - * Sets a default value. - * - * @param string $name A variable name - * @param mixed $default The default value - * - * @return Route The current Route instance - * - * @api - */ - public function setDefault($name, $default) - { - $this->defaults[(string) $name] = $default; - - return $this; - } - - /** - * Returns the requirements. - * - * @return array The requirements - */ - public function getRequirements() - { - return $this->requirements; - } - - /** - * Sets the requirements. - * - * This method implements a fluent interface. - * - * @param array $requirements The requirements - * - * @return Route The current Route instance - */ - public function setRequirements(array $requirements) - { - $this->requirements = array(); - - return $this->addRequirements($requirements); - } - - /** - * Adds requirements. - * - * This method implements a fluent interface. - * - * @param array $requirements The requirements - * - * @return Route The current Route instance - */ - public function addRequirements(array $requirements) - { - foreach ($requirements as $key => $regex) { - $this->requirements[$key] = $this->sanitizeRequirement($key, $regex); - } - - return $this; - } - - /** - * Returns the requirement for the given key. - * - * @param string $key The key - * - * @return string The regex - */ - public function getRequirement($key) - { - return isset($this->requirements[$key]) ? $this->requirements[$key] : null; - } - - /** - * Sets a requirement for the given key. - * - * @param string $key The key - * @param string $regex The regex - * - * @return Route The current Route instance - * - * @api - */ - public function setRequirement($key, $regex) - { - $this->requirements[$key] = $this->sanitizeRequirement($key, $regex); - - return $this; - } - - /** - * Compiles the route. - * - * @return CompiledRoute A CompiledRoute instance - */ - public function compile() - { - if (null !== $this->compiled) { - return $this->compiled; - } - - $class = $this->getOption('compiler_class'); - - if (!isset(self::$compilers[$class])) { - self::$compilers[$class] = new $class; - } - - return $this->compiled = self::$compilers[$class]->compile($this); - } - - private function sanitizeRequirement($key, $regex) - { - if (is_array($regex)) { - throw new \InvalidArgumentException(sprintf('Routing requirements must be a string, array given for "%s"', $key)); - } - - if ('^' == $regex[0]) { - $regex = substr($regex, 1); - } - - if ('$' == substr($regex, -1)) { - $regex = substr($regex, 0, -1); - } - - return $regex; - } -} diff --git a/core/vendor/Symfony/Component/Routing/RouteCollection.php b/core/vendor/Symfony/Component/Routing/RouteCollection.php deleted file mode 100644 index cc8fdc9..0000000 --- a/core/vendor/Symfony/Component/Routing/RouteCollection.php +++ /dev/null @@ -1,261 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * A RouteCollection represents a set of Route instances. - * - * When adding a route, it overrides existing routes with the - * same name defined in theinstance or its children and parents. - * - * @author Fabien Potencier - * - * @api - */ -class RouteCollection implements \IteratorAggregate -{ - private $routes; - private $resources; - private $prefix; - private $parent; - - /** - * Constructor. - * - * @api - */ - public function __construct() - { - $this->routes = array(); - $this->resources = array(); - $this->prefix = ''; - } - - public function __clone() - { - foreach ($this->routes as $name => $route) { - $this->routes[$name] = clone $route; - if ($route instanceof RouteCollection) { - $this->routes[$name]->setParent($this); - } - } - } - - /** - * Gets the parent RouteCollection. - * - * @return RouteCollection The parent RouteCollection - */ - public function getParent() - { - return $this->parent; - } - - /** - * Sets the parent RouteCollection. - * - * @param RouteCollection $parent The parent RouteCollection - */ - public function setParent(RouteCollection $parent) - { - $this->parent = $parent; - } - - /** - * Gets the current RouteCollection as an Iterator. - * - * @return \ArrayIterator An \ArrayIterator interface - */ - public function getIterator() - { - return new \ArrayIterator($this->routes); - } - - /** - * Adds a route. - * - * @param string $name The route name - * @param Route $route A Route instance - * - * @throws \InvalidArgumentException When route name contains non valid characters - * - * @api - */ - public function add($name, Route $route) - { - if (!preg_match('/^[a-z0-9A-Z_.]+$/', $name)) { - throw new \InvalidArgumentException(sprintf('Name "%s" contains non valid characters for a route name.', $name)); - } - - $parent = $this; - while ($parent->getParent()) { - $parent = $parent->getParent(); - } - - if ($parent) { - $parent->remove($name); - } - - $this->routes[$name] = $route; - } - - /** - * Returns the array of routes. - * - * @return array An array of routes - */ - public function all() - { - $routes = array(); - foreach ($this->routes as $name => $route) { - if ($route instanceof RouteCollection) { - $routes = array_merge($routes, $route->all()); - } else { - $routes[$name] = $route; - } - } - - return $routes; - } - - /** - * Gets a route by name. - * - * @param string $name The route name - * - * @return Route $route A Route instance - */ - public function get($name) - { - // get the latest defined route - foreach (array_reverse($this->routes) as $routes) { - if (!$routes instanceof RouteCollection) { - continue; - } - - if (null !== $route = $routes->get($name)) { - return $route; - } - } - - if (isset($this->routes[$name])) { - return $this->routes[$name]; - } - } - - /** - * Removes a route by name. - * - * @param string $name The route name - */ - public function remove($name) - { - if (isset($this->routes[$name])) { - unset($this->routes[$name]); - } - - foreach ($this->routes as $routes) { - if ($routes instanceof RouteCollection) { - $routes->remove($name); - } - } - } - - /** - * Adds a route collection to the current set of routes (at the end of the current set). - * - * @param RouteCollection $collection A RouteCollection instance - * @param string $prefix An optional prefix to add before each pattern of the route collection - * @param array $defaults An array of default values - * @param array $requirements An array of requirements - * - * @api - */ - public function addCollection(RouteCollection $collection, $prefix = '', $defaults = array(), $requirements = array()) - { - $collection->setParent($this); - $collection->addPrefix($prefix, $defaults, $requirements); - - // remove all routes with the same name in all existing collections - foreach (array_keys($collection->all()) as $name) { - $this->remove($name); - } - - $this->routes[] = $collection; - } - - /** - * Adds a prefix to all routes in the current set. - * - * @param string $prefix An optional prefix to add before each pattern of the route collection - * @param array $defaults An array of default values - * @param array $requirements An array of requirements - * - * @api - */ - public function addPrefix($prefix, $defaults = array(), $requirements = array()) - { - // a prefix must not end with a slash - $prefix = rtrim($prefix, '/'); - - // a prefix must start with a slash - if ($prefix && '/' !== $prefix[0]) { - $prefix = '/'.$prefix; - } - - $this->prefix = $prefix.$this->prefix; - - foreach ($this->routes as $name => $route) { - if ($route instanceof RouteCollection) { - $route->addPrefix($prefix, $defaults, $requirements); - } else { - $route->setPattern($prefix.$route->getPattern()); - $route->addDefaults($defaults); - $route->addRequirements($requirements); - } - } - } - - public function getPrefix() - { - return $this->prefix; - } - - /** - * Returns an array of resources loaded to build this collection. - * - * @return ResourceInterface[] An array of resources - */ - public function getResources() - { - $resources = $this->resources; - foreach ($this as $routes) { - if ($routes instanceof RouteCollection) { - $resources = array_merge($resources, $routes->getResources()); - } - } - - return array_unique($resources); - } - - /** - * Adds a resource for this collection. - * - * @param ResourceInterface $resource A resource instance - */ - public function addResource(ResourceInterface $resource) - { - $this->resources[] = $resource; - } -} diff --git a/core/vendor/Symfony/Component/Routing/RouteCompiler.php b/core/vendor/Symfony/Component/Routing/RouteCompiler.php deleted file mode 100644 index a09b016..0000000 --- a/core/vendor/Symfony/Component/Routing/RouteCompiler.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * RouteCompiler compiles Route instances to CompiledRoute instances. - * - * @author Fabien Potencier - */ -class RouteCompiler implements RouteCompilerInterface -{ - /** - * Compiles the current route instance. - * - * @param Route $route A Route instance - * - * @return CompiledRoute A CompiledRoute instance - */ - public function compile(Route $route) - { - $pattern = $route->getPattern(); - $len = strlen($pattern); - $tokens = array(); - $variables = array(); - $pos = 0; - preg_match_all('#.\{([\w\d_]+)\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); - foreach ($matches as $match) { - if ($text = substr($pattern, $pos, $match[0][1] - $pos)) { - $tokens[] = array('text', $text); - } - $seps = array($pattern[$pos]); - $pos = $match[0][1] + strlen($match[0][0]); - $var = $match[1][0]; - - if ($req = $route->getRequirement($var)) { - $regexp = $req; - } else { - if ($pos !== $len) { - $seps[] = $pattern[$pos]; - } - $regexp = sprintf('[^%s]+?', preg_quote(implode('', array_unique($seps)), '#')); - } - - $tokens[] = array('variable', $match[0][0][0], $regexp, $var); - $variables[] = $var; - } - - if ($pos < $len) { - $tokens[] = array('text', substr($pattern, $pos)); - } - - // find the first optional token - $firstOptional = INF; - for ($i = count($tokens) - 1; $i >= 0; $i--) { - if ('variable' === $tokens[$i][0] && $route->hasDefault($tokens[$i][3])) { - $firstOptional = $i; - } else { - break; - } - } - - // compute the matching regexp - $regex = ''; - $indent = 1; - if (1 === count($tokens) && 0 === $firstOptional) { - $token = $tokens[0]; - ++$indent; - $regex .= str_repeat(' ', $indent * 4).sprintf("%s(?:\n", preg_quote($token[1], '#')); - $regex .= str_repeat(' ', $indent * 4).sprintf("(?P<%s>%s)\n", $token[3], $token[2]); - } else { - foreach ($tokens as $i => $token) { - if ('text' === $token[0]) { - $regex .= str_repeat(' ', $indent * 4).preg_quote($token[1], '#')."\n"; - } else { - if ($i >= $firstOptional) { - $regex .= str_repeat(' ', $indent * 4)."(?:\n"; - ++$indent; - } - $regex .= str_repeat(' ', $indent * 4).sprintf("%s(?P<%s>%s)\n", preg_quote($token[1], '#'), $token[3], $token[2]); - } - } - } - while (--$indent) { - $regex .= str_repeat(' ', $indent * 4).")?\n"; - } - - return new CompiledRoute( - $route, - 'text' === $tokens[0][0] ? $tokens[0][1] : '', - sprintf("#^\n%s$#xs", $regex), - array_reverse($tokens), - $variables - ); - } -} diff --git a/core/vendor/Symfony/Component/Routing/RouteCompilerInterface.php b/core/vendor/Symfony/Component/Routing/RouteCompilerInterface.php deleted file mode 100644 index e0ad86b..0000000 --- a/core/vendor/Symfony/Component/Routing/RouteCompilerInterface.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\Routing; - -/** - * RouteCompilerInterface is the interface that all RouteCompiler classes must implements. - * - * @author Fabien Potencier - */ -interface RouteCompilerInterface -{ - /** - * Compiles the current route instance. - * - * @param Route $route A Route instance - * - * @return CompiledRoute A CompiledRoute instance - */ - function compile(Route $route); -} diff --git a/core/vendor/Symfony/Component/Routing/Router.php b/core/vendor/Symfony/Component/Routing/Router.php deleted file mode 100644 index a1e0c89..0000000 --- a/core/vendor/Symfony/Component/Routing/Router.php +++ /dev/null @@ -1,263 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\ConfigCache; - -/** - * The Router class is an example of the integration of all pieces of the - * routing system for easier use. - * - * @author Fabien Potencier - */ -class Router implements RouterInterface -{ - protected $matcher; - protected $generator; - protected $defaults; - protected $context; - protected $loader; - protected $collection; - protected $resource; - protected $options; - - /** - * Constructor. - * - * @param LoaderInterface $loader A LoaderInterface instance - * @param mixed $resource The main resource to load - * @param array $options An array of options - * @param RequestContext $context The context - * @param array $defaults The default values - */ - public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, array $defaults = array()) - { - $this->loader = $loader; - $this->resource = $resource; - $this->context = null === $context ? new RequestContext() : $context; - $this->defaults = $defaults; - $this->setOptions($options); - } - - /** - * Sets options. - * - * Available options: - * - * * cache_dir: The cache directory (or null to disable caching) - * * debug: Whether to enable debugging or not (false by default) - * * resource_type: Type hint for the main resource (optional) - * - * @param array $options An array of options - * - * @throws \InvalidArgumentException When unsupported option is provided - */ - public function setOptions(array $options) - { - $this->options = array( - 'cache_dir' => null, - 'debug' => false, - 'generator_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - 'generator_base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - 'generator_dumper_class' => 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper', - 'generator_cache_class' => 'ProjectUrlGenerator', - 'matcher_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - 'matcher_base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - 'matcher_dumper_class' => 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper', - 'matcher_cache_class' => 'ProjectUrlMatcher', - 'resource_type' => null, - ); - - // check option names and live merge, if errors are encountered Exception will be thrown - $invalid = array(); - $isInvalid = false; - foreach ($options as $key => $value) { - if (array_key_exists($key, $this->options)) { - $this->options[$key] = $value; - } else { - $isInvalid = true; - $invalid[] = $key; - } - } - - if ($isInvalid) { - throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('\', \'', $invalid))); - } - } - - /** - * Sets an option. - * - * @param string $key The key - * @param mixed $value The value - * - * @throws \InvalidArgumentException - */ - public function setOption($key, $value) - { - if (!array_key_exists($key, $this->options)) { - throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key)); - } - - $this->options[$key] = $value; - } - - /** - * Gets an option value. - * - * @param string $key The key - * - * @return mixed The value - * - * @throws \InvalidArgumentException - */ - public function getOption($key) - { - if (!array_key_exists($key, $this->options)) { - throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key)); - } - - return $this->options[$key]; - } - - /** - * Gets the RouteCollection instance associated with this Router. - * - * @return RouteCollection A RouteCollection instance - */ - public function getRouteCollection() - { - if (null === $this->collection) { - $this->collection = $this->loader->load($this->resource, $this->options['resource_type']); - } - - return $this->collection; - } - - /** - * Sets the request context. - * - * @param RequestContext $context The context - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - - $this->getMatcher()->setContext($context); - $this->getGenerator()->setContext($context); - } - - /** - * Gets the request context. - * - * @return RequestContext The context - */ - public function getContext() - { - return $this->context; - } - - /** - * Generates a URL from the given parameters. - * - * @param string $name The name of the route - * @param mixed $parameters An array of parameters - * @param Boolean $absolute Whether to generate an absolute URL - * - * @return string The generated URL - */ - public function generate($name, $parameters = array(), $absolute = false) - { - return $this->getGenerator()->generate($name, $parameters, $absolute); - } - - /** - * Tries to match a URL with a set of routes. - * - * Returns false if no route matches the URL. - * - * @param string $url URL to be parsed - * - * @return array|false An array of parameters or false if no route matches - */ - public function match($url) - { - return $this->getMatcher()->match($url); - } - - /** - * Gets the UrlMatcher instance associated with this Router. - * - * @return UrlMatcherInterface A UrlMatcherInterface instance - */ - public function getMatcher() - { - if (null !== $this->matcher) { - return $this->matcher; - } - - if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) { - return $this->matcher = new $this->options['matcher_class']($this->getRouteCollection(), $this->context, $this->defaults); - } - - $class = $this->options['matcher_cache_class']; - $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']); - if (!$cache->isFresh($class)) { - $dumper = new $this->options['matcher_dumper_class']($this->getRouteCollection()); - - $options = array( - 'class' => $class, - 'base_class' => $this->options['matcher_base_class'], - ); - - $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources()); - } - - require_once $cache; - - return $this->matcher = new $class($this->context, $this->defaults); - } - - /** - * Gets the UrlGenerator instance associated with this Router. - * - * @return UrlGeneratorInterface A UrlGeneratorInterface instance - */ - public function getGenerator() - { - if (null !== $this->generator) { - return $this->generator; - } - - if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) { - return $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->defaults); - } - - $class = $this->options['generator_cache_class']; - $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']); - if (!$cache->isFresh($class)) { - $dumper = new $this->options['generator_dumper_class']($this->getRouteCollection()); - - $options = array( - 'class' => $class, - 'base_class' => $this->options['generator_base_class'], - ); - - $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources()); - } - - require_once $cache; - - return $this->generator = new $class($this->context, $this->defaults); - } -} diff --git a/core/vendor/Symfony/Component/Routing/RouterInterface.php b/core/vendor/Symfony/Component/Routing/RouterInterface.php deleted file mode 100644 index 8591af8..0000000 --- a/core/vendor/Symfony/Component/Routing/RouterInterface.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\Routing; - -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; - -/** - * RouterInterface is the interface that all Router classes must implements. - * - * This interface is the concatenation of UrlMatcherInterface and UrlGeneratorInterface. - * - * @author Fabien Potencier - */ -interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface -{ - /** - * Gets the RouteCollection instance associated with this Router. - * - * @return RouteCollection A RouteCollection instance - */ - function getRouteCollection(); -} diff --git a/core/vendor/Symfony/Component/Routing/composer.json b/core/vendor/Symfony/Component/Routing/composer.json deleted file mode 100644 index a3b5e88..0000000 --- a/core/vendor/Symfony/Component/Routing/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "symfony/routing", - "type": "library", - "description": "Symfony Routing Component", - "keywords": [], - "homepage": "http://symfony.com", - "version": "2.1.0", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.2" - }, - "suggest": { - "symfony/config": "self.version", - "symfony/yaml": "self.version" - }, - "autoload": { - "psr-0": { "Symfony\\Component\\Routing": "" } - }, - "target-dir": "Symfony/Component/Routing" -} diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher new file mode 160000 index 0000000..f6b7f60 --- /dev/null +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher @@ -0,0 +1 @@ +Subproject commit f6b7f60b0c29ab8167de7d7c9ba78fc9cc283c64 diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation new file mode 160000 index 0000000..2abe7f1 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation @@ -0,0 +1 @@ +Subproject commit 2abe7f1b8e0f808dad0cc001b9d69371b604d719 diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel new file mode 160000 index 0000000..cf2bb86 --- /dev/null +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel @@ -0,0 +1 @@ +Subproject commit cf2bb8655a13fcb516b1d0b95ddf0c51db25b2a8 diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing b/core/vendor/symfony/routing/Symfony/Component/Routing new file mode 160000 index 0000000..d3d9c02 --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing @@ -0,0 +1 @@ +Subproject commit d3d9c02357b2db6503539d11f6c379ccd86f9cc4