- */
-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
- */
- public function guess($path);
-}
diff --git a/assets/php/vendor/symfony/http-foundation/File/Stream.php b/assets/php/vendor/symfony/http-foundation/File/Stream.php
deleted file mode 100755
index 69ae74c..0000000
--- a/assets/php/vendor/symfony/http-foundation/File/Stream.php
+++ /dev/null
@@ -1,28 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\File;
-
-/**
- * A PHP stream of unknown size.
- *
- * @author Nicolas Grekas
- */
-class Stream extends File
-{
- /**
- * {@inheritdoc}
- */
- public function getSize()
- {
- return false;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/File/UploadedFile.php b/assets/php/vendor/symfony/http-foundation/File/UploadedFile.php
deleted file mode 100755
index 082d8d5..0000000
--- a/assets/php/vendor/symfony/http-foundation/File/UploadedFile.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\File;
-
-use Symfony\Component\HttpFoundation\File\Exception\FileException;
-use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
-use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
-
-/**
- * A file uploaded through a form.
- *
- * @author Bernhard Schussek
- * @author Florian Eckerstorfer
- * @author Fabien Potencier
- */
-class UploadedFile extends File
-{
- private $test = false;
- private $originalName;
- private $mimeType;
- private $size;
- 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 of the uploaded file
- * @param string|null $mimeType The type of the file as provided by PHP; null defaults to application/octet-stream
- * @param int|null $size The file size provided by the uploader
- * @param int|null $error The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constants); null defaults to UPLOAD_ERR_OK
- * @param bool $test Whether the test mode is active
- * Local files are used in test mode hence the code should not enforce HTTP uploads
- *
- * @throws FileException If file_uploads is disabled
- * @throws FileNotFoundException If the file does not exist
- */
- public function __construct($path, $originalName, $mimeType = null, $size = null, $error = null, $test = false)
- {
- $this->originalName = $this->getName($originalName);
- $this->mimeType = $mimeType ?: 'application/octet-stream';
- $this->size = $size;
- $this->error = $error ?: UPLOAD_ERR_OK;
- $this->test = (bool) $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 it should not be considered as a safe value.
- *
- * @return string|null The original name
- */
- public function getClientOriginalName()
- {
- return $this->originalName;
- }
-
- /**
- * Returns the original file extension.
- *
- * It is extracted from the original file name that was uploaded.
- * Then it should not be considered as a safe value.
- *
- * @return string The extension
- */
- public function getClientOriginalExtension()
- {
- return pathinfo($this->originalName, PATHINFO_EXTENSION);
- }
-
- /**
- * Returns the file mime type.
- *
- * The client mime type is extracted from the request from which the file
- * was uploaded, so it should not be considered as a safe value.
- *
- * For a trusted mime type, use getMimeType() instead (which guesses the mime
- * type based on the file content).
- *
- * @return string|null The mime type
- *
- * @see getMimeType()
- */
- public function getClientMimeType()
- {
- return $this->mimeType;
- }
-
- /**
- * Returns the extension based on the client mime type.
- *
- * If the mime type is unknown, returns null.
- *
- * This method uses the mime type as guessed by getClientMimeType()
- * to guess the file extension. As such, the extension returned
- * by this method cannot be trusted.
- *
- * For a trusted extension, use guessExtension() instead (which guesses
- * the extension based on the guessed mime type for the file).
- *
- * @return string|null The guessed extension or null if it cannot be guessed
- *
- * @see guessExtension()
- * @see getClientMimeType()
- */
- public function guessClientExtension()
- {
- $type = $this->getClientMimeType();
- $guesser = ExtensionGuesser::getInstance();
-
- return $guesser->guess($type);
- }
-
- /**
- * Returns the file size.
- *
- * It is extracted from the request from which the file has been uploaded.
- * Then it should not be considered as a safe value.
- *
- * @return int|null The file size
- */
- 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 int The upload error
- */
- public function getError()
- {
- return $this->error;
- }
-
- /**
- * Returns whether the file was uploaded successfully.
- *
- * @return bool True if the file has been uploaded with HTTP and no error occurred
- */
- public function isValid()
- {
- $isOk = UPLOAD_ERR_OK === $this->error;
-
- return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname());
- }
-
- /**
- * 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, for any reason, the file could not have been moved
- */
- public function move($directory, $name = null)
- {
- if ($this->isValid()) {
- if ($this->test) {
- return parent::move($directory, $name);
- }
-
- $target = $this->getTargetFile($directory, $name);
-
- if (!@move_uploaded_file($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 & ~umask());
-
- return $target;
- }
-
- throw new FileException($this->getErrorMessage());
- }
-
- /**
- * Returns the maximum size of an uploaded file as configured in php.ini.
- *
- * @return int The maximum size of an uploaded file in bytes
- */
- public static function getMaxFilesize()
- {
- $iniMax = strtolower(ini_get('upload_max_filesize'));
-
- if ('' === $iniMax) {
- return PHP_INT_MAX;
- }
-
- $max = ltrim($iniMax, '+');
- if (0 === strpos($max, '0x')) {
- $max = intval($max, 16);
- } elseif (0 === strpos($max, '0')) {
- $max = intval($max, 8);
- } else {
- $max = (int) $max;
- }
-
- switch (substr($iniMax, -1)) {
- case 't': $max *= 1024;
- // no break
- case 'g': $max *= 1024;
- // no break
- case 'm': $max *= 1024;
- // no break
- case 'k': $max *= 1024;
- }
-
- return $max;
- }
-
- /**
- * Returns an informative upload error message.
- *
- * @return string The error message regarding the specified error code
- */
- public function getErrorMessage()
- {
- static $errors = array(
- UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
- UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
- UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
- UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
- UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
- UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
- UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
- );
-
- $errorCode = $this->error;
- $maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
- $message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.';
-
- return sprintf($message, $this->getClientOriginalName(), $maxFilesize);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/FileBag.php b/assets/php/vendor/symfony/http-foundation/FileBag.php
deleted file mode 100755
index 5edd0e6..0000000
--- a/assets/php/vendor/symfony/http-foundation/FileBag.php
+++ /dev/null
@@ -1,144 +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 uploaded files.
- *
- * @author Fabien Potencier
- * @author Bulat Shakirzyanov
- */
-class FileBag extends ParameterBag
-{
- private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type');
-
- /**
- * @param array $parameters An array of HTTP files
- */
- public function __construct(array $parameters = array())
- {
- $this->replace($parameters);
- }
-
- /**
- * {@inheritdoc}
- */
- public function replace(array $files = array())
- {
- $this->parameters = array();
- $this->add($files);
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($key, $value)
- {
- if (!is_array($value) && !$value instanceof UploadedFile) {
- throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.');
- }
-
- parent::set($key, $this->convertFileInformation($value));
- }
-
- /**
- * {@inheritdoc}
- */
- 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 UploadedFile[]|UploadedFile|null 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);
- if (array_keys($keys) === $keys) {
- $file = array_filter($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.
- *
- * @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 ($data['name'] as $key => $name) {
- $files[$key] = $this->fixPhpFilesArray(array(
- 'error' => $data['error'][$key],
- 'name' => $name,
- 'type' => $data['type'][$key],
- 'tmp_name' => $data['tmp_name'][$key],
- 'size' => $data['size'][$key],
- ));
- }
-
- return $files;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/HeaderBag.php b/assets/php/vendor/symfony/http-foundation/HeaderBag.php
deleted file mode 100755
index 7aaa52a..0000000
--- a/assets/php/vendor/symfony/http-foundation/HeaderBag.php
+++ /dev/null
@@ -1,331 +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
- */
-class HeaderBag implements \IteratorAggregate, \Countable
-{
- protected $headers = array();
- protected $cacheControl = array();
-
- /**
- * @param array $headers An array of HTTP headers
- */
- public function __construct(array $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 (!$headers = $this->all()) {
- return '';
- }
-
- ksort($headers);
- $max = max(array_map('strlen', array_keys($headers))) + 1;
- $content = '';
- foreach ($headers as $name => $values) {
- $name = implode('-', array_map('ucfirst', explode('-', $name)));
- foreach ($values as $value) {
- $content .= sprintf("%-{$max}s %s\r\n", $name.':', $value);
- }
- }
-
- return $content;
- }
-
- /**
- * Returns the headers.
- *
- * @return array An array of headers
- */
- public function all()
- {
- return $this->headers;
- }
-
- /**
- * Returns the parameter keys.
- *
- * @return array An array of parameter keys
- */
- public function keys()
- {
- return array_keys($this->all());
- }
-
- /**
- * Replaces the current HTTP headers by a new set.
- *
- * @param array $headers An array of HTTP headers
- */
- 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
- */
- 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 string|string[] $default The default value
- * @param bool $first Whether to return the first value or all header values
- *
- * @return string|string[] The first header value or default value if $first is true, an array of values otherwise
- */
- public function get($key, $default = null, $first = true)
- {
- $key = str_replace('_', '-', strtolower($key));
- $headers = $this->all();
-
- if (!array_key_exists($key, $headers)) {
- if (null === $default) {
- return $first ? null : array();
- }
-
- return $first ? $default : array($default);
- }
-
- if ($first) {
- return \count($headers[$key]) ? $headers[$key][0] : $default;
- }
-
- return $headers[$key];
- }
-
- /**
- * Sets a header by name.
- *
- * @param string $key The key
- * @param string|string[] $values The value or an array of values
- * @param bool $replace Whether to replace the actual value or not (true by default)
- */
- public function set($key, $values, $replace = true)
- {
- $key = str_replace('_', '-', strtolower($key));
-
- if (\is_array($values)) {
- $values = array_values($values);
-
- if (true === $replace || !isset($this->headers[$key])) {
- $this->headers[$key] = $values;
- } else {
- $this->headers[$key] = array_merge($this->headers[$key], $values);
- }
- } else {
- if (true === $replace || !isset($this->headers[$key])) {
- $this->headers[$key] = array($values);
- } else {
- $this->headers[$key][] = $values;
- }
- }
-
- if ('cache-control' === $key) {
- $this->cacheControl = $this->parseCacheControl(implode(', ', $this->headers[$key]));
- }
- }
-
- /**
- * Returns true if the HTTP header is defined.
- *
- * @param string $key The HTTP header
- *
- * @return bool true if the parameter exists, false otherwise
- */
- public function has($key)
- {
- return array_key_exists(str_replace('_', '-', strtolower($key)), $this->all());
- }
-
- /**
- * 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 bool true if the value is contained in the header, false otherwise
- */
- public function contains($key, $value)
- {
- return in_array($value, $this->get($key, null, false));
- }
-
- /**
- * Removes a header.
- *
- * @param string $key The HTTP header name
- */
- public function remove($key)
- {
- $key = str_replace('_', '-', 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 null|\DateTime The parsed DateTime or the default value if the header does not exist
- *
- * @throws \RuntimeException When the HTTP header is not parseable
- */
- 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;
- }
-
- /**
- * Adds a custom Cache-Control directive.
- *
- * @param string $key The Cache-Control directive name
- * @param mixed $value The Cache-Control directive value
- */
- public function addCacheControlDirective($key, $value = true)
- {
- $this->cacheControl[$key] = $value;
-
- $this->set('Cache-Control', $this->getCacheControlHeader());
- }
-
- /**
- * Returns true if the Cache-Control directive is defined.
- *
- * @param string $key The Cache-Control directive
- *
- * @return bool true if the directive exists, false otherwise
- */
- public function hasCacheControlDirective($key)
- {
- return array_key_exists($key, $this->cacheControl);
- }
-
- /**
- * Returns a Cache-Control directive value by name.
- *
- * @param string $key The directive name
- *
- * @return mixed|null The directive value if defined, null otherwise
- */
- public function getCacheControlDirective($key)
- {
- return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null;
- }
-
- /**
- * Removes a Cache-Control directive.
- *
- * @param string $key The Cache-Control directive
- */
- public function removeCacheControlDirective($key)
- {
- unset($this->cacheControl[$key]);
-
- $this->set('Cache-Control', $this->getCacheControlHeader());
- }
-
- /**
- * Returns an iterator for headers.
- *
- * @return \ArrayIterator An \ArrayIterator instance
- */
- public function getIterator()
- {
- return new \ArrayIterator($this->headers);
- }
-
- /**
- * Returns the number of headers.
- *
- * @return int The number of headers
- */
- public function count()
- {
- return count($this->headers);
- }
-
- 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[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true);
- }
-
- return $cacheControl;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/IpUtils.php b/assets/php/vendor/symfony/http-foundation/IpUtils.php
deleted file mode 100755
index 86d135b..0000000
--- a/assets/php/vendor/symfony/http-foundation/IpUtils.php
+++ /dev/null
@@ -1,156 +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;
-
-/**
- * Http utility functions.
- *
- * @author Fabien Potencier
- */
-class IpUtils
-{
- private static $checkedIps = array();
-
- /**
- * This class should not be instantiated.
- */
- private function __construct()
- {
- }
-
- /**
- * Checks if an IPv4 or IPv6 address is contained in the list of given IPs or subnets.
- *
- * @param string $requestIp IP to check
- * @param string|array $ips List of IPs or subnets (can be a string if only a single one)
- *
- * @return bool Whether the IP is valid
- */
- public static function checkIp($requestIp, $ips)
- {
- if (!is_array($ips)) {
- $ips = array($ips);
- }
-
- $method = substr_count($requestIp, ':') > 1 ? 'checkIp6' : 'checkIp4';
-
- foreach ($ips as $ip) {
- if (self::$method($requestIp, $ip)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Compares two IPv4 addresses.
- * In case a subnet is given, it checks if it contains the request IP.
- *
- * @param string $requestIp IPv4 address to check
- * @param string $ip IPv4 address or subnet in CIDR notation
- *
- * @return bool Whether the request IP matches the IP, or whether the request IP is within the CIDR subnet
- */
- public static function checkIp4($requestIp, $ip)
- {
- $cacheKey = $requestIp.'-'.$ip;
- if (isset(self::$checkedIps[$cacheKey])) {
- return self::$checkedIps[$cacheKey];
- }
-
- if (!filter_var($requestIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
- return self::$checkedIps[$cacheKey] = false;
- }
-
- if (false !== strpos($ip, '/')) {
- list($address, $netmask) = explode('/', $ip, 2);
-
- if ('0' === $netmask) {
- return self::$checkedIps[$cacheKey] = filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
- }
-
- if ($netmask < 0 || $netmask > 32) {
- return self::$checkedIps[$cacheKey] = false;
- }
- } else {
- $address = $ip;
- $netmask = 32;
- }
-
- if (false === ip2long($address)) {
- return self::$checkedIps[$cacheKey] = false;
- }
-
- return self::$checkedIps[$cacheKey] = 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask);
- }
-
- /**
- * Compares two IPv6 addresses.
- * In case a subnet is given, it checks if it contains the request IP.
- *
- * @author David Soria Parra
- *
- * @see https://github.com/dsp/v6tools
- *
- * @param string $requestIp IPv6 address to check
- * @param string $ip IPv6 address or subnet in CIDR notation
- *
- * @return bool Whether the IP is valid
- *
- * @throws \RuntimeException When IPV6 support is not enabled
- */
- public static function checkIp6($requestIp, $ip)
- {
- $cacheKey = $requestIp.'-'.$ip;
- if (isset(self::$checkedIps[$cacheKey])) {
- return self::$checkedIps[$cacheKey];
- }
-
- if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) {
- throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".');
- }
-
- if (false !== strpos($ip, '/')) {
- list($address, $netmask) = explode('/', $ip, 2);
-
- if ('0' === $netmask) {
- return (bool) unpack('n*', @inet_pton($address));
- }
-
- if ($netmask < 1 || $netmask > 128) {
- return self::$checkedIps[$cacheKey] = false;
- }
- } else {
- $address = $ip;
- $netmask = 128;
- }
-
- $bytesAddr = unpack('n*', @inet_pton($address));
- $bytesTest = unpack('n*', @inet_pton($requestIp));
-
- if (!$bytesAddr || !$bytesTest) {
- return self::$checkedIps[$cacheKey] = false;
- }
-
- 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 (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) {
- return self::$checkedIps[$cacheKey] = false;
- }
- }
-
- return self::$checkedIps[$cacheKey] = true;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/JsonResponse.php b/assets/php/vendor/symfony/http-foundation/JsonResponse.php
deleted file mode 100755
index 137ac33..0000000
--- a/assets/php/vendor/symfony/http-foundation/JsonResponse.php
+++ /dev/null
@@ -1,220 +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 in JSON format.
- *
- * Note that this class does not force the returned JSON content to be an
- * object. It is however recommended that you do return an object as it
- * protects yourself against XSSI and JSON-JavaScript Hijacking.
- *
- * @see https://www.owasp.org/index.php/OWASP_AJAX_Security_Guidelines#Always_return_JSON_with_an_Object_on_the_outside
- *
- * @author Igor Wiedler
- */
-class JsonResponse extends Response
-{
- protected $data;
- protected $callback;
-
- // Encode <, >, ', &, and " characters in the JSON, making it also safe to be embedded into HTML.
- // 15 === JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT
- const DEFAULT_ENCODING_OPTIONS = 15;
-
- protected $encodingOptions = self::DEFAULT_ENCODING_OPTIONS;
-
- /**
- * @param mixed $data The response data
- * @param int $status The response status code
- * @param array $headers An array of response headers
- * @param bool $json If the data is already a JSON string
- */
- public function __construct($data = null, $status = 200, $headers = array(), $json = false)
- {
- parent::__construct('', $status, $headers);
-
- if (null === $data) {
- $data = new \ArrayObject();
- }
-
- $json ? $this->setJson($data) : $this->setData($data);
- }
-
- /**
- * Factory method for chainability.
- *
- * Example:
- *
- * return JsonResponse::create($data, 200)
- * ->setSharedMaxAge(300);
- *
- * @param mixed $data The json response data
- * @param int $status The response status code
- * @param array $headers An array of response headers
- *
- * @return static
- */
- public static function create($data = null, $status = 200, $headers = array())
- {
- return new static($data, $status, $headers);
- }
-
- /**
- * Make easier the creation of JsonResponse from raw json.
- */
- public static function fromJsonString($data = null, $status = 200, $headers = array())
- {
- return new static($data, $status, $headers, true);
- }
-
- /**
- * Sets the JSONP callback.
- *
- * @param string|null $callback The JSONP callback or null to use none
- *
- * @return $this
- *
- * @throws \InvalidArgumentException When the callback name is not valid
- */
- public function setCallback($callback = null)
- {
- if (null !== $callback) {
- // partially taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
- // partially taken from https://github.com/willdurand/JsonpCallbackValidator
- // JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details.
- // (c) William Durand
- $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u';
- $reserved = array(
- 'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while',
- 'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super', 'const', 'export',
- 'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false',
- );
- $parts = explode('.', $callback);
- foreach ($parts as $part) {
- if (!preg_match($pattern, $part) || in_array($part, $reserved, true)) {
- throw new \InvalidArgumentException('The callback name is not valid.');
- }
- }
- }
-
- $this->callback = $callback;
-
- return $this->update();
- }
-
- /**
- * Sets a raw string containing a JSON document to be sent.
- *
- * @param string $json
- *
- * @return $this
- *
- * @throws \InvalidArgumentException
- */
- public function setJson($json)
- {
- $this->data = $json;
-
- return $this->update();
- }
-
- /**
- * Sets the data to be sent as JSON.
- *
- * @param mixed $data
- *
- * @return $this
- *
- * @throws \InvalidArgumentException
- */
- public function setData($data = array())
- {
- if (defined('HHVM_VERSION')) {
- // HHVM does not trigger any warnings and let exceptions
- // thrown from a JsonSerializable object pass through.
- // If only PHP did the same...
- $data = json_encode($data, $this->encodingOptions);
- } else {
- if (!interface_exists('JsonSerializable', false)) {
- set_error_handler(function () { return false; });
- try {
- $data = @json_encode($data, $this->encodingOptions);
- } finally {
- restore_error_handler();
- }
- } else {
- try {
- $data = json_encode($data, $this->encodingOptions);
- } catch (\Exception $e) {
- if ('Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
- throw $e->getPrevious() ?: $e;
- }
- throw $e;
- }
- }
- }
-
- if (JSON_ERROR_NONE !== json_last_error()) {
- throw new \InvalidArgumentException(json_last_error_msg());
- }
-
- return $this->setJson($data);
- }
-
- /**
- * Returns options used while encoding data to JSON.
- *
- * @return int
- */
- public function getEncodingOptions()
- {
- return $this->encodingOptions;
- }
-
- /**
- * Sets options used while encoding data to JSON.
- *
- * @param int $encodingOptions
- *
- * @return $this
- */
- public function setEncodingOptions($encodingOptions)
- {
- $this->encodingOptions = (int) $encodingOptions;
-
- return $this->setData(json_decode($this->data));
- }
-
- /**
- * Updates the content and headers according to the JSON data and callback.
- *
- * @return $this
- */
- protected function update()
- {
- if (null !== $this->callback) {
- // Not using application/javascript for compatibility reasons with older browsers.
- $this->headers->set('Content-Type', 'text/javascript');
-
- return $this->setContent(sprintf('/**/%s(%s);', $this->callback, $this->data));
- }
-
- // Only set the header when there is none or when it equals 'text/javascript' (from a previous update with callback)
- // in order to not overwrite a custom definition.
- if (!$this->headers->has('Content-Type') || 'text/javascript' === $this->headers->get('Content-Type')) {
- $this->headers->set('Content-Type', 'application/json');
- }
-
- return $this->setContent($this->data);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/LICENSE b/assets/php/vendor/symfony/http-foundation/LICENSE
deleted file mode 100755
index 21d7fb9..0000000
--- a/assets/php/vendor/symfony/http-foundation/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2004-2018 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/assets/php/vendor/symfony/http-foundation/ParameterBag.php b/assets/php/vendor/symfony/http-foundation/ParameterBag.php
deleted file mode 100755
index 257ef8b..0000000
--- a/assets/php/vendor/symfony/http-foundation/ParameterBag.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\HttpFoundation;
-
-/**
- * ParameterBag is a container for key/value pairs.
- *
- * @author Fabien Potencier
- */
-class ParameterBag implements \IteratorAggregate, \Countable
-{
- /**
- * Parameter storage.
- */
- protected $parameters;
-
- /**
- * @param array $parameters An array of parameters
- */
- public function __construct(array $parameters = array())
- {
- $this->parameters = $parameters;
- }
-
- /**
- * Returns the parameters.
- *
- * @return array An array of parameters
- */
- public function all()
- {
- return $this->parameters;
- }
-
- /**
- * Returns the parameter keys.
- *
- * @return array An array of parameter keys
- */
- public function keys()
- {
- return array_keys($this->parameters);
- }
-
- /**
- * Replaces the current parameters by a new set.
- *
- * @param array $parameters An array of parameters
- */
- public function replace(array $parameters = array())
- {
- $this->parameters = $parameters;
- }
-
- /**
- * Adds parameters.
- *
- * @param array $parameters An array of parameters
- */
- public function add(array $parameters = array())
- {
- $this->parameters = array_replace($this->parameters, $parameters);
- }
-
- /**
- * Returns a parameter by name.
- *
- * @param string $key The key
- * @param mixed $default The default value if the parameter key does not exist
- *
- * @return mixed
- */
- public function get($key, $default = null)
- {
- return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default;
- }
-
- /**
- * Sets a parameter by name.
- *
- * @param string $key The key
- * @param mixed $value The value
- */
- public function set($key, $value)
- {
- $this->parameters[$key] = $value;
- }
-
- /**
- * Returns true if the parameter is defined.
- *
- * @param string $key The key
- *
- * @return bool true if the parameter exists, false otherwise
- */
- public function has($key)
- {
- return array_key_exists($key, $this->parameters);
- }
-
- /**
- * Removes a parameter.
- *
- * @param string $key The key
- */
- public function remove($key)
- {
- unset($this->parameters[$key]);
- }
-
- /**
- * Returns the alphabetic characters of the parameter value.
- *
- * @param string $key The parameter key
- * @param string $default The default value if the parameter key does not exist
- *
- * @return string The filtered value
- */
- public function getAlpha($key, $default = '')
- {
- return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default));
- }
-
- /**
- * Returns the alphabetic characters and digits of the parameter value.
- *
- * @param string $key The parameter key
- * @param string $default The default value if the parameter key does not exist
- *
- * @return string The filtered value
- */
- public function getAlnum($key, $default = '')
- {
- return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default));
- }
-
- /**
- * Returns the digits of the parameter value.
- *
- * @param string $key The parameter key
- * @param string $default The default value if the parameter key does not exist
- *
- * @return string The filtered value
- */
- public function getDigits($key, $default = '')
- {
- // we need to remove - and + because they're allowed in the filter
- return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT));
- }
-
- /**
- * Returns the parameter value converted to integer.
- *
- * @param string $key The parameter key
- * @param int $default The default value if the parameter key does not exist
- *
- * @return int The filtered value
- */
- public function getInt($key, $default = 0)
- {
- return (int) $this->get($key, $default);
- }
-
- /**
- * Returns the parameter value converted to boolean.
- *
- * @param string $key The parameter key
- * @param mixed $default The default value if the parameter key does not exist
- *
- * @return bool The filtered value
- */
- public function getBoolean($key, $default = false)
- {
- return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN);
- }
-
- /**
- * Filter key.
- *
- * @param string $key Key
- * @param mixed $default Default = null
- * @param int $filter FILTER_* constant
- * @param mixed $options Filter options
- *
- * @see http://php.net/manual/en/function.filter-var.php
- *
- * @return mixed
- */
- public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array())
- {
- $value = $this->get($key, $default);
-
- // Always turn $options into an array - this allows filter_var option shortcuts.
- if (!is_array($options) && $options) {
- $options = array('flags' => $options);
- }
-
- // Add a convenience check for arrays.
- if (is_array($value) && !isset($options['flags'])) {
- $options['flags'] = FILTER_REQUIRE_ARRAY;
- }
-
- return filter_var($value, $filter, $options);
- }
-
- /**
- * Returns an iterator for parameters.
- *
- * @return \ArrayIterator An \ArrayIterator instance
- */
- public function getIterator()
- {
- return new \ArrayIterator($this->parameters);
- }
-
- /**
- * Returns the number of parameters.
- *
- * @return int The number of parameters
- */
- public function count()
- {
- return count($this->parameters);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/README.md b/assets/php/vendor/symfony/http-foundation/README.md
deleted file mode 100755
index 8907f0b..0000000
--- a/assets/php/vendor/symfony/http-foundation/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-HttpFoundation Component
-========================
-
-The HttpFoundation component defines an object-oriented layer for the HTTP
-specification.
-
-Resources
----------
-
- * [Documentation](https://symfony.com/doc/current/components/http_foundation/index.html)
- * [Contributing](https://symfony.com/doc/current/contributing/index.html)
- * [Report issues](https://github.com/symfony/symfony/issues) and
- [send Pull Requests](https://github.com/symfony/symfony/pulls)
- in the [main Symfony repository](https://github.com/symfony/symfony)
diff --git a/assets/php/vendor/symfony/http-foundation/RedirectResponse.php b/assets/php/vendor/symfony/http-foundation/RedirectResponse.php
deleted file mode 100755
index 01681dc..0000000
--- a/assets/php/vendor/symfony/http-foundation/RedirectResponse.php
+++ /dev/null
@@ -1,109 +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
- */
-class RedirectResponse extends Response
-{
- protected $targetUrl;
-
- /**
- * 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. The URL should be a full URL, with schema etc.,
- * but practically every browser redirects on paths only as well
- * @param int $status The status code (302 by default)
- * @param array $headers The headers (Location is always set to the given URL)
- *
- * @throws \InvalidArgumentException
- *
- * @see http://tools.ietf.org/html/rfc2616#section-10.3
- */
- public function __construct($url, $status = 302, $headers = array())
- {
- parent::__construct('', $status, $headers);
-
- $this->setTargetUrl($url);
-
- if (!$this->isRedirect()) {
- throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status));
- }
-
- if (301 == $status && !array_key_exists('cache-control', $headers)) {
- $this->headers->remove('cache-control');
- }
- }
-
- /**
- * Factory method for chainability.
- *
- * @param string $url The url to redirect to
- * @param int $status The response status code
- * @param array $headers An array of response headers
- *
- * @return static
- */
- public static function create($url = '', $status = 302, $headers = array())
- {
- return new static($url, $status, $headers);
- }
-
- /**
- * Returns the target URL.
- *
- * @return string target URL
- */
- public function getTargetUrl()
- {
- return $this->targetUrl;
- }
-
- /**
- * Sets the redirect target of this response.
- *
- * @param string $url The URL to redirect to
- *
- * @return $this
- *
- * @throws \InvalidArgumentException
- */
- public function setTargetUrl($url)
- {
- if (empty($url)) {
- throw new \InvalidArgumentException('Cannot redirect to an empty URL.');
- }
-
- $this->targetUrl = $url;
-
- $this->setContent(
- sprintf('
-
-
-
-
-
- Redirecting to %1$s
-
-
- Redirecting to %1$s.
-
-', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')));
-
- $this->headers->set('Location', $url);
-
- return $this;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Request.php b/assets/php/vendor/symfony/http-foundation/Request.php
deleted file mode 100755
index 164fb4e..0000000
--- a/assets/php/vendor/symfony/http-foundation/Request.php
+++ /dev/null
@@ -1,2154 +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\Exception\ConflictingHeadersException;
-use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
-use Symfony\Component\HttpFoundation\Session\SessionInterface;
-
-/**
- * Request represents an HTTP request.
- *
- * The methods dealing with URL accept / return a raw path (% encoded):
- * * getBasePath
- * * getBaseUrl
- * * getPathInfo
- * * getRequestUri
- * * getUri
- * * getUriForPath
- *
- * @author Fabien Potencier
- */
-class Request
-{
- const HEADER_FORWARDED = 0b00001; // When using RFC 7239
- const HEADER_X_FORWARDED_FOR = 0b00010;
- const HEADER_X_FORWARDED_HOST = 0b00100;
- const HEADER_X_FORWARDED_PROTO = 0b01000;
- const HEADER_X_FORWARDED_PORT = 0b10000;
- const HEADER_X_FORWARDED_ALL = 0b11110; // All "X-Forwarded-*" headers
- const HEADER_X_FORWARDED_AWS_ELB = 0b11010; // AWS ELB doesn't send X-Forwarded-Host
-
- /** @deprecated since version 3.3, to be removed in 4.0 */
- const HEADER_CLIENT_IP = self::HEADER_X_FORWARDED_FOR;
- /** @deprecated since version 3.3, to be removed in 4.0 */
- const HEADER_CLIENT_HOST = self::HEADER_X_FORWARDED_HOST;
- /** @deprecated since version 3.3, to be removed in 4.0 */
- const HEADER_CLIENT_PROTO = self::HEADER_X_FORWARDED_PROTO;
- /** @deprecated since version 3.3, to be removed in 4.0 */
- const HEADER_CLIENT_PORT = self::HEADER_X_FORWARDED_PORT;
-
- const METHOD_HEAD = 'HEAD';
- const METHOD_GET = 'GET';
- const METHOD_POST = 'POST';
- const METHOD_PUT = 'PUT';
- const METHOD_PATCH = 'PATCH';
- const METHOD_DELETE = 'DELETE';
- const METHOD_PURGE = 'PURGE';
- const METHOD_OPTIONS = 'OPTIONS';
- const METHOD_TRACE = 'TRACE';
- const METHOD_CONNECT = 'CONNECT';
-
- /**
- * @var string[]
- */
- protected static $trustedProxies = array();
-
- /**
- * @var string[]
- */
- protected static $trustedHostPatterns = array();
-
- /**
- * @var string[]
- */
- protected static $trustedHosts = array();
-
- /**
- * Names for headers that can be trusted when
- * using trusted proxies.
- *
- * The FORWARDED header is the standard as of rfc7239.
- *
- * The other headers are non-standard, but widely used
- * by popular reverse proxies (like Apache mod_proxy or Amazon EC2).
- *
- * @deprecated since version 3.3, to be removed in 4.0
- */
- protected static $trustedHeaders = array(
- self::HEADER_FORWARDED => 'FORWARDED',
- self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR',
- self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST',
- self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO',
- self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT',
- );
-
- protected static $httpMethodParameterOverride = false;
-
- /**
- * Custom parameters.
- *
- * @var \Symfony\Component\HttpFoundation\ParameterBag
- */
- public $attributes;
-
- /**
- * Request body parameters ($_POST).
- *
- * @var \Symfony\Component\HttpFoundation\ParameterBag
- */
- public $request;
-
- /**
- * Query string parameters ($_GET).
- *
- * @var \Symfony\Component\HttpFoundation\ParameterBag
- */
- public $query;
-
- /**
- * Server and execution environment parameters ($_SERVER).
- *
- * @var \Symfony\Component\HttpFoundation\ServerBag
- */
- public $server;
-
- /**
- * Uploaded files ($_FILES).
- *
- * @var \Symfony\Component\HttpFoundation\FileBag
- */
- public $files;
-
- /**
- * Cookies ($_COOKIE).
- *
- * @var \Symfony\Component\HttpFoundation\ParameterBag
- */
- public $cookies;
-
- /**
- * Headers (taken from the $_SERVER).
- *
- * @var \Symfony\Component\HttpFoundation\HeaderBag
- */
- public $headers;
-
- /**
- * @var string|resource|false|null
- */
- protected $content;
-
- /**
- * @var array
- */
- protected $languages;
-
- /**
- * @var array
- */
- protected $charsets;
-
- /**
- * @var array
- */
- protected $encodings;
-
- /**
- * @var array
- */
- protected $acceptableContentTypes;
-
- /**
- * @var string
- */
- protected $pathInfo;
-
- /**
- * @var string
- */
- protected $requestUri;
-
- /**
- * @var string
- */
- protected $baseUrl;
-
- /**
- * @var string
- */
- protected $basePath;
-
- /**
- * @var string
- */
- protected $method;
-
- /**
- * @var string
- */
- protected $format;
-
- /**
- * @var \Symfony\Component\HttpFoundation\Session\SessionInterface
- */
- protected $session;
-
- /**
- * @var string
- */
- protected $locale;
-
- /**
- * @var string
- */
- protected $defaultLocale = 'en';
-
- /**
- * @var array
- */
- protected static $formats;
-
- protected static $requestFactory;
-
- private $isHostValid = true;
- private $isForwardedValid = true;
-
- private static $trustedHeaderSet = -1;
-
- /** @deprecated since version 3.3, to be removed in 4.0 */
- private static $trustedHeaderNames = array(
- self::HEADER_FORWARDED => 'FORWARDED',
- self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR',
- self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST',
- self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO',
- self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT',
- );
-
- private static $forwardedParams = array(
- self::HEADER_X_FORWARDED_FOR => 'for',
- self::HEADER_X_FORWARDED_HOST => 'host',
- self::HEADER_X_FORWARDED_PROTO => 'proto',
- self::HEADER_X_FORWARDED_PORT => 'host',
- );
-
- /**
- * @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|resource|null $content The raw body data
- */
- 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|resource|null $content The raw body data
- */
- 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->encodings = 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 static
- */
- public static function createFromGlobals()
- {
- // With the php's bug #66606, the php's built-in web server
- // stores the Content-Type and Content-Length header values in
- // HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields.
- $server = $_SERVER;
- if ('cli-server' === PHP_SAPI) {
- if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) {
- $server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH'];
- }
- if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) {
- $server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE'];
- }
- }
-
- $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server);
-
- if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
- && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))
- ) {
- parse_str($request->getContent(), $data);
- $request->request = new ParameterBag($data);
- }
-
- return $request;
- }
-
- /**
- * Creates a Request based on a given URI and configuration.
- *
- * The information contained in the URI always take precedence
- * over the other information (server and parameters).
- *
- * @param string $uri The URI
- * @param string $method The HTTP method
- * @param array $parameters The query (GET) or request (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|resource|null $content The raw body data
- *
- * @return static
- */
- public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null)
- {
- $server = array_replace(array(
- 'SERVER_NAME' => 'localhost',
- 'SERVER_PORT' => 80,
- 'HTTP_HOST' => 'localhost',
- 'HTTP_USER_AGENT' => 'Symfony/3.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(),
- ), $server);
-
- $server['PATH_INFO'] = '';
- $server['REQUEST_METHOD'] = strtoupper($method);
-
- $components = parse_url($uri);
- if (isset($components['host'])) {
- $server['SERVER_NAME'] = $components['host'];
- $server['HTTP_HOST'] = $components['host'];
- }
-
- if (isset($components['scheme'])) {
- if ('https' === $components['scheme']) {
- $server['HTTPS'] = 'on';
- $server['SERVER_PORT'] = 443;
- } else {
- unset($server['HTTPS']);
- $server['SERVER_PORT'] = 80;
- }
- }
-
- if (isset($components['port'])) {
- $server['SERVER_PORT'] = $components['port'];
- $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port'];
- }
-
- if (isset($components['user'])) {
- $server['PHP_AUTH_USER'] = $components['user'];
- }
-
- if (isset($components['pass'])) {
- $server['PHP_AUTH_PW'] = $components['pass'];
- }
-
- if (!isset($components['path'])) {
- $components['path'] = '/';
- }
-
- switch (strtoupper($method)) {
- case 'POST':
- case 'PUT':
- case 'DELETE':
- if (!isset($server['CONTENT_TYPE'])) {
- $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
- }
- // no break
- case 'PATCH':
- $request = $parameters;
- $query = array();
- break;
- default:
- $request = array();
- $query = $parameters;
- break;
- }
-
- $queryString = '';
- if (isset($components['query'])) {
- parse_str(html_entity_decode($components['query']), $qs);
-
- if ($query) {
- $query = array_replace($qs, $query);
- $queryString = http_build_query($query, '', '&');
- } else {
- $query = $qs;
- $queryString = $components['query'];
- }
- } elseif ($query) {
- $queryString = http_build_query($query, '', '&');
- }
-
- $server['REQUEST_URI'] = $components['path'].('' !== $queryString ? '?'.$queryString : '');
- $server['QUERY_STRING'] = $queryString;
-
- return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content);
- }
-
- /**
- * Sets a callable able to create a Request instance.
- *
- * This is mainly useful when you need to override the Request class
- * to keep BC with an existing system. It should not be used for any
- * other purpose.
- *
- * @param callable|null $callable A PHP callable
- */
- public static function setFactory($callable)
- {
- self::$requestFactory = $callable;
- }
-
- /**
- * 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
- *
- * @return static
- */
- 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 (null !== $query) {
- $dup->query = new ParameterBag($query);
- }
- if (null !== $request) {
- $dup->request = new ParameterBag($request);
- }
- if (null !== $attributes) {
- $dup->attributes = new ParameterBag($attributes);
- }
- if (null !== $cookies) {
- $dup->cookies = new ParameterBag($cookies);
- }
- if (null !== $files) {
- $dup->files = new FileBag($files);
- }
- if (null !== $server) {
- $dup->server = new ServerBag($server);
- $dup->headers = new HeaderBag($dup->server->getHeaders());
- }
- $dup->languages = null;
- $dup->charsets = null;
- $dup->encodings = null;
- $dup->acceptableContentTypes = null;
- $dup->pathInfo = null;
- $dup->requestUri = null;
- $dup->baseUrl = null;
- $dup->basePath = null;
- $dup->method = null;
- $dup->format = null;
-
- if (!$dup->get('_format') && $this->get('_format')) {
- $dup->attributes->set('_format', $this->get('_format'));
- }
-
- if (!$dup->getRequestFormat(null)) {
- $dup->setRequestFormat($this->getRequestFormat(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()
- {
- try {
- $content = $this->getContent();
- } catch (\LogicException $e) {
- return trigger_error($e, E_USER_ERROR);
- }
-
- $cookieHeader = '';
- $cookies = array();
-
- foreach ($this->cookies as $k => $v) {
- $cookies[] = $k.'='.$v;
- }
-
- if (!empty($cookies)) {
- $cookieHeader = 'Cookie: '.implode('; ', $cookies)."\r\n";
- }
-
- return
- sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n".
- $this->headers.
- $cookieHeader."\r\n".
- $content;
- }
-
- /**
- * Overrides the PHP global variables according to this request instance.
- *
- * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE.
- * $_FILES is never overridden, see rfc1867
- */
- public function overrideGlobals()
- {
- $this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), '', '&')));
-
- $_GET = $this->query->all();
- $_POST = $this->request->all();
- $_SERVER = $this->server->all();
- $_COOKIE = $this->cookies->all();
-
- 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);
- }
- }
-
- $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE);
-
- $requestOrder = ini_get('request_order') ?: ini_get('variables_order');
- $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp';
-
- $_REQUEST = array();
- foreach (str_split($requestOrder) as $order) {
- $_REQUEST = array_merge($_REQUEST, $request[$order]);
- }
- }
-
- /**
- * Sets a list of trusted proxies.
- *
- * You should only list the reverse proxies that you manage directly.
- *
- * @param array $proxies A list of trusted proxies
- * @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies
- *
- * @throws \InvalidArgumentException When $trustedHeaderSet is invalid
- */
- public static function setTrustedProxies(array $proxies/*, int $trustedHeaderSet*/)
- {
- self::$trustedProxies = $proxies;
-
- if (2 > func_num_args()) {
- @trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since Symfony 3.3. Defining it will be required in 4.0. ', __METHOD__), E_USER_DEPRECATED);
-
- return;
- }
- $trustedHeaderSet = (int) func_get_arg(1);
-
- foreach (self::$trustedHeaderNames as $header => $name) {
- self::$trustedHeaders[$header] = $header & $trustedHeaderSet ? $name : null;
- }
- self::$trustedHeaderSet = $trustedHeaderSet;
- }
-
- /**
- * Gets the list of trusted proxies.
- *
- * @return array An array of trusted proxies
- */
- public static function getTrustedProxies()
- {
- return self::$trustedProxies;
- }
-
- /**
- * Gets the set of trusted headers from trusted proxies.
- *
- * @return int A bit field of Request::HEADER_* that defines which headers are trusted from your proxies
- */
- public static function getTrustedHeaderSet()
- {
- return self::$trustedHeaderSet;
- }
-
- /**
- * Sets a list of trusted host patterns.
- *
- * You should only list the hosts you manage using regexs.
- *
- * @param array $hostPatterns A list of trusted host patterns
- */
- public static function setTrustedHosts(array $hostPatterns)
- {
- self::$trustedHostPatterns = array_map(function ($hostPattern) {
- return sprintf('#%s#i', $hostPattern);
- }, $hostPatterns);
- // we need to reset trusted hosts on trusted host patterns change
- self::$trustedHosts = array();
- }
-
- /**
- * Gets the list of trusted host patterns.
- *
- * @return array An array of trusted host patterns
- */
- public static function getTrustedHosts()
- {
- return self::$trustedHostPatterns;
- }
-
- /**
- * Sets the name for trusted headers.
- *
- * The following header keys are supported:
- *
- * * Request::HEADER_CLIENT_IP: defaults to X-Forwarded-For (see getClientIp())
- * * Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getHost())
- * * Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getPort())
- * * Request::HEADER_CLIENT_PROTO: defaults to X-Forwarded-Proto (see getScheme() and isSecure())
- * * Request::HEADER_FORWARDED: defaults to Forwarded (see RFC 7239)
- *
- * Setting an empty value allows to disable the trusted header for the given key.
- *
- * @param string $key The header key
- * @param string $value The header name
- *
- * @throws \InvalidArgumentException
- *
- * @deprecated since version 3.3, to be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.
- */
- public static function setTrustedHeaderName($key, $value)
- {
- @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED);
-
- if ('forwarded' === $key) {
- $key = self::HEADER_FORWARDED;
- } elseif ('client_ip' === $key) {
- $key = self::HEADER_CLIENT_IP;
- } elseif ('client_host' === $key) {
- $key = self::HEADER_CLIENT_HOST;
- } elseif ('client_proto' === $key) {
- $key = self::HEADER_CLIENT_PROTO;
- } elseif ('client_port' === $key) {
- $key = self::HEADER_CLIENT_PORT;
- } elseif (!array_key_exists($key, self::$trustedHeaders)) {
- throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key));
- }
-
- self::$trustedHeaders[$key] = $value;
-
- if (null !== $value) {
- self::$trustedHeaderNames[$key] = $value;
- self::$trustedHeaderSet |= $key;
- } else {
- self::$trustedHeaderSet &= ~$key;
- }
- }
-
- /**
- * Gets the trusted proxy header name.
- *
- * @param string $key The header key
- *
- * @return string The header name
- *
- * @throws \InvalidArgumentException
- *
- * @deprecated since version 3.3, to be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.
- */
- public static function getTrustedHeaderName($key)
- {
- if (2 > func_num_args() || func_get_arg(1)) {
- @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED);
- }
-
- if (!array_key_exists($key, self::$trustedHeaders)) {
- throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key));
- }
-
- return self::$trustedHeaders[$key];
- }
-
- /**
- * Normalizes a query string.
- *
- * It builds a normalized query string, where keys/value pairs are alphabetized,
- * have consistent escaping and unneeded delimiters are removed.
- *
- * @param string $qs Query string
- *
- * @return string A normalized query string for the Request
- */
- public static function normalizeQueryString($qs)
- {
- if ('' == $qs) {
- return '';
- }
-
- $parts = array();
- $order = array();
-
- foreach (explode('&', $qs) as $param) {
- if ('' === $param || '=' === $param[0]) {
- // Ignore useless delimiters, e.g. "x=y&".
- // Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway.
- // PHP also does not include them when building _GET.
- continue;
- }
-
- $keyValuePair = explode('=', $param, 2);
-
- // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded).
- // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. This is why we use urldecode and then normalize to
- // RFC 3986 with rawurlencode.
- $parts[] = isset($keyValuePair[1]) ?
- rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) :
- rawurlencode(urldecode($keyValuePair[0]));
- $order[] = urldecode($keyValuePair[0]);
- }
-
- array_multisort($order, SORT_ASC, $parts);
-
- return implode('&', $parts);
- }
-
- /**
- * Enables support for the _method request parameter to determine the intended HTTP method.
- *
- * Be warned that enabling this feature might lead to CSRF issues in your code.
- * Check that you are using CSRF tokens when required.
- * If the HTTP method parameter override is enabled, an html-form with method "POST" can be altered
- * and used to send a "PUT" or "DELETE" request via the _method request parameter.
- * If these methods are not protected against CSRF, this presents a possible vulnerability.
- *
- * The HTTP method can only be overridden when the real HTTP method is POST.
- */
- public static function enableHttpMethodParameterOverride()
- {
- self::$httpMethodParameterOverride = true;
- }
-
- /**
- * Checks whether support for the _method request parameter is enabled.
- *
- * @return bool True when the _method request parameter is enabled, false otherwise
- */
- public static function getHttpMethodParameterOverride()
- {
- return self::$httpMethodParameterOverride;
- }
-
- /**
- * Gets a "parameter" value from any bag.
- *
- * This method is mainly useful for libraries that want to provide some flexibility. If you don't need the
- * flexibility in controllers, it is better to explicitly get request parameters from the appropriate
- * public property instead (attributes, query, request).
- *
- * Order of precedence: PATH (routing placeholders or custom attributes), GET, BODY
- *
- * @param string $key The key
- * @param mixed $default The default value if the parameter key does not exist
- *
- * @return mixed
- */
- public function get($key, $default = null)
- {
- if ($this !== $result = $this->attributes->get($key, $this)) {
- return $result;
- }
-
- if ($this !== $result = $this->query->get($key, $this)) {
- return $result;
- }
-
- if ($this !== $result = $this->request->get($key, $this)) {
- return $result;
- }
-
- return $default;
- }
-
- /**
- * Gets the Session.
- *
- * @return SessionInterface|null The session
- */
- public function getSession()
- {
- return $this->session;
- }
-
- /**
- * Whether the request contains a Session which was started in one of the
- * previous requests.
- *
- * @return bool
- */
- public function hasPreviousSession()
- {
- // the check for $this->session avoids malicious users trying to fake a session cookie with proper name
- return $this->hasSession() && $this->cookies->has($this->session->getName());
- }
-
- /**
- * Whether the request contains a Session object.
- *
- * This method does not give any information about the state of the session object,
- * like whether the session is started or not. It is just a way to check if this Request
- * is associated with a Session instance.
- *
- * @return bool true when the Request contains a Session object, false otherwise
- */
- public function hasSession()
- {
- return null !== $this->session;
- }
-
- /**
- * Sets the Session.
- *
- * @param SessionInterface $session The Session
- */
- public function setSession(SessionInterface $session)
- {
- $this->session = $session;
- }
-
- /**
- * Returns the client IP addresses.
- *
- * In the returned array the most trusted IP address is first, and the
- * least trusted one last. The "real" client IP address is the last one,
- * but this is also the least trusted one. Trusted proxies are stripped.
- *
- * Use this method carefully; you should use getClientIp() instead.
- *
- * @return array The client IP addresses
- *
- * @see getClientIp()
- */
- public function getClientIps()
- {
- $ip = $this->server->get('REMOTE_ADDR');
-
- if (!$this->isFromTrustedProxy()) {
- return array($ip);
- }
-
- return $this->getTrustedValues(self::HEADER_CLIENT_IP, $ip) ?: array($ip);
- }
-
- /**
- * Returns the client IP address.
- *
- * This method can read the client IP address from the "X-Forwarded-For" header
- * when trusted proxies were set via "setTrustedProxies()". The "X-Forwarded-For"
- * header value is a comma+space separated list of IP addresses, the left-most
- * being the original client, and each successive proxy that passed the request
- * adding the IP address where it received the request from.
- *
- * If your reverse proxy uses a different header name than "X-Forwarded-For",
- * ("Client-Ip" for instance), configure it via the $trustedHeaderSet
- * argument of the Request::setTrustedProxies() method instead.
- *
- * @return string|null The client IP address
- *
- * @see getClientIps()
- * @see http://en.wikipedia.org/wiki/X-Forwarded-For
- */
- public function getClientIp()
- {
- $ipAddresses = $this->getClientIps();
-
- return $ipAddresses[0];
- }
-
- /**
- * Returns current script name.
- *
- * @return string
- */
- 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/enco%20ded returns '/enco%20ded'
- * * http://localhost/mysite/about?var=1 returns '/about'
- *
- * @return string The raw path (i.e. not urldecoded)
- */
- 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 returns '/web'
- * * http://localhost/we%20b/index.php returns '/we%20b'
- *
- * @return string The raw path (i.e. not urldecoded)
- */
- 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 The raw URL (i.e. not urldecoded)
- */
- public function getBaseUrl()
- {
- if (null === $this->baseUrl) {
- $this->baseUrl = $this->prepareBaseUrl();
- }
-
- return $this->baseUrl;
- }
-
- /**
- * Gets the request's scheme.
- *
- * @return string
- */
- public function getScheme()
- {
- return $this->isSecure() ? 'https' : 'http';
- }
-
- /**
- * Returns the port on which the request is made.
- *
- * This method can read the client port from the "X-Forwarded-Port" header
- * when trusted proxies were set via "setTrustedProxies()".
- *
- * The "X-Forwarded-Port" header must contain the client port.
- *
- * If your reverse proxy uses a different header name than "X-Forwarded-Port",
- * configure it via via the $trustedHeaderSet argument of the
- * Request::setTrustedProxies() method instead.
- *
- * @return int|string can be a string if fetched from the server bag
- */
- public function getPort()
- {
- if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_PORT)) {
- $host = $host[0];
- } elseif ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_HOST)) {
- $host = $host[0];
- } elseif (!$host = $this->headers->get('HOST')) {
- return $this->server->get('SERVER_PORT');
- }
-
- if ('[' === $host[0]) {
- $pos = strpos($host, ':', strrpos($host, ']'));
- } else {
- $pos = strrpos($host, ':');
- }
-
- if (false !== $pos) {
- return (int) substr($host, $pos + 1);
- }
-
- return 'https' === $this->getScheme() ? 443 : 80;
- }
-
- /**
- * Returns the user.
- *
- * @return string|null
- */
- public function getUser()
- {
- return $this->headers->get('PHP_AUTH_USER');
- }
-
- /**
- * Returns the password.
- *
- * @return string|null
- */
- public function getPassword()
- {
- return $this->headers->get('PHP_AUTH_PW');
- }
-
- /**
- * Gets the user info.
- *
- * @return string A user name and, optionally, scheme-specific information about how to gain authorization to access the server
- */
- public function getUserInfo()
- {
- $userinfo = $this->getUser();
-
- $pass = $this->getPassword();
- if ('' != $pass) {
- $userinfo .= ":$pass";
- }
-
- return $userinfo;
- }
-
- /**
- * Returns the HTTP host being requested.
- *
- * The port name will be appended to the host if it's non-standard.
- *
- * @return string
- */
- public function getHttpHost()
- {
- $scheme = $this->getScheme();
- $port = $this->getPort();
-
- if (('http' == $scheme && 80 == $port) || ('https' == $scheme && 443 == $port)) {
- return $this->getHost();
- }
-
- return $this->getHost().':'.$port;
- }
-
- /**
- * Returns the requested URI (path and query string).
- *
- * @return string The raw URI (i.e. not URI decoded)
- */
- public function getRequestUri()
- {
- if (null === $this->requestUri) {
- $this->requestUri = $this->prepareRequestUri();
- }
-
- return $this->requestUri;
- }
-
- /**
- * Gets the scheme and HTTP host.
- *
- * If the URL was called with basic authentication, the user
- * and the password are not added to the generated string.
- *
- * @return string The scheme and HTTP host
- */
- public function getSchemeAndHttpHost()
- {
- return $this->getScheme().'://'.$this->getHttpHost();
- }
-
- /**
- * Generates a normalized URI (URL) for the Request.
- *
- * @return string A normalized URI (URL) for the Request
- *
- * @see getQueryString()
- */
- public function getUri()
- {
- if (null !== $qs = $this->getQueryString()) {
- $qs = '?'.$qs;
- }
-
- return $this->getSchemeAndHttpHost().$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
- */
- public function getUriForPath($path)
- {
- return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path;
- }
-
- /**
- * Returns the path as relative reference from the current Request path.
- *
- * Only the URIs path component (no schema, host etc.) is relevant and must be given.
- * Both paths must be absolute and not contain relative parts.
- * Relative URLs from one resource to another are useful when generating self-contained downloadable document archives.
- * Furthermore, they can be used to reduce the link size in documents.
- *
- * Example target paths, given a base path of "/a/b/c/d":
- * - "/a/b/c/d" -> ""
- * - "/a/b/c/" -> "./"
- * - "/a/b/" -> "../"
- * - "/a/b/c/other" -> "other"
- * - "/a/x/y" -> "../../x/y"
- *
- * @param string $path The target path
- *
- * @return string The relative target path
- */
- public function getRelativeUriForPath($path)
- {
- // be sure that we are dealing with an absolute path
- if (!isset($path[0]) || '/' !== $path[0]) {
- return $path;
- }
-
- if ($path === $basePath = $this->getPathInfo()) {
- return '';
- }
-
- $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath);
- $targetDirs = explode('/', isset($path[0]) && '/' === $path[0] ? substr($path, 1) : $path);
- array_pop($sourceDirs);
- $targetFile = array_pop($targetDirs);
-
- foreach ($sourceDirs as $i => $dir) {
- if (isset($targetDirs[$i]) && $dir === $targetDirs[$i]) {
- unset($sourceDirs[$i], $targetDirs[$i]);
- } else {
- break;
- }
- }
-
- $targetDirs[] = $targetFile;
- $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs);
-
- // A reference to the same base directory or an empty subdirectory must be prefixed with "./".
- // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used
- // as the first segment of a relative-path reference, as it would be mistaken for a scheme name
- // (see http://tools.ietf.org/html/rfc3986#section-4.2).
- return !isset($path[0]) || '/' === $path[0]
- || false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos)
- ? "./$path" : $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
- */
- public function getQueryString()
- {
- $qs = static::normalizeQueryString($this->server->get('QUERY_STRING'));
-
- return '' === $qs ? null : $qs;
- }
-
- /**
- * Checks whether the request is secure or not.
- *
- * This method can read the client protocol from the "X-Forwarded-Proto" header
- * when trusted proxies were set via "setTrustedProxies()".
- *
- * The "X-Forwarded-Proto" header must contain the protocol: "https" or "http".
- *
- * If your reverse proxy uses a different header name than "X-Forwarded-Proto"
- * ("SSL_HTTPS" for instance), configure it via the $trustedHeaderSet
- * argument of the Request::setTrustedProxies() method instead.
- *
- * @return bool
- */
- public function isSecure()
- {
- if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_CLIENT_PROTO)) {
- return in_array(strtolower($proto[0]), array('https', 'on', 'ssl', '1'), true);
- }
-
- $https = $this->server->get('HTTPS');
-
- return !empty($https) && 'off' !== strtolower($https);
- }
-
- /**
- * Returns the host name.
- *
- * This method can read the client host name from the "X-Forwarded-Host" header
- * when trusted proxies were set via "setTrustedProxies()".
- *
- * The "X-Forwarded-Host" header must contain the client host name.
- *
- * If your reverse proxy uses a different header name than "X-Forwarded-Host",
- * configure it via the $trustedHeaderSet argument of the
- * Request::setTrustedProxies() method instead.
- *
- * @return string
- *
- * @throws SuspiciousOperationException when the host name is invalid or not trusted
- */
- public function getHost()
- {
- if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_HOST)) {
- $host = $host[0];
- } elseif (!$host = $this->headers->get('HOST')) {
- if (!$host = $this->server->get('SERVER_NAME')) {
- $host = $this->server->get('SERVER_ADDR', '');
- }
- }
-
- // trim and remove port number from host
- // host is lowercase as per RFC 952/2181
- $host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
-
- // as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user)
- // check that it does not contain forbidden characters (see RFC 952 and RFC 2181)
- // use preg_replace() instead of preg_match() to prevent DoS attacks with long host names
- if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) {
- if (!$this->isHostValid) {
- return '';
- }
- $this->isHostValid = false;
-
- throw new SuspiciousOperationException(sprintf('Invalid Host "%s".', $host));
- }
-
- if (count(self::$trustedHostPatterns) > 0) {
- // to avoid host header injection attacks, you should provide a list of trusted host patterns
-
- if (in_array($host, self::$trustedHosts)) {
- return $host;
- }
-
- foreach (self::$trustedHostPatterns as $pattern) {
- if (preg_match($pattern, $host)) {
- self::$trustedHosts[] = $host;
-
- return $host;
- }
- }
-
- if (!$this->isHostValid) {
- return '';
- }
- $this->isHostValid = false;
-
- throw new SuspiciousOperationException(sprintf('Untrusted Host "%s".', $host));
- }
-
- return $host;
- }
-
- /**
- * Sets the request method.
- *
- * @param string $method
- */
- public function setMethod($method)
- {
- $this->method = null;
- $this->server->set('REQUEST_METHOD', $method);
- }
-
- /**
- * Gets the request "intended" method.
- *
- * If the X-HTTP-Method-Override header is set, and if the method is a POST,
- * then it is used to determine the "real" intended HTTP method.
- *
- * The _method request parameter can also be used to determine the HTTP method,
- * but only if enableHttpMethodParameterOverride() has been called.
- *
- * The method is always an uppercased string.
- *
- * @return string The request method
- *
- * @see getRealMethod()
- */
- public function getMethod()
- {
- if (null === $this->method) {
- $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
-
- if ('POST' === $this->method) {
- if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) {
- $this->method = strtoupper($method);
- } elseif (self::$httpMethodParameterOverride) {
- $this->method = strtoupper($this->request->get('_method', $this->query->get('_method', 'POST')));
- }
- }
- }
-
- return $this->method;
- }
-
- /**
- * Gets the "real" request method.
- *
- * @return string The request method
- *
- * @see getMethod()
- */
- public function getRealMethod()
- {
- return strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
- }
-
- /**
- * Gets the mime type associated with the format.
- *
- * @param string $format The format
- *
- * @return string The associated mime type (null if not found)
- */
- public function getMimeType($format)
- {
- if (null === static::$formats) {
- static::initializeFormats();
- }
-
- return isset(static::$formats[$format]) ? static::$formats[$format][0] : null;
- }
-
- /**
- * Gets the mime types associated with the format.
- *
- * @param string $format The format
- *
- * @return array The associated mime types
- */
- public static function getMimeTypes($format)
- {
- if (null === static::$formats) {
- static::initializeFormats();
- }
-
- return isset(static::$formats[$format]) ? static::$formats[$format] : array();
- }
-
- /**
- * Gets the format associated with the mime type.
- *
- * @param string $mimeType The associated mime type
- *
- * @return string|null The format (null if not found)
- */
- public function getFormat($mimeType)
- {
- $canonicalMimeType = null;
- if (false !== $pos = strpos($mimeType, ';')) {
- $canonicalMimeType = substr($mimeType, 0, $pos);
- }
-
- if (null === static::$formats) {
- static::initializeFormats();
- }
-
- foreach (static::$formats as $format => $mimeTypes) {
- if (in_array($mimeType, (array) $mimeTypes)) {
- return $format;
- }
- if (null !== $canonicalMimeType && in_array($canonicalMimeType, (array) $mimeTypes)) {
- return $format;
- }
- }
- }
-
- /**
- * 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)
- */
- 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 attribute
- * * $default
- *
- * @param string $default The default format
- *
- * @return string The request format
- */
- public function getRequestFormat($default = 'html')
- {
- if (null === $this->format) {
- $this->format = $this->attributes->get('_format');
- }
-
- return null === $this->format ? $default : $this->format;
- }
-
- /**
- * Sets the request format.
- *
- * @param string $format The request format
- */
- public function setRequestFormat($format)
- {
- $this->format = $format;
- }
-
- /**
- * Gets the format associated with the request.
- *
- * @return string|null The format (null if no content type is present)
- */
- public function getContentType()
- {
- return $this->getFormat($this->headers->get('CONTENT_TYPE'));
- }
-
- /**
- * Sets the default locale.
- *
- * @param string $locale
- */
- public function setDefaultLocale($locale)
- {
- $this->defaultLocale = $locale;
-
- if (null === $this->locale) {
- $this->setPhpDefaultLocale($locale);
- }
- }
-
- /**
- * Get the default locale.
- *
- * @return string
- */
- public function getDefaultLocale()
- {
- return $this->defaultLocale;
- }
-
- /**
- * Sets the locale.
- *
- * @param string $locale
- */
- public function setLocale($locale)
- {
- $this->setPhpDefaultLocale($this->locale = $locale);
- }
-
- /**
- * Get the locale.
- *
- * @return string
- */
- public function getLocale()
- {
- return null === $this->locale ? $this->defaultLocale : $this->locale;
- }
-
- /**
- * Checks if the request method is of specified type.
- *
- * @param string $method Uppercase request method (GET, POST etc)
- *
- * @return bool
- */
- public function isMethod($method)
- {
- return $this->getMethod() === strtoupper($method);
- }
-
- /**
- * Checks whether or not the method is safe.
- *
- * @see https://tools.ietf.org/html/rfc7231#section-4.2.1
- *
- * @param bool $andCacheable Adds the additional condition that the method should be cacheable. True by default.
- *
- * @return bool
- */
- public function isMethodSafe(/* $andCacheable = true */)
- {
- if (!func_num_args() || func_get_arg(0)) {
- // This deprecation should be turned into a BadMethodCallException in 4.0 (without adding the argument in the signature)
- // then setting $andCacheable to false should be deprecated in 4.1
- @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since Symfony 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED);
-
- return in_array($this->getMethod(), array('GET', 'HEAD'));
- }
-
- return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE'));
- }
-
- /**
- * Checks whether or not the method is idempotent.
- *
- * @return bool
- */
- public function isMethodIdempotent()
- {
- return in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE'));
- }
-
- /**
- * Checks whether the method is cacheable or not.
- *
- * @see https://tools.ietf.org/html/rfc7231#section-4.2.3
- *
- * @return bool
- */
- public function isMethodCacheable()
- {
- return in_array($this->getMethod(), array('GET', 'HEAD'));
- }
-
- /**
- * Returns the protocol version.
- *
- * If the application is behind a proxy, the protocol version used in the
- * requests between the client and the proxy and between the proxy and the
- * server might be different. This returns the former (from the "Via" header)
- * if the proxy is trusted (see "setTrustedProxies()"), otherwise it returns
- * the latter (from the "SERVER_PROTOCOL" server parameter).
- *
- * @return string
- */
- public function getProtocolVersion()
- {
- if ($this->isFromTrustedProxy()) {
- preg_match('~^(HTTP/)?([1-9]\.[0-9]) ~', $this->headers->get('Via'), $matches);
-
- if ($matches) {
- return 'HTTP/'.$matches[2];
- }
- }
-
- return $this->server->get('SERVER_PROTOCOL');
- }
-
- /**
- * Returns the request body content.
- *
- * @param bool $asResource If true, a resource will be returned
- *
- * @return string|resource The request body content or a resource to read the body stream
- *
- * @throws \LogicException
- */
- public function getContent($asResource = false)
- {
- $currentContentIsResource = is_resource($this->content);
- if (\PHP_VERSION_ID < 50600 && false === $this->content) {
- throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
- }
-
- if (true === $asResource) {
- if ($currentContentIsResource) {
- rewind($this->content);
-
- return $this->content;
- }
-
- // Content passed in parameter (test)
- if (is_string($this->content)) {
- $resource = fopen('php://temp', 'r+');
- fwrite($resource, $this->content);
- rewind($resource);
-
- return $resource;
- }
-
- $this->content = false;
-
- return fopen('php://input', 'rb');
- }
-
- if ($currentContentIsResource) {
- rewind($this->content);
-
- return stream_get_contents($this->content);
- }
-
- if (null === $this->content || false === $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);
- }
-
- /**
- * @return bool
- */
- 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
- */
- public function getPreferredLanguage(array $locales = null)
- {
- $preferredLanguages = $this->getLanguages();
-
- if (empty($locales)) {
- return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null;
- }
-
- if (!$preferredLanguages) {
- return $locales[0];
- }
-
- $extendedPreferredLanguages = array();
- foreach ($preferredLanguages as $language) {
- $extendedPreferredLanguages[] = $language;
- if (false !== $position = strpos($language, '_')) {
- $superLanguage = substr($language, 0, $position);
- if (!in_array($superLanguage, $preferredLanguages)) {
- $extendedPreferredLanguages[] = $superLanguage;
- }
- }
- }
-
- $preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $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
- */
- public function getLanguages()
- {
- if (null !== $this->languages) {
- return $this->languages;
- }
-
- $languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all();
- $this->languages = array();
- foreach ($languages as $lang => $acceptHeaderItem) {
- if (false !== strpos($lang, '-')) {
- $codes = explode('-', $lang);
- if ('i' === $codes[0]) {
- // 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 (0 === $i) {
- $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
- */
- public function getCharsets()
- {
- if (null !== $this->charsets) {
- return $this->charsets;
- }
-
- return $this->charsets = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Charset'))->all());
- }
-
- /**
- * Gets a list of encodings acceptable by the client browser.
- *
- * @return array List of encodings in preferable order
- */
- public function getEncodings()
- {
- if (null !== $this->encodings) {
- return $this->encodings;
- }
-
- return $this->encodings = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Encoding'))->all());
- }
-
- /**
- * Gets a list of content types acceptable by the client browser.
- *
- * @return array List of content types in preferable order
- */
- public function getAcceptableContentTypes()
- {
- if (null !== $this->acceptableContentTypes) {
- return $this->acceptableContentTypes;
- }
-
- return $this->acceptableContentTypes = array_keys(AcceptHeader::fromString($this->headers->get('Accept'))->all());
- }
-
- /**
- * Returns true if the request is a XMLHttpRequest.
- *
- * It works if your JavaScript library sets an X-Requested-With HTTP header.
- * It is known to work with common JavaScript frameworks:
- *
- * @see http://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript
- *
- * @return bool true if the request is an XMLHttpRequest, false otherwise
- */
- public function isXmlHttpRequest()
- {
- return 'XMLHttpRequest' == $this->headers->get('X-Requested-With');
- }
-
- /*
- * 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_ORIGINAL_URL')) {
- // IIS with Microsoft Rewrite Module
- $requestUri = $this->headers->get('X_ORIGINAL_URL');
- $this->headers->remove('X_ORIGINAL_URL');
- $this->server->remove('HTTP_X_ORIGINAL_URL');
- $this->server->remove('UNENCODED_URL');
- $this->server->remove('IIS_WasUrlRewritten');
- } elseif ($this->headers->has('X_REWRITE_URL')) {
- // IIS with ISAPI_Rewrite
- $requestUri = $this->headers->get('X_REWRITE_URL');
- $this->headers->remove('X_REWRITE_URL');
- } elseif ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $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');
- $this->server->remove('UNENCODED_URL');
- $this->server->remove('IIS_WasUrlRewritten');
- } 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->getSchemeAndHttpHost();
- if (0 === strpos($requestUri, $schemeAndHttpHost)) {
- $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');
- }
- $this->server->remove('ORIG_PATH_INFO');
- }
-
- // normalize the request URI to ease creating sub-requests from this request
- $this->server->set('REQUEST_URI', $requestUri);
-
- return $requestUri;
- }
-
- /**
- * Prepares the base URL.
- *
- * @return string
- */
- 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 ('' !== $requestUri && '/' !== $requestUri[0]) {
- $requestUri = '/'.$requestUri;
- }
-
- if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) {
- // full $baseUrl matches
- return $prefix;
- }
-
- if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(dirname($baseUrl), '/'.DIRECTORY_SEPARATOR).'/')) {
- // directory portion of $baseUrl matches
- return rtrim($prefix, '/'.DIRECTORY_SEPARATOR);
- }
-
- $truncatedRequestUri = $requestUri;
- if (false !== $pos = strpos($requestUri, '?')) {
- $truncatedRequestUri = substr($requestUri, 0, $pos);
- }
-
- $basename = basename($baseUrl);
- if (empty($basename) || !strpos(rawurldecode($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)) && 0 !== $pos) {
- $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
- }
-
- return rtrim($baseUrl, '/'.DIRECTORY_SEPARATOR);
- }
-
- /**
- * Prepares the base path.
- *
- * @return string base path
- */
- protected function prepareBasePath()
- {
- $baseUrl = $this->getBaseUrl();
- if (empty($baseUrl)) {
- return '';
- }
-
- $filename = basename($this->server->get('SCRIPT_FILENAME'));
- if (basename($baseUrl) === $filename) {
- $basePath = dirname($baseUrl);
- } else {
- $basePath = $baseUrl;
- }
-
- if ('\\' === DIRECTORY_SEPARATOR) {
- $basePath = str_replace('\\', '/', $basePath);
- }
-
- return rtrim($basePath, '/');
- }
-
- /**
- * Prepares the path info.
- *
- * @return string path info
- */
- protected function preparePathInfo()
- {
- if (null === ($requestUri = $this->getRequestUri())) {
- return '/';
- }
-
- // Remove the query string from REQUEST_URI
- if (false !== $pos = strpos($requestUri, '?')) {
- $requestUri = substr($requestUri, 0, $pos);
- }
- if ('' !== $requestUri && '/' !== $requestUri[0]) {
- $requestUri = '/'.$requestUri;
- }
-
- if (null === ($baseUrl = $this->getBaseUrl())) {
- return $requestUri;
- }
-
- $pathInfo = substr($requestUri, strlen($baseUrl));
- if (false === $pathInfo || '' === $pathInfo) {
- // If substr() returns false then PATH_INFO is set to an empty string
- return '/';
- }
-
- return (string) $pathInfo;
- }
-
- /**
- * Initializes HTTP request formats.
- */
- protected static 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'),
- 'jsonld' => array('application/ld+json'),
- 'xml' => array('text/xml', 'application/xml', 'application/x-xml'),
- 'rdf' => array('application/rdf+xml'),
- 'atom' => array('application/atom+xml'),
- 'rss' => array('application/rss+xml'),
- 'form' => array('application/x-www-form-urlencoded'),
- );
- }
-
- /**
- * Sets the default PHP locale.
- *
- * @param string $locale
- */
- 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) {
- }
- }
-
- /*
- * Returns the prefix as encoded in the string when the string starts with
- * the given prefix, false otherwise.
- *
- * @param string $string The urlencoded string
- * @param string $prefix The prefix not encoded
- *
- * @return string|false The prefix as it is encoded in $string, or false
- */
- private function getUrlencodedPrefix($string, $prefix)
- {
- if (0 !== strpos(rawurldecode($string), $prefix)) {
- return false;
- }
-
- $len = strlen($prefix);
-
- if (preg_match(sprintf('#^(%%[[:xdigit:]]{2}|.){%d}#', $len), $string, $match)) {
- return $match[0];
- }
-
- return false;
- }
-
- private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
- {
- if (self::$requestFactory) {
- $request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content);
-
- if (!$request instanceof self) {
- throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.');
- }
-
- return $request;
- }
-
- return new static($query, $request, $attributes, $cookies, $files, $server, $content);
- }
-
- /**
- * Indicates whether this request originated from a trusted proxy.
- *
- * This can be useful to determine whether or not to trust the
- * contents of a proxy-specific header.
- *
- * @return bool true if the request came from a trusted proxy, false otherwise
- */
- public function isFromTrustedProxy()
- {
- return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies);
- }
-
- private function getTrustedValues($type, $ip = null)
- {
- $clientValues = array();
- $forwardedValues = array();
-
- if (self::$trustedHeaders[$type] && $this->headers->has(self::$trustedHeaders[$type])) {
- foreach (explode(',', $this->headers->get(self::$trustedHeaders[$type])) as $v) {
- $clientValues[] = (self::HEADER_CLIENT_PORT === $type ? '0.0.0.0:' : '').trim($v);
- }
- }
-
- if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) {
- $forwardedValues = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]);
- $forwardedValues = preg_match_all(sprintf('{(?:%s)=(?:"?\[?)([a-zA-Z0-9\.:_\-/]*+)}', self::$forwardedParams[$type]), $forwardedValues, $matches) ? $matches[1] : array();
- }
-
- if (null !== $ip) {
- $clientValues = $this->normalizeAndFilterClientIps($clientValues, $ip);
- $forwardedValues = $this->normalizeAndFilterClientIps($forwardedValues, $ip);
- }
-
- if ($forwardedValues === $clientValues || !$clientValues) {
- return $forwardedValues;
- }
-
- if (!$forwardedValues) {
- return $clientValues;
- }
-
- if (!$this->isForwardedValid) {
- return null !== $ip ? array('0.0.0.0', $ip) : array();
- }
- $this->isForwardedValid = false;
-
- throw new ConflictingHeadersException(sprintf('The request has both a trusted "%s" header and a trusted "%s" header, conflicting with each other. You should either configure your proxy to remove one of them, or configure your project to distrust the offending one.', self::$trustedHeaders[self::HEADER_FORWARDED], self::$trustedHeaders[$type]));
- }
-
- private function normalizeAndFilterClientIps(array $clientIps, $ip)
- {
- if (!$clientIps) {
- return array();
- }
- $clientIps[] = $ip; // Complete the IP chain with the IP the request actually came from
- $firstTrustedIp = null;
-
- foreach ($clientIps as $key => $clientIp) {
- // Remove port (unfortunately, it does happen)
- if (preg_match('{((?:\d+\.){3}\d+)\:\d+}', $clientIp, $match)) {
- $clientIps[$key] = $clientIp = $match[1];
- }
-
- if (!filter_var($clientIp, FILTER_VALIDATE_IP)) {
- unset($clientIps[$key]);
-
- continue;
- }
-
- if (IpUtils::checkIp($clientIp, self::$trustedProxies)) {
- unset($clientIps[$key]);
-
- // Fallback to this when the client IP falls into the range of trusted proxies
- if (null === $firstTrustedIp) {
- $firstTrustedIp = $clientIp;
- }
- }
- }
-
- // Now the IP chain contains only untrusted proxies and the client IP
- return $clientIps ? array_reverse($clientIps) : array($firstTrustedIp);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/RequestMatcher.php b/assets/php/vendor/symfony/http-foundation/RequestMatcher.php
deleted file mode 100755
index 076d077..0000000
--- a/assets/php/vendor/symfony/http-foundation/RequestMatcher.php
+++ /dev/null
@@ -1,178 +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
- */
-class RequestMatcher implements RequestMatcherInterface
-{
- /**
- * @var string|null
- */
- private $path;
-
- /**
- * @var string|null
- */
- private $host;
-
- /**
- * @var string[]
- */
- private $methods = array();
-
- /**
- * @var string[]
- */
- private $ips = array();
-
- /**
- * @var array
- */
- private $attributes = array();
-
- /**
- * @var string[]
- */
- private $schemes = array();
-
- /**
- * @param string|null $path
- * @param string|null $host
- * @param string|string[]|null $methods
- * @param string|string[]|null $ips
- * @param array $attributes
- * @param string|string[]|null $schemes
- */
- public function __construct($path = null, $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null)
- {
- $this->matchPath($path);
- $this->matchHost($host);
- $this->matchMethod($methods);
- $this->matchIps($ips);
- $this->matchScheme($schemes);
-
- foreach ($attributes as $k => $v) {
- $this->matchAttribute($k, $v);
- }
- }
-
- /**
- * Adds a check for the HTTP scheme.
- *
- * @param string|string[]|null $scheme An HTTP scheme or an array of HTTP schemes
- */
- public function matchScheme($scheme)
- {
- $this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : array();
- }
-
- /**
- * Adds a check for the URL host name.
- *
- * @param string|null $regexp A Regexp
- */
- public function matchHost($regexp)
- {
- $this->host = $regexp;
- }
-
- /**
- * Adds a check for the URL path info.
- *
- * @param string|null $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->matchIps($ip);
- }
-
- /**
- * Adds a check for the client IP.
- *
- * @param string|string[]|null $ips A specific IP address or a range specified using IP/netmask like 192.168.1.0/24
- */
- public function matchIps($ips)
- {
- $this->ips = null !== $ips ? (array) $ips : array();
- }
-
- /**
- * Adds a check for the HTTP method.
- *
- * @param string|string[]|null $method An HTTP method or an array of HTTP methods
- */
- public function matchMethod($method)
- {
- $this->methods = null !== $method ? array_map('strtoupper', (array) $method) : array();
- }
-
- /**
- * 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}
- */
- public function matches(Request $request)
- {
- if ($this->schemes && !in_array($request->getScheme(), $this->schemes, true)) {
- return false;
- }
-
- if ($this->methods && !in_array($request->getMethod(), $this->methods, true)) {
- return false;
- }
-
- foreach ($this->attributes as $key => $pattern) {
- if (!preg_match('{'.$pattern.'}', $request->attributes->get($key))) {
- return false;
- }
- }
-
- if (null !== $this->path && !preg_match('{'.$this->path.'}', rawurldecode($request->getPathInfo()))) {
- return false;
- }
-
- if (null !== $this->host && !preg_match('{'.$this->host.'}i', $request->getHost())) {
- return false;
- }
-
- if (IpUtils::checkIp($request->getClientIp(), $this->ips)) {
- return true;
- }
-
- // Note to future implementors: add additional checks above the
- // foreach above or else your check might not be run!
- return 0 === count($this->ips);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/RequestMatcherInterface.php b/assets/php/vendor/symfony/http-foundation/RequestMatcherInterface.php
deleted file mode 100755
index c26db3e..0000000
--- a/assets/php/vendor/symfony/http-foundation/RequestMatcherInterface.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\HttpFoundation;
-
-/**
- * RequestMatcherInterface is an interface for strategies to match a Request.
- *
- * @author Fabien Potencier
- */
-interface RequestMatcherInterface
-{
- /**
- * Decides whether the rule(s) implemented by the strategy matches the supplied request.
- *
- * @return bool true if the request matches, false otherwise
- */
- public function matches(Request $request);
-}
diff --git a/assets/php/vendor/symfony/http-foundation/RequestStack.php b/assets/php/vendor/symfony/http-foundation/RequestStack.php
deleted file mode 100755
index 3d9cfd0..0000000
--- a/assets/php/vendor/symfony/http-foundation/RequestStack.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\HttpFoundation;
-
-/**
- * Request stack that controls the lifecycle of requests.
- *
- * @author Benjamin Eberlei
- */
-class RequestStack
-{
- /**
- * @var Request[]
- */
- private $requests = array();
-
- /**
- * Pushes a Request on the stack.
- *
- * This method should generally not be called directly as the stack
- * management should be taken care of by the application itself.
- */
- public function push(Request $request)
- {
- $this->requests[] = $request;
- }
-
- /**
- * Pops the current request from the stack.
- *
- * This operation lets the current request go out of scope.
- *
- * This method should generally not be called directly as the stack
- * management should be taken care of by the application itself.
- *
- * @return Request|null
- */
- public function pop()
- {
- if (!$this->requests) {
- return;
- }
-
- return array_pop($this->requests);
- }
-
- /**
- * @return Request|null
- */
- public function getCurrentRequest()
- {
- return end($this->requests) ?: null;
- }
-
- /**
- * Gets the master Request.
- *
- * Be warned that making your code aware of the master request
- * might make it un-compatible with other features of your framework
- * like ESI support.
- *
- * @return Request|null
- */
- public function getMasterRequest()
- {
- if (!$this->requests) {
- return;
- }
-
- return $this->requests[0];
- }
-
- /**
- * Returns the parent request of the current.
- *
- * Be warned that making your code aware of the parent request
- * might make it un-compatible with other features of your framework
- * like ESI support.
- *
- * If current Request is the master request, it returns null.
- *
- * @return Request|null
- */
- public function getParentRequest()
- {
- $pos = count($this->requests) - 2;
-
- if (!isset($this->requests[$pos])) {
- return;
- }
-
- return $this->requests[$pos];
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Response.php b/assets/php/vendor/symfony/http-foundation/Response.php
deleted file mode 100755
index 6f8a623..0000000
--- a/assets/php/vendor/symfony/http-foundation/Response.php
+++ /dev/null
@@ -1,1298 +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
- */
-class Response
-{
- const HTTP_CONTINUE = 100;
- const HTTP_SWITCHING_PROTOCOLS = 101;
- const HTTP_PROCESSING = 102; // RFC2518
- const HTTP_OK = 200;
- const HTTP_CREATED = 201;
- const HTTP_ACCEPTED = 202;
- const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
- const HTTP_NO_CONTENT = 204;
- const HTTP_RESET_CONTENT = 205;
- const HTTP_PARTIAL_CONTENT = 206;
- const HTTP_MULTI_STATUS = 207; // RFC4918
- const HTTP_ALREADY_REPORTED = 208; // RFC5842
- const HTTP_IM_USED = 226; // RFC3229
- const HTTP_MULTIPLE_CHOICES = 300;
- const HTTP_MOVED_PERMANENTLY = 301;
- const HTTP_FOUND = 302;
- const HTTP_SEE_OTHER = 303;
- const HTTP_NOT_MODIFIED = 304;
- const HTTP_USE_PROXY = 305;
- const HTTP_RESERVED = 306;
- const HTTP_TEMPORARY_REDIRECT = 307;
- const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238
- const HTTP_BAD_REQUEST = 400;
- const HTTP_UNAUTHORIZED = 401;
- const HTTP_PAYMENT_REQUIRED = 402;
- const HTTP_FORBIDDEN = 403;
- const HTTP_NOT_FOUND = 404;
- const HTTP_METHOD_NOT_ALLOWED = 405;
- const HTTP_NOT_ACCEPTABLE = 406;
- const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
- const HTTP_REQUEST_TIMEOUT = 408;
- const HTTP_CONFLICT = 409;
- const HTTP_GONE = 410;
- const HTTP_LENGTH_REQUIRED = 411;
- const HTTP_PRECONDITION_FAILED = 412;
- const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
- const HTTP_REQUEST_URI_TOO_LONG = 414;
- const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
- const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
- const HTTP_EXPECTATION_FAILED = 417;
- const HTTP_I_AM_A_TEAPOT = 418; // RFC2324
- const HTTP_MISDIRECTED_REQUEST = 421; // RFC7540
- const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918
- const HTTP_LOCKED = 423; // RFC4918
- const HTTP_FAILED_DEPENDENCY = 424; // RFC4918
- const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817
- const HTTP_UPGRADE_REQUIRED = 426; // RFC2817
- const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
- const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
- const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
- const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
- const HTTP_INTERNAL_SERVER_ERROR = 500;
- const HTTP_NOT_IMPLEMENTED = 501;
- const HTTP_BAD_GATEWAY = 502;
- const HTTP_SERVICE_UNAVAILABLE = 503;
- const HTTP_GATEWAY_TIMEOUT = 504;
- const HTTP_VERSION_NOT_SUPPORTED = 505;
- const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295
- const HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918
- const HTTP_LOOP_DETECTED = 508; // RFC5842
- const HTTP_NOT_EXTENDED = 510; // RFC2774
- const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
-
- /**
- * @var \Symfony\Component\HttpFoundation\ResponseHeaderBag
- */
- public $headers;
-
- /**
- * @var string
- */
- protected $content;
-
- /**
- * @var string
- */
- protected $version;
-
- /**
- * @var int
- */
- protected $statusCode;
-
- /**
- * @var string
- */
- protected $statusText;
-
- /**
- * @var string
- */
- protected $charset;
-
- /**
- * Status codes translation table.
- *
- * The list of codes is complete according to the
- * {@link http://www.iana.org/assignments/http-status-codes/ Hypertext Transfer Protocol (HTTP) Status Code Registry}
- * (last updated 2016-03-01).
- *
- * Unless otherwise noted, the status code is defined in RFC2616.
- *
- * @var array
- */
- public static $statusTexts = array(
- 100 => 'Continue',
- 101 => 'Switching Protocols',
- 102 => 'Processing', // RFC2518
- 103 => 'Early Hints',
- 200 => 'OK',
- 201 => 'Created',
- 202 => 'Accepted',
- 203 => 'Non-Authoritative Information',
- 204 => 'No Content',
- 205 => 'Reset Content',
- 206 => 'Partial Content',
- 207 => 'Multi-Status', // RFC4918
- 208 => 'Already Reported', // RFC5842
- 226 => 'IM Used', // RFC3229
- 300 => 'Multiple Choices',
- 301 => 'Moved Permanently',
- 302 => 'Found',
- 303 => 'See Other',
- 304 => 'Not Modified',
- 305 => 'Use Proxy',
- 307 => 'Temporary Redirect',
- 308 => 'Permanent Redirect', // RFC7238
- 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 => 'Payload Too Large',
- 414 => 'URI Too Long',
- 415 => 'Unsupported Media Type',
- 416 => 'Range Not Satisfiable',
- 417 => 'Expectation Failed',
- 418 => 'I\'m a teapot', // RFC2324
- 421 => 'Misdirected Request', // RFC7540
- 422 => 'Unprocessable Entity', // RFC4918
- 423 => 'Locked', // RFC4918
- 424 => 'Failed Dependency', // RFC4918
- 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817
- 426 => 'Upgrade Required', // RFC2817
- 428 => 'Precondition Required', // RFC6585
- 429 => 'Too Many Requests', // RFC6585
- 431 => 'Request Header Fields Too Large', // RFC6585
- 451 => 'Unavailable For Legal Reasons', // RFC7725
- 500 => 'Internal Server Error',
- 501 => 'Not Implemented',
- 502 => 'Bad Gateway',
- 503 => 'Service Unavailable',
- 504 => 'Gateway Timeout',
- 505 => 'HTTP Version Not Supported',
- 506 => 'Variant Also Negotiates', // RFC2295
- 507 => 'Insufficient Storage', // RFC4918
- 508 => 'Loop Detected', // RFC5842
- 510 => 'Not Extended', // RFC2774
- 511 => 'Network Authentication Required', // RFC6585
- );
-
- /**
- * @param mixed $content The response content, see setContent()
- * @param int $status The response status code
- * @param array $headers An array of response headers
- *
- * @throws \InvalidArgumentException When the HTTP status code is not valid
- */
- public function __construct($content = '', $status = 200, $headers = array())
- {
- $this->headers = new ResponseHeaderBag($headers);
- $this->setContent($content);
- $this->setStatusCode($status);
- $this->setProtocolVersion('1.0');
- }
-
- /**
- * Factory method for chainability.
- *
- * Example:
- *
- * return Response::create($body, 200)
- * ->setSharedMaxAge(300);
- *
- * @param mixed $content The response content, see setContent()
- * @param int $status The response status code
- * @param array $headers An array of response headers
- *
- * @return static
- */
- public static function create($content = '', $status = 200, $headers = array())
- {
- return new static($content, $status, $headers);
- }
-
- /**
- * Returns the Response as an HTTP string.
- *
- * The string representation of the Response is the same as the
- * one that will be sent to the client only if the prepare() method
- * has been called before.
- *
- * @return string The Response as an HTTP string
- *
- * @see prepare()
- */
- public function __toString()
- {
- 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. Most of the changes are based on
- * the Request that is "associated" with this Response.
- *
- * @return $this
- */
- public function prepare(Request $request)
- {
- $headers = $this->headers;
-
- if ($this->isInformational() || $this->isEmpty()) {
- $this->setContent(null);
- $headers->remove('Content-Type');
- $headers->remove('Content-Length');
- } else {
- // Content-type based on the Request
- if (!$headers->has('Content-Type')) {
- $format = $request->getRequestFormat();
- if (null !== $format && $mimeType = $request->getMimeType($format)) {
- $headers->set('Content-Type', $mimeType);
- }
- }
-
- // Fix Content-Type
- $charset = $this->charset ?: 'UTF-8';
- if (!$headers->has('Content-Type')) {
- $headers->set('Content-Type', 'text/html; charset='.$charset);
- } elseif (0 === stripos($headers->get('Content-Type'), 'text/') && false === stripos($headers->get('Content-Type'), 'charset')) {
- // add the charset
- $headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset);
- }
-
- // Fix Content-Length
- if ($headers->has('Transfer-Encoding')) {
- $headers->remove('Content-Length');
- }
-
- if ($request->isMethod('HEAD')) {
- // cf. RFC2616 14.13
- $length = $headers->get('Content-Length');
- $this->setContent(null);
- if ($length) {
- $headers->set('Content-Length', $length);
- }
- }
- }
-
- // Fix protocol
- if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) {
- $this->setProtocolVersion('1.1');
- }
-
- // Check if we need to send extra expire info headers
- if ('1.0' == $this->getProtocolVersion() && false !== strpos($this->headers->get('Cache-Control'), 'no-cache')) {
- $this->headers->set('pragma', 'no-cache');
- $this->headers->set('expires', -1);
- }
-
- $this->ensureIEOverSSLCompatibility($request);
-
- return $this;
- }
-
- /**
- * Sends HTTP headers.
- *
- * @return $this
- */
- public function sendHeaders()
- {
- // headers have already been sent by the developer
- if (headers_sent()) {
- return $this;
- }
-
- // headers
- foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
- foreach ($values as $value) {
- header($name.': '.$value, false, $this->statusCode);
- }
- }
-
- // status
- header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
-
- // cookies
- foreach ($this->headers->getCookies() as $cookie) {
- if ($cookie->isRaw()) {
- setrawcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
- } else {
- setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
- }
- }
-
- return $this;
- }
-
- /**
- * Sends content for the current web response.
- *
- * @return $this
- */
- public function sendContent()
- {
- echo $this->content;
-
- return $this;
- }
-
- /**
- * Sends HTTP headers and content.
- *
- * @return $this
- */
- public function send()
- {
- $this->sendHeaders();
- $this->sendContent();
-
- if (function_exists('fastcgi_finish_request')) {
- fastcgi_finish_request();
- } elseif (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
- static::closeOutputBuffers(0, true);
- }
-
- return $this;
- }
-
- /**
- * Sets the response content.
- *
- * Valid types are strings, numbers, null, and objects that implement a __toString() method.
- *
- * @param mixed $content Content that can be cast to string
- *
- * @return $this
- *
- * @throws \UnexpectedValueException
- */
- public function setContent($content)
- {
- if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array($content, '__toString'))) {
- throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content)));
- }
-
- $this->content = (string) $content;
-
- return $this;
- }
-
- /**
- * Gets the current response content.
- *
- * @return string Content
- */
- public function getContent()
- {
- return $this->content;
- }
-
- /**
- * Sets the HTTP protocol version (1.0 or 1.1).
- *
- * @param string $version The HTTP protocol version
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setProtocolVersion($version)
- {
- $this->version = $version;
-
- return $this;
- }
-
- /**
- * Gets the HTTP protocol version.
- *
- * @return string The HTTP protocol version
- *
- * @final since version 3.2
- */
- public function getProtocolVersion()
- {
- return $this->version;
- }
-
- /**
- * Sets the response status code.
- *
- * If the status text is null it will be automatically populated for the known
- * status codes and left empty otherwise.
- *
- * @param int $code HTTP status code
- * @param mixed $text HTTP status text
- *
- * @return $this
- *
- * @throws \InvalidArgumentException When the HTTP status code is not valid
- *
- * @final since version 3.2
- */
- public function setStatusCode($code, $text = null)
- {
- $this->statusCode = $code = (int) $code;
- if ($this->isInvalid()) {
- throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code));
- }
-
- if (null === $text) {
- $this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : 'unknown status';
-
- return $this;
- }
-
- if (false === $text) {
- $this->statusText = '';
-
- return $this;
- }
-
- $this->statusText = $text;
-
- return $this;
- }
-
- /**
- * Retrieves the status code for the current web response.
- *
- * @return int Status code
- *
- * @final since version 3.2
- */
- public function getStatusCode()
- {
- return $this->statusCode;
- }
-
- /**
- * Sets the response charset.
- *
- * @param string $charset Character set
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setCharset($charset)
- {
- $this->charset = $charset;
-
- return $this;
- }
-
- /**
- * Retrieves the response charset.
- *
- * @return string Character set
- *
- * @final since version 3.2
- */
- 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 bool true if the response is worth caching, false otherwise
- *
- * @final since version 3.3
- */
- 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 Expires header and the calculated age is less than the freshness lifetime.
- *
- * @return bool true if the response is fresh, false otherwise
- *
- * @final since version 3.3
- */
- 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 bool true if the response is validateable, false otherwise
- *
- * @final since version 3.3
- */
- 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.
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setPrivate()
- {
- $this->headers->removeCacheControlDirective('public');
- $this->headers->addCacheControlDirective('private');
-
- return $this;
- }
-
- /**
- * Marks the response as "public".
- *
- * It makes the response eligible for serving other clients.
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setPublic()
- {
- $this->headers->addCacheControlDirective('public');
- $this->headers->removeCacheControlDirective('private');
-
- return $this;
- }
-
- /**
- * Marks the response as "immutable".
- *
- * @param bool $immutable enables or disables the immutable directive
- *
- * @return $this
- *
- * @final
- */
- public function setImmutable($immutable = true)
- {
- if ($immutable) {
- $this->headers->addCacheControlDirective('immutable');
- } else {
- $this->headers->removeCacheControlDirective('immutable');
- }
-
- return $this;
- }
-
- /**
- * Returns true if the response is marked as "immutable".
- *
- * @return bool returns true if the response is marked as "immutable"; otherwise false
- *
- * @final
- */
- public function isImmutable()
- {
- return $this->headers->hasCacheControlDirective('immutable');
- }
-
- /**
- * 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 bool true if the response must be revalidated by a cache, false otherwise
- *
- * @final since version 3.3
- */
- public function mustRevalidate()
- {
- return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate');
- }
-
- /**
- * Returns the Date header as a DateTime instance.
- *
- * @return \DateTime A \DateTime instance
- *
- * @throws \RuntimeException When the header is not parseable
- *
- * @final since version 3.2
- */
- public function getDate()
- {
- return $this->headers->getDate('Date');
- }
-
- /**
- * Sets the Date header.
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setDate(\DateTime $date)
- {
- $date->setTimezone(new \DateTimeZone('UTC'));
- $this->headers->set('Date', $date->format('D, d M Y H:i:s').' GMT');
-
- return $this;
- }
-
- /**
- * Returns the age of the response.
- *
- * @return int The age of the response in seconds
- *
- * @final since version 3.2
- */
- public function getAge()
- {
- if (null !== $age = $this->headers->get('Age')) {
- return (int) $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.
- *
- * @return $this
- */
- public function expire()
- {
- if ($this->isFresh()) {
- $this->headers->set('Age', $this->getMaxAge());
- }
-
- return $this;
- }
-
- /**
- * Returns the value of the Expires header as a DateTime instance.
- *
- * @return \DateTime|null A DateTime instance or null if the header does not exist
- *
- * @final since version 3.2
- */
- public function getExpires()
- {
- try {
- return $this->headers->getDate('Expires');
- } catch (\RuntimeException $e) {
- // according to RFC 2616 invalid date formats (e.g. "0" and "-1") must be treated as in the past
- return \DateTime::createFromFormat(DATE_RFC2822, 'Sat, 01 Jan 00 00:00:00 +0000');
- }
- }
-
- /**
- * Sets the Expires HTTP header with a DateTime instance.
- *
- * Passing null as value will remove the header.
- *
- * @param \DateTime|null $date A \DateTime instance or null to remove the header
- *
- * @return $this
- *
- * @final since version 3.2
- */
- 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');
- }
-
- return $this;
- }
-
- /**
- * Returns the number of seconds after the time specified in the response's Date
- * header when 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 int|null Number of seconds
- *
- * @final since version 3.2
- */
- public function getMaxAge()
- {
- if ($this->headers->hasCacheControlDirective('s-maxage')) {
- return (int) $this->headers->getCacheControlDirective('s-maxage');
- }
-
- if ($this->headers->hasCacheControlDirective('max-age')) {
- return (int) $this->headers->getCacheControlDirective('max-age');
- }
-
- if (null !== $this->getExpires()) {
- return $this->getExpires()->format('U') - $this->getDate()->format('U');
- }
- }
-
- /**
- * 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 int $value Number of seconds
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setMaxAge($value)
- {
- $this->headers->addCacheControlDirective('max-age', $value);
-
- return $this;
- }
-
- /**
- * 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 int $value Number of seconds
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setSharedMaxAge($value)
- {
- $this->setPublic();
- $this->headers->addCacheControlDirective('s-maxage', $value);
-
- return $this;
- }
-
- /**
- * 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 int|null The TTL in seconds
- *
- * @final since version 3.2
- */
- public function getTtl()
- {
- if (null !== $maxAge = $this->getMaxAge()) {
- return $maxAge - $this->getAge();
- }
- }
-
- /**
- * Sets the response's time-to-live for shared caches.
- *
- * This method adjusts the Cache-Control/s-maxage directive.
- *
- * @param int $seconds Number of seconds
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setTtl($seconds)
- {
- $this->setSharedMaxAge($this->getAge() + $seconds);
-
- return $this;
- }
-
- /**
- * Sets the response's time-to-live for private/client caches.
- *
- * This method adjusts the Cache-Control/max-age directive.
- *
- * @param int $seconds Number of seconds
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setClientTtl($seconds)
- {
- $this->setMaxAge($this->getAge() + $seconds);
-
- return $this;
- }
-
- /**
- * Returns the Last-Modified HTTP header as a DateTime instance.
- *
- * @return \DateTime|null A DateTime instance or null if the header does not exist
- *
- * @throws \RuntimeException When the HTTP header is not parseable
- *
- * @final since version 3.2
- */
- public function getLastModified()
- {
- return $this->headers->getDate('Last-Modified');
- }
-
- /**
- * Sets the Last-Modified HTTP header with a DateTime instance.
- *
- * Passing null as value will remove the header.
- *
- * @param \DateTime|null $date A \DateTime instance or null to remove the header
- *
- * @return $this
- *
- * @final since version 3.2
- */
- 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');
- }
-
- return $this;
- }
-
- /**
- * Returns the literal value of the ETag HTTP header.
- *
- * @return string|null The ETag HTTP header or null if it does not exist
- *
- * @final since version 3.2
- */
- public function getEtag()
- {
- return $this->headers->get('ETag');
- }
-
- /**
- * Sets the ETag value.
- *
- * @param string|null $etag The ETag unique identifier or null to remove the header
- * @param bool $weak Whether you want a weak ETag or not
- *
- * @return $this
- *
- * @final since version 3.2
- */
- 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);
- }
-
- return $this;
- }
-
- /**
- * Sets the response's cache headers (validation and/or expiration).
- *
- * Available options are: etag, last_modified, max_age, s_maxage, private, public and immutable.
- *
- * @param array $options An array of cache options
- *
- * @return $this
- *
- * @throws \InvalidArgumentException
- *
- * @final since version 3.3
- */
- public function setCache(array $options)
- {
- if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) {
- 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();
- }
- }
-
- if (isset($options['immutable'])) {
- $this->setImmutable((bool) $options['immutable']);
- }
-
- return $this;
- }
-
- /**
- * 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.
- *
- * @return $this
- *
- * @see http://tools.ietf.org/html/rfc2616#section-10.3.5
- *
- * @final since version 3.3
- */
- 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);
- }
-
- return $this;
- }
-
- /**
- * Returns true if the response includes a Vary header.
- *
- * @return bool true if the response includes a Vary header, false otherwise
- *
- * @final since version 3.2
- */
- public function hasVary()
- {
- return null !== $this->headers->get('Vary');
- }
-
- /**
- * Returns an array of header names given in the Vary header.
- *
- * @return array An array of Vary names
- *
- * @final since version 3.2
- */
- public function getVary()
- {
- if (!$vary = $this->headers->get('Vary', null, false)) {
- return array();
- }
-
- $ret = array();
- foreach ($vary as $item) {
- $ret = array_merge($ret, preg_split('/[\s,]+/', $item));
- }
-
- return $ret;
- }
-
- /**
- * Sets the Vary header.
- *
- * @param string|array $headers
- * @param bool $replace Whether to replace the actual value or not (true by default)
- *
- * @return $this
- *
- * @final since version 3.2
- */
- public function setVary($headers, $replace = true)
- {
- $this->headers->set('Vary', $headers, $replace);
-
- return $this;
- }
-
- /**
- * 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.
- *
- * @return bool true if the Response validators match the Request, false otherwise
- *
- * @final since version 3.3
- */
- public function isNotModified(Request $request)
- {
- if (!$request->isMethodCacheable()) {
- return false;
- }
-
- $notModified = false;
- $lastModified = $this->headers->get('Last-Modified');
- $modifiedSince = $request->headers->get('If-Modified-Since');
-
- if ($etags = $request->getETags()) {
- $notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags);
- }
-
- if ($modifiedSince && $lastModified) {
- $notModified = strtotime($modifiedSince) >= strtotime($lastModified) && (!$etags || $notModified);
- }
-
- if ($notModified) {
- $this->setNotModified();
- }
-
- return $notModified;
- }
-
- /**
- * Is response invalid?
- *
- * @return bool
- *
- * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
- *
- * @final since version 3.2
- */
- public function isInvalid()
- {
- return $this->statusCode < 100 || $this->statusCode >= 600;
- }
-
- /**
- * Is response informative?
- *
- * @return bool
- *
- * @final since version 3.3
- */
- public function isInformational()
- {
- return $this->statusCode >= 100 && $this->statusCode < 200;
- }
-
- /**
- * Is response successful?
- *
- * @return bool
- *
- * @final since version 3.2
- */
- public function isSuccessful()
- {
- return $this->statusCode >= 200 && $this->statusCode < 300;
- }
-
- /**
- * Is the response a redirect?
- *
- * @return bool
- *
- * @final since version 3.2
- */
- public function isRedirection()
- {
- return $this->statusCode >= 300 && $this->statusCode < 400;
- }
-
- /**
- * Is there a client error?
- *
- * @return bool
- *
- * @final since version 3.2
- */
- public function isClientError()
- {
- return $this->statusCode >= 400 && $this->statusCode < 500;
- }
-
- /**
- * Was there a server side error?
- *
- * @return bool
- *
- * @final since version 3.3
- */
- public function isServerError()
- {
- return $this->statusCode >= 500 && $this->statusCode < 600;
- }
-
- /**
- * Is the response OK?
- *
- * @return bool
- *
- * @final since version 3.2
- */
- public function isOk()
- {
- return 200 === $this->statusCode;
- }
-
- /**
- * Is the response forbidden?
- *
- * @return bool
- *
- * @final since version 3.2
- */
- public function isForbidden()
- {
- return 403 === $this->statusCode;
- }
-
- /**
- * Is the response a not found error?
- *
- * @return bool
- *
- * @final since version 3.2
- */
- public function isNotFound()
- {
- return 404 === $this->statusCode;
- }
-
- /**
- * Is the response a redirect of some form?
- *
- * @param string $location
- *
- * @return bool
- *
- * @final since version 3.2
- */
- public function isRedirect($location = null)
- {
- return in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location'));
- }
-
- /**
- * Is the response empty?
- *
- * @return bool
- *
- * @final since version 3.2
- */
- public function isEmpty()
- {
- return in_array($this->statusCode, array(204, 304));
- }
-
- /**
- * Cleans or flushes output buffers up to target level.
- *
- * Resulting level can be greater than target level if a non-removable buffer has been encountered.
- *
- * @param int $targetLevel The target output buffering level
- * @param bool $flush Whether to flush or clean the buffers
- *
- * @final since version 3.3
- */
- public static function closeOutputBuffers($targetLevel, $flush)
- {
- $status = ob_get_status(true);
- $level = count($status);
- // PHP_OUTPUT_HANDLER_* are not defined on HHVM 3.3
- $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
-
- while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & $flags) === $flags : $s['del'])) {
- if ($flush) {
- ob_end_flush();
- } else {
- ob_end_clean();
- }
- }
- }
-
- /**
- * Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9.
- *
- * @see http://support.microsoft.com/kb/323308
- *
- * @final since version 3.3
- */
- protected function ensureIEOverSSLCompatibility(Request $request)
- {
- if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && 1 == preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) && true === $request->isSecure()) {
- if ((int) preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) {
- $this->headers->remove('Cache-Control');
- }
- }
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/ResponseHeaderBag.php b/assets/php/vendor/symfony/http-foundation/ResponseHeaderBag.php
deleted file mode 100755
index 11a8593..0000000
--- a/assets/php/vendor/symfony/http-foundation/ResponseHeaderBag.php
+++ /dev/null
@@ -1,340 +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
- */
-class ResponseHeaderBag extends HeaderBag
-{
- const COOKIES_FLAT = 'flat';
- const COOKIES_ARRAY = 'array';
-
- const DISPOSITION_ATTACHMENT = 'attachment';
- const DISPOSITION_INLINE = 'inline';
-
- protected $computedCacheControl = array();
- protected $cookies = array();
- protected $headerNames = array();
-
- public function __construct(array $headers = array())
- {
- parent::__construct($headers);
-
- if (!isset($this->headers['cache-control'])) {
- $this->set('Cache-Control', '');
- }
-
- /* RFC2616 - 14.18 says all Responses need to have a Date */
- if (!isset($this->headers['date'])) {
- $this->initDate();
- }
- }
-
- /**
- * Returns the headers, with original capitalizations.
- *
- * @return array An array of headers
- */
- public function allPreserveCase()
- {
- $headers = array();
- foreach ($this->all() as $name => $value) {
- $headers[isset($this->headerNames[$name]) ? $this->headerNames[$name] : $name] = $value;
- }
-
- return $headers;
- }
-
- public function allPreserveCaseWithoutCookies()
- {
- $headers = $this->allPreserveCase();
- if (isset($this->headerNames['set-cookie'])) {
- unset($headers[$this->headerNames['set-cookie']]);
- }
-
- return $headers;
- }
-
- /**
- * {@inheritdoc}
- */
- public function replace(array $headers = array())
- {
- $this->headerNames = array();
-
- parent::replace($headers);
-
- if (!isset($this->headers['cache-control'])) {
- $this->set('Cache-Control', '');
- }
-
- if (!isset($this->headers['date'])) {
- $this->initDate();
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function all()
- {
- $headers = parent::all();
- foreach ($this->getCookies() as $cookie) {
- $headers['set-cookie'][] = (string) $cookie;
- }
-
- return $headers;
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($key, $values, $replace = true)
- {
- $uniqueKey = str_replace('_', '-', strtolower($key));
-
- if ('set-cookie' === $uniqueKey) {
- if ($replace) {
- $this->cookies = array();
- }
- foreach ((array) $values as $cookie) {
- $this->setCookie(Cookie::fromString($cookie));
- }
- $this->headerNames[$uniqueKey] = $key;
-
- return;
- }
-
- $this->headerNames[$uniqueKey] = $key;
-
- parent::set($key, $values, $replace);
-
- // ensure the cache-control header has sensible defaults
- if (\in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'), true)) {
- $computed = $this->computeCacheControlValue();
- $this->headers['cache-control'] = array($computed);
- $this->headerNames['cache-control'] = 'Cache-Control';
- $this->computedCacheControl = $this->parseCacheControl($computed);
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function remove($key)
- {
- $uniqueKey = str_replace('_', '-', strtolower($key));
- unset($this->headerNames[$uniqueKey]);
-
- if ('set-cookie' === $uniqueKey) {
- $this->cookies = array();
-
- return;
- }
-
- parent::remove($key);
-
- if ('cache-control' === $uniqueKey) {
- $this->computedCacheControl = array();
- }
-
- if ('date' === $uniqueKey) {
- $this->initDate();
- }
- }
-
- /**
- * {@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;
- }
-
- public function setCookie(Cookie $cookie)
- {
- $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
- $this->headerNames['set-cookie'] = 'Set-Cookie';
- }
-
- /**
- * Removes a cookie from the array, but does not unset it in the browser.
- *
- * @param string $name
- * @param string $path
- * @param string $domain
- */
- 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]);
- }
- }
-
- if (empty($this->cookies)) {
- unset($this->headerNames['set-cookie']);
- }
- }
-
- /**
- * Returns an array with all cookies.
- *
- * @param string $format
- *
- * @return array
- *
- * @throws \InvalidArgumentException When the $format is invalid
- */
- 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
- * @param bool $secure
- * @param bool $httpOnly
- */
- public function clearCookie($name, $path = '/', $domain = null, $secure = false, $httpOnly = true)
- {
- $this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly));
- }
-
- /**
- * Generates a HTTP Content-Disposition field-value.
- *
- * @param string $disposition One of "inline" or "attachment"
- * @param string $filename A unicode string
- * @param string $filenameFallback A string containing only ASCII characters that
- * is semantically equivalent to $filename. If the filename is already ASCII,
- * it can be omitted, or just copied from $filename
- *
- * @return string A string suitable for use as a Content-Disposition field-value
- *
- * @throws \InvalidArgumentException
- *
- * @see RFC 6266
- */
- public function makeDisposition($disposition, $filename, $filenameFallback = '')
- {
- if (!in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) {
- throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE));
- }
-
- if ('' == $filenameFallback) {
- $filenameFallback = $filename;
- }
-
- // filenameFallback is not ASCII.
- if (!preg_match('/^[\x20-\x7e]*$/', $filenameFallback)) {
- throw new \InvalidArgumentException('The filename fallback must only contain ASCII characters.');
- }
-
- // percent characters aren't safe in fallback.
- if (false !== strpos($filenameFallback, '%')) {
- throw new \InvalidArgumentException('The filename fallback cannot contain the "%" character.');
- }
-
- // path separators aren't allowed in either.
- if (false !== strpos($filename, '/') || false !== strpos($filename, '\\') || false !== strpos($filenameFallback, '/') || false !== strpos($filenameFallback, '\\')) {
- throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.');
- }
-
- $output = sprintf('%s; filename="%s"', $disposition, str_replace('"', '\\"', $filenameFallback));
-
- if ($filename !== $filenameFallback) {
- $output .= sprintf("; filename*=utf-8''%s", rawurlencode($filename));
- }
-
- return $output;
- }
-
- /**
- * 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, private';
- }
-
- 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;
- }
-
- private function initDate()
- {
- $now = \DateTime::createFromFormat('U', time());
- $now->setTimezone(new \DateTimeZone('UTC'));
- $this->set('Date', $now->format('D, d M Y H:i:s').' GMT');
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/ServerBag.php b/assets/php/vendor/symfony/http-foundation/ServerBag.php
deleted file mode 100755
index 19d2022..0000000
--- a/assets/php/vendor/symfony/http-foundation/ServerBag.php
+++ /dev/null
@@ -1,102 +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
- * @author Robert Kiss
- */
-class ServerBag extends ParameterBag
-{
- /**
- * Gets the HTTP headers.
- *
- * @return array
- */
- public function getHeaders()
- {
- $headers = array();
- $contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true);
- foreach ($this->parameters as $key => $value) {
- if (0 === strpos($key, 'HTTP_')) {
- $headers[substr($key, 5)] = $value;
- }
- // CONTENT_* are not prefixed with HTTP_
- elseif (isset($contentHeaders[$key])) {
- $headers[$key] = $value;
- }
- }
-
- if (isset($this->parameters['PHP_AUTH_USER'])) {
- $headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER'];
- $headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : '';
- } else {
- /*
- * php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
- * For this workaround to work, add these lines to your .htaccess file:
- * RewriteCond %{HTTP:Authorization} ^(.+)$
- * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
- *
- * A sample .htaccess file:
- * RewriteEngine On
- * RewriteCond %{HTTP:Authorization} ^(.+)$
- * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
- * RewriteCond %{REQUEST_FILENAME} !-f
- * RewriteRule ^(.*)$ app.php [QSA,L]
- */
-
- $authorizationHeader = null;
- if (isset($this->parameters['HTTP_AUTHORIZATION'])) {
- $authorizationHeader = $this->parameters['HTTP_AUTHORIZATION'];
- } elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) {
- $authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION'];
- }
-
- if (null !== $authorizationHeader) {
- if (0 === stripos($authorizationHeader, 'basic ')) {
- // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic
- $exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2);
- if (2 == count($exploded)) {
- list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
- }
- } elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader, 'digest '))) {
- // In some circumstances PHP_AUTH_DIGEST needs to be set
- $headers['PHP_AUTH_DIGEST'] = $authorizationHeader;
- $this->parameters['PHP_AUTH_DIGEST'] = $authorizationHeader;
- } elseif (0 === stripos($authorizationHeader, 'bearer ')) {
- /*
- * XXX: Since there is no PHP_AUTH_BEARER in PHP predefined variables,
- * I'll just set $headers['AUTHORIZATION'] here.
- * http://php.net/manual/en/reserved.variables.server.php
- */
- $headers['AUTHORIZATION'] = $authorizationHeader;
- }
- }
- }
-
- if (isset($headers['AUTHORIZATION'])) {
- return $headers;
- }
-
- // PHP_AUTH_USER/PHP_AUTH_PW
- if (isset($headers['PHP_AUTH_USER'])) {
- $headers['AUTHORIZATION'] = 'Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']);
- } elseif (isset($headers['PHP_AUTH_DIGEST'])) {
- $headers['AUTHORIZATION'] = $headers['PHP_AUTH_DIGEST'];
- }
-
- return $headers;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/assets/php/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php
deleted file mode 100755
index ea1fda2..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php
+++ /dev/null
@@ -1,148 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Session\Attribute;
-
-/**
- * This class relates to session attribute storage.
- */
-class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable
-{
- private $name = 'attributes';
- private $storageKey;
-
- protected $attributes = array();
-
- /**
- * @param string $storageKey The key used to store attributes in the session
- */
- public function __construct($storageKey = '_sf2_attributes')
- {
- $this->storageKey = $storageKey;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->name;
- }
-
- public function setName($name)
- {
- $this->name = $name;
- }
-
- /**
- * {@inheritdoc}
- */
- public function initialize(array &$attributes)
- {
- $this->attributes = &$attributes;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStorageKey()
- {
- return $this->storageKey;
- }
-
- /**
- * {@inheritdoc}
- */
- public function has($name)
- {
- return array_key_exists($name, $this->attributes);
- }
-
- /**
- * {@inheritdoc}
- */
- public function get($name, $default = null)
- {
- return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($name, $value)
- {
- $this->attributes[$name] = $value;
- }
-
- /**
- * {@inheritdoc}
- */
- public function all()
- {
- return $this->attributes;
- }
-
- /**
- * {@inheritdoc}
- */
- public function replace(array $attributes)
- {
- $this->attributes = array();
- foreach ($attributes as $key => $value) {
- $this->set($key, $value);
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function remove($name)
- {
- $retval = null;
- if (array_key_exists($name, $this->attributes)) {
- $retval = $this->attributes[$name];
- unset($this->attributes[$name]);
- }
-
- return $retval;
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- $return = $this->attributes;
- $this->attributes = array();
-
- return $return;
- }
-
- /**
- * Returns an iterator for attributes.
- *
- * @return \ArrayIterator An \ArrayIterator instance
- */
- public function getIterator()
- {
- return new \ArrayIterator($this->attributes);
- }
-
- /**
- * Returns the number of attributes.
- *
- * @return int The number of attributes
- */
- public function count()
- {
- return count($this->attributes);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php b/assets/php/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php
deleted file mode 100755
index 0d8d179..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.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\HttpFoundation\Session\Attribute;
-
-use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
-
-/**
- * Attributes store.
- *
- * @author Drak
- */
-interface AttributeBagInterface extends SessionBagInterface
-{
- /**
- * Checks if an attribute is defined.
- *
- * @param string $name The attribute name
- *
- * @return bool true if the attribute is defined, false otherwise
- */
- public function has($name);
-
- /**
- * Returns an attribute.
- *
- * @param string $name The attribute name
- * @param mixed $default The default value if not found
- *
- * @return mixed
- */
- public function get($name, $default = null);
-
- /**
- * Sets an attribute.
- *
- * @param string $name
- * @param mixed $value
- */
- public function set($name, $value);
-
- /**
- * Returns attributes.
- *
- * @return array Attributes
- */
- public function all();
-
- /**
- * Sets attributes.
- *
- * @param array $attributes Attributes
- */
- public function replace(array $attributes);
-
- /**
- * Removes an attribute.
- *
- * @param string $name
- *
- * @return mixed The removed value or null when it does not exist
- */
- public function remove($name);
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/assets/php/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
deleted file mode 100755
index abbf37e..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
+++ /dev/null
@@ -1,153 +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\Session\Attribute;
-
-/**
- * This class provides structured storage of session attributes using
- * a name spacing character in the key.
- *
- * @author Drak
- */
-class NamespacedAttributeBag extends AttributeBag
-{
- private $namespaceCharacter;
-
- /**
- * @param string $storageKey Session storage key
- * @param string $namespaceCharacter Namespace character to use in keys
- */
- public function __construct($storageKey = '_sf2_attributes', $namespaceCharacter = '/')
- {
- $this->namespaceCharacter = $namespaceCharacter;
- parent::__construct($storageKey);
- }
-
- /**
- * {@inheritdoc}
- */
- public function has($name)
- {
- // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is
- $attributes = $this->resolveAttributePath($name);
- $name = $this->resolveKey($name);
-
- if (null === $attributes) {
- return false;
- }
-
- return array_key_exists($name, $attributes);
- }
-
- /**
- * {@inheritdoc}
- */
- public function get($name, $default = null)
- {
- // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is
- $attributes = $this->resolveAttributePath($name);
- $name = $this->resolveKey($name);
-
- if (null === $attributes) {
- return $default;
- }
-
- return array_key_exists($name, $attributes) ? $attributes[$name] : $default;
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($name, $value)
- {
- $attributes = &$this->resolveAttributePath($name, true);
- $name = $this->resolveKey($name);
- $attributes[$name] = $value;
- }
-
- /**
- * {@inheritdoc}
- */
- public function remove($name)
- {
- $retval = null;
- $attributes = &$this->resolveAttributePath($name);
- $name = $this->resolveKey($name);
- if (null !== $attributes && array_key_exists($name, $attributes)) {
- $retval = $attributes[$name];
- unset($attributes[$name]);
- }
-
- return $retval;
- }
-
- /**
- * Resolves a path in attributes property and returns it as a reference.
- *
- * This method allows structured namespacing of session attributes.
- *
- * @param string $name Key name
- * @param bool $writeContext Write context, default false
- *
- * @return array
- */
- protected function &resolveAttributePath($name, $writeContext = false)
- {
- $array = &$this->attributes;
- $name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name;
-
- // Check if there is anything to do, else return
- if (!$name) {
- return $array;
- }
-
- $parts = explode($this->namespaceCharacter, $name);
- if (count($parts) < 2) {
- if (!$writeContext) {
- return $array;
- }
-
- $array[$parts[0]] = array();
-
- return $array;
- }
-
- unset($parts[count($parts) - 1]);
-
- foreach ($parts as $part) {
- if (null !== $array && !array_key_exists($part, $array)) {
- $array[$part] = $writeContext ? array() : null;
- }
-
- $array = &$array[$part];
- }
-
- return $array;
- }
-
- /**
- * Resolves the key from the name.
- *
- * This is the last part in a dot separated string.
- *
- * @param string $name
- *
- * @return string
- */
- protected function resolveKey($name)
- {
- if (false !== $pos = strrpos($name, $this->namespaceCharacter)) {
- $name = substr($name, $pos + 1);
- }
-
- return $name;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/assets/php/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php
deleted file mode 100755
index 77521c2..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php
+++ /dev/null
@@ -1,161 +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\Session\Flash;
-
-/**
- * AutoExpireFlashBag flash message container.
- *
- * @author Drak
- */
-class AutoExpireFlashBag implements FlashBagInterface
-{
- private $name = 'flashes';
- private $flashes = array('display' => array(), 'new' => array());
- private $storageKey;
-
- /**
- * @param string $storageKey The key used to store flashes in the session
- */
- public function __construct($storageKey = '_symfony_flashes')
- {
- $this->storageKey = $storageKey;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->name;
- }
-
- public function setName($name)
- {
- $this->name = $name;
- }
-
- /**
- * {@inheritdoc}
- */
- public function initialize(array &$flashes)
- {
- $this->flashes = &$flashes;
-
- // The logic: messages from the last request will be stored in new, so we move them to previous
- // This request we will show what is in 'display'. What is placed into 'new' this time round will
- // be moved to display next time round.
- $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array();
- $this->flashes['new'] = array();
- }
-
- /**
- * {@inheritdoc}
- */
- public function add($type, $message)
- {
- $this->flashes['new'][$type][] = $message;
- }
-
- /**
- * {@inheritdoc}
- */
- public function peek($type, array $default = array())
- {
- return $this->has($type) ? $this->flashes['display'][$type] : $default;
- }
-
- /**
- * {@inheritdoc}
- */
- public function peekAll()
- {
- return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array();
- }
-
- /**
- * {@inheritdoc}
- */
- public function get($type, array $default = array())
- {
- $return = $default;
-
- if (!$this->has($type)) {
- return $return;
- }
-
- if (isset($this->flashes['display'][$type])) {
- $return = $this->flashes['display'][$type];
- unset($this->flashes['display'][$type]);
- }
-
- return $return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function all()
- {
- $return = $this->flashes['display'];
- $this->flashes['display'] = array();
-
- return $return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setAll(array $messages)
- {
- $this->flashes['new'] = $messages;
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($type, $messages)
- {
- $this->flashes['new'][$type] = (array) $messages;
- }
-
- /**
- * {@inheritdoc}
- */
- public function has($type)
- {
- return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
- }
-
- /**
- * {@inheritdoc}
- */
- public function keys()
- {
- return array_keys($this->flashes['display']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStorageKey()
- {
- return $this->storageKey;
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- return $this->all();
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/assets/php/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
deleted file mode 100755
index 12fb740..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
+++ /dev/null
@@ -1,152 +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\Session\Flash;
-
-/**
- * FlashBag flash message container.
- *
- * @author Drak
- */
-class FlashBag implements FlashBagInterface
-{
- private $name = 'flashes';
- private $flashes = array();
- private $storageKey;
-
- /**
- * @param string $storageKey The key used to store flashes in the session
- */
- public function __construct($storageKey = '_symfony_flashes')
- {
- $this->storageKey = $storageKey;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->name;
- }
-
- public function setName($name)
- {
- $this->name = $name;
- }
-
- /**
- * {@inheritdoc}
- */
- public function initialize(array &$flashes)
- {
- $this->flashes = &$flashes;
- }
-
- /**
- * {@inheritdoc}
- */
- public function add($type, $message)
- {
- $this->flashes[$type][] = $message;
- }
-
- /**
- * {@inheritdoc}
- */
- public function peek($type, array $default = array())
- {
- return $this->has($type) ? $this->flashes[$type] : $default;
- }
-
- /**
- * {@inheritdoc}
- */
- public function peekAll()
- {
- return $this->flashes;
- }
-
- /**
- * {@inheritdoc}
- */
- public function get($type, array $default = array())
- {
- if (!$this->has($type)) {
- return $default;
- }
-
- $return = $this->flashes[$type];
-
- unset($this->flashes[$type]);
-
- return $return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function all()
- {
- $return = $this->peekAll();
- $this->flashes = array();
-
- return $return;
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($type, $messages)
- {
- $this->flashes[$type] = (array) $messages;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setAll(array $messages)
- {
- $this->flashes = $messages;
- }
-
- /**
- * {@inheritdoc}
- */
- public function has($type)
- {
- return array_key_exists($type, $this->flashes) && $this->flashes[$type];
- }
-
- /**
- * {@inheritdoc}
- */
- public function keys()
- {
- return array_keys($this->flashes);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStorageKey()
- {
- return $this->storageKey;
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- return $this->all();
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/assets/php/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
deleted file mode 100755
index 80e97f1..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
+++ /dev/null
@@ -1,93 +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\Session\Flash;
-
-use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
-
-/**
- * FlashBagInterface.
- *
- * @author Drak
- */
-interface FlashBagInterface extends SessionBagInterface
-{
- /**
- * Adds a flash message for type.
- *
- * @param string $type
- * @param string $message
- */
- public function add($type, $message);
-
- /**
- * Registers a message for a given type.
- *
- * @param string $type
- * @param string|array $message
- */
- public function set($type, $message);
-
- /**
- * Gets flash messages for a given type.
- *
- * @param string $type Message category type
- * @param array $default Default value if $type does not exist
- *
- * @return array
- */
- public function peek($type, array $default = array());
-
- /**
- * Gets all flash messages.
- *
- * @return array
- */
- public function peekAll();
-
- /**
- * Gets and clears flash from the stack.
- *
- * @param string $type
- * @param array $default Default value if $type does not exist
- *
- * @return array
- */
- public function get($type, array $default = array());
-
- /**
- * Gets and clears flashes from the stack.
- *
- * @return array
- */
- public function all();
-
- /**
- * Sets all flash messages.
- */
- public function setAll(array $messages);
-
- /**
- * Has flash messages for a given type?
- *
- * @param string $type
- *
- * @return bool
- */
- public function has($type);
-
- /**
- * Returns a list of all defined types.
- *
- * @return array
- */
- public function keys();
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Session.php b/assets/php/vendor/symfony/http-foundation/Session/Session.php
deleted file mode 100755
index a46cffb..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Session.php
+++ /dev/null
@@ -1,273 +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\Session;
-
-use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
-use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
-use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
-use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
-use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
-
-/**
- * @author Fabien Potencier
- * @author Drak
- */
-class Session implements SessionInterface, \IteratorAggregate, \Countable
-{
- protected $storage;
-
- private $flashName;
- private $attributeName;
- private $data = array();
- private $hasBeenStarted;
-
- /**
- * @param SessionStorageInterface $storage A SessionStorageInterface instance
- * @param AttributeBagInterface $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag)
- * @param FlashBagInterface $flashes A FlashBagInterface instance (defaults null for default FlashBag)
- */
- public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null)
- {
- $this->storage = $storage ?: new NativeSessionStorage();
-
- $attributes = $attributes ?: new AttributeBag();
- $this->attributeName = $attributes->getName();
- $this->registerBag($attributes);
-
- $flashes = $flashes ?: new FlashBag();
- $this->flashName = $flashes->getName();
- $this->registerBag($flashes);
- }
-
- /**
- * {@inheritdoc}
- */
- public function start()
- {
- return $this->storage->start();
- }
-
- /**
- * {@inheritdoc}
- */
- public function has($name)
- {
- return $this->getAttributeBag()->has($name);
- }
-
- /**
- * {@inheritdoc}
- */
- public function get($name, $default = null)
- {
- return $this->getAttributeBag()->get($name, $default);
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($name, $value)
- {
- $this->getAttributeBag()->set($name, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function all()
- {
- return $this->getAttributeBag()->all();
- }
-
- /**
- * {@inheritdoc}
- */
- public function replace(array $attributes)
- {
- $this->getAttributeBag()->replace($attributes);
- }
-
- /**
- * {@inheritdoc}
- */
- public function remove($name)
- {
- return $this->getAttributeBag()->remove($name);
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- $this->getAttributeBag()->clear();
- }
-
- /**
- * {@inheritdoc}
- */
- public function isStarted()
- {
- return $this->storage->isStarted();
- }
-
- /**
- * Returns an iterator for attributes.
- *
- * @return \ArrayIterator An \ArrayIterator instance
- */
- public function getIterator()
- {
- return new \ArrayIterator($this->getAttributeBag()->all());
- }
-
- /**
- * Returns the number of attributes.
- *
- * @return int The number of attributes
- */
- public function count()
- {
- return count($this->getAttributeBag()->all());
- }
-
- /**
- * @return bool
- *
- * @internal
- */
- public function hasBeenStarted()
- {
- return $this->hasBeenStarted;
- }
-
- /**
- * @return bool
- *
- * @internal
- */
- public function isEmpty()
- {
- foreach ($this->data as &$data) {
- if (!empty($data)) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function invalidate($lifetime = null)
- {
- $this->storage->clear();
-
- return $this->migrate(true, $lifetime);
- }
-
- /**
- * {@inheritdoc}
- */
- public function migrate($destroy = false, $lifetime = null)
- {
- return $this->storage->regenerate($destroy, $lifetime);
- }
-
- /**
- * {@inheritdoc}
- */
- public function save()
- {
- $this->storage->save();
- }
-
- /**
- * {@inheritdoc}
- */
- public function getId()
- {
- return $this->storage->getId();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setId($id)
- {
- $this->storage->setId($id);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->storage->getName();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setName($name)
- {
- $this->storage->setName($name);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMetadataBag()
- {
- return $this->storage->getMetadataBag();
- }
-
- /**
- * {@inheritdoc}
- */
- public function registerBag(SessionBagInterface $bag)
- {
- $this->storage->registerBag(new SessionBagProxy($bag, $this->data, $this->hasBeenStarted));
- }
-
- /**
- * {@inheritdoc}
- */
- public function getBag($name)
- {
- return $this->storage->getBag($name)->getBag();
- }
-
- /**
- * Gets the flashbag interface.
- *
- * @return FlashBagInterface
- */
- public function getFlashBag()
- {
- return $this->getBag($this->flashName);
- }
-
- /**
- * Gets the attributebag interface.
- *
- * Note that this method was added to help with IDE autocompletion.
- *
- * @return AttributeBagInterface
- */
- private function getAttributeBag()
- {
- return $this->getBag($this->attributeName);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/SessionBagInterface.php b/assets/php/vendor/symfony/http-foundation/Session/SessionBagInterface.php
deleted file mode 100755
index 8e37d06..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/SessionBagInterface.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\HttpFoundation\Session;
-
-/**
- * Session Bag store.
- *
- * @author Drak
- */
-interface SessionBagInterface
-{
- /**
- * Gets this bag's name.
- *
- * @return string
- */
- public function getName();
-
- /**
- * Initializes the Bag.
- */
- public function initialize(array &$array);
-
- /**
- * Gets the storage key for this bag.
- *
- * @return string
- */
- public function getStorageKey();
-
- /**
- * Clears out data from bag.
- *
- * @return mixed Whatever data was contained
- */
- public function clear();
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/SessionBagProxy.php b/assets/php/vendor/symfony/http-foundation/Session/SessionBagProxy.php
deleted file mode 100755
index 307836d..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/SessionBagProxy.php
+++ /dev/null
@@ -1,82 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Session;
-
-/**
- * @author Nicolas Grekas
- *
- * @internal
- */
-final class SessionBagProxy implements SessionBagInterface
-{
- private $bag;
- private $data;
- private $hasBeenStarted;
-
- public function __construct(SessionBagInterface $bag, array &$data, &$hasBeenStarted)
- {
- $this->bag = $bag;
- $this->data = &$data;
- $this->hasBeenStarted = &$hasBeenStarted;
- }
-
- /**
- * @return SessionBagInterface
- */
- public function getBag()
- {
- return $this->bag;
- }
-
- /**
- * @return bool
- */
- public function isEmpty()
- {
- return empty($this->data[$this->bag->getStorageKey()]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->bag->getName();
- }
-
- /**
- * {@inheritdoc}
- */
- public function initialize(array &$array)
- {
- $this->hasBeenStarted = true;
- $this->data[$this->bag->getStorageKey()] = &$array;
-
- $this->bag->initialize($array);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStorageKey()
- {
- return $this->bag->getStorageKey();
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- return $this->bag->clear();
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/SessionInterface.php b/assets/php/vendor/symfony/http-foundation/Session/SessionInterface.php
deleted file mode 100755
index 95fca85..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/SessionInterface.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\Session;
-
-use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
-
-/**
- * Interface for the session.
- *
- * @author Drak
- */
-interface SessionInterface
-{
- /**
- * Starts the session storage.
- *
- * @return bool True if session started
- *
- * @throws \RuntimeException if session fails to start
- */
- public function start();
-
- /**
- * Returns the session ID.
- *
- * @return string The session ID
- */
- public function getId();
-
- /**
- * Sets the session ID.
- *
- * @param string $id
- */
- public function setId($id);
-
- /**
- * Returns the session name.
- *
- * @return mixed The session name
- */
- public function getName();
-
- /**
- * Sets the session name.
- *
- * @param string $name
- */
- public function setName($name);
-
- /**
- * Invalidates the current session.
- *
- * Clears all session attributes and flashes and regenerates the
- * session and deletes the old session from persistence.
- *
- * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
- * will leave the system settings unchanged, 0 sets the cookie
- * to expire with browser session. Time is in seconds, and is
- * not a Unix timestamp.
- *
- * @return bool True if session invalidated, false if error
- */
- public function invalidate($lifetime = null);
-
- /**
- * Migrates the current session to a new session id while maintaining all
- * session attributes.
- *
- * @param bool $destroy Whether to delete the old session or leave it to garbage collection
- * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
- * will leave the system settings unchanged, 0 sets the cookie
- * to expire with browser session. Time is in seconds, and is
- * not a Unix timestamp.
- *
- * @return bool True if session migrated, false if error
- */
- public function migrate($destroy = false, $lifetime = null);
-
- /**
- * Force the session to be saved and closed.
- *
- * This method is generally not required for real sessions as
- * the session will be automatically saved at the end of
- * code execution.
- */
- public function save();
-
- /**
- * Checks if an attribute is defined.
- *
- * @param string $name The attribute name
- *
- * @return bool true if the attribute is defined, false otherwise
- */
- public function has($name);
-
- /**
- * Returns an attribute.
- *
- * @param string $name The attribute name
- * @param mixed $default The default value if not found
- *
- * @return mixed
- */
- public function get($name, $default = null);
-
- /**
- * Sets an attribute.
- *
- * @param string $name
- * @param mixed $value
- */
- public function set($name, $value);
-
- /**
- * Returns attributes.
- *
- * @return array Attributes
- */
- public function all();
-
- /**
- * Sets attributes.
- *
- * @param array $attributes Attributes
- */
- public function replace(array $attributes);
-
- /**
- * Removes an attribute.
- *
- * @param string $name
- *
- * @return mixed The removed value or null when it does not exist
- */
- public function remove($name);
-
- /**
- * Clears all attributes.
- */
- public function clear();
-
- /**
- * Checks if the session was started.
- *
- * @return bool
- */
- public function isStarted();
-
- /**
- * Registers a SessionBagInterface with the session.
- */
- public function registerBag(SessionBagInterface $bag);
-
- /**
- * Gets a bag instance by name.
- *
- * @param string $name
- *
- * @return SessionBagInterface
- */
- public function getBag($name);
-
- /**
- * Gets session meta.
- *
- * @return MetadataBag
- */
- public function getMetadataBag();
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
deleted file mode 100755
index 6ae1355..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
+++ /dev/null
@@ -1,168 +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\Session\Storage\Handler;
-
-/**
- * This abstract session handler provides a generic implementation
- * of the PHP 7.0 SessionUpdateTimestampHandlerInterface,
- * enabling strict and lazy session handling.
- *
- * @author Nicolas Grekas
- */
-abstract class AbstractSessionHandler implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface
-{
- private $sessionName;
- private $prefetchId;
- private $prefetchData;
- private $newSessionId;
- private $igbinaryEmptyData;
-
- /**
- * {@inheritdoc}
- */
- public function open($savePath, $sessionName)
- {
- $this->sessionName = $sessionName;
- if (!headers_sent() && !ini_get('session.cache_limiter') && '0' !== ini_get('session.cache_limiter')) {
- header(sprintf('Cache-Control: max-age=%d, private, must-revalidate', 60 * (int) ini_get('session.cache_expire')));
- }
-
- return true;
- }
-
- /**
- * @param string $sessionId
- *
- * @return string
- */
- abstract protected function doRead($sessionId);
-
- /**
- * @param string $sessionId
- * @param string $data
- *
- * @return bool
- */
- abstract protected function doWrite($sessionId, $data);
-
- /**
- * @param string $sessionId
- *
- * @return bool
- */
- abstract protected function doDestroy($sessionId);
-
- /**
- * {@inheritdoc}
- */
- public function validateId($sessionId)
- {
- $this->prefetchData = $this->read($sessionId);
- $this->prefetchId = $sessionId;
-
- return '' !== $this->prefetchData;
- }
-
- /**
- * {@inheritdoc}
- */
- public function read($sessionId)
- {
- if (null !== $this->prefetchId) {
- $prefetchId = $this->prefetchId;
- $prefetchData = $this->prefetchData;
- $this->prefetchId = $this->prefetchData = null;
-
- if ($prefetchId === $sessionId || '' === $prefetchData) {
- $this->newSessionId = '' === $prefetchData ? $sessionId : null;
-
- return $prefetchData;
- }
- }
-
- $data = $this->doRead($sessionId);
- $this->newSessionId = '' === $data ? $sessionId : null;
- if (\PHP_VERSION_ID < 70000) {
- $this->prefetchData = $data;
- }
-
- return $data;
- }
-
- /**
- * {@inheritdoc}
- */
- public function write($sessionId, $data)
- {
- if (\PHP_VERSION_ID < 70000 && $this->prefetchData) {
- $readData = $this->prefetchData;
- $this->prefetchData = null;
-
- if ($readData === $data) {
- return $this->updateTimestamp($sessionId, $data);
- }
- }
- if (null === $this->igbinaryEmptyData) {
- // see https://github.com/igbinary/igbinary/issues/146
- $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : '';
- }
- if ('' === $data || $this->igbinaryEmptyData === $data) {
- return $this->destroy($sessionId);
- }
- $this->newSessionId = null;
-
- return $this->doWrite($sessionId, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- public function destroy($sessionId)
- {
- if (\PHP_VERSION_ID < 70000) {
- $this->prefetchData = null;
- }
- if (!headers_sent() && ini_get('session.use_cookies')) {
- if (!$this->sessionName) {
- throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', get_class($this)));
- }
- $sessionCookie = sprintf(' %s=', urlencode($this->sessionName));
- $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId));
- $sessionCookieFound = false;
- $otherCookies = array();
- foreach (headers_list() as $h) {
- if (0 !== stripos($h, 'Set-Cookie:')) {
- continue;
- }
- if (11 === strpos($h, $sessionCookie, 11)) {
- $sessionCookieFound = true;
-
- if (11 !== strpos($h, $sessionCookieWithId, 11)) {
- $otherCookies[] = $h;
- }
- } else {
- $otherCookies[] = $h;
- }
- }
- if ($sessionCookieFound) {
- header_remove('Set-Cookie');
- foreach ($otherCookies as $h) {
- header($h, false);
- }
- } else {
- setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly'));
- }
- }
-
- return $this->newSessionId === $sessionId || $this->doDestroy($sessionId);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php
deleted file mode 100755
index 90726be..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php
+++ /dev/null
@@ -1,120 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
-
-@trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.', MemcacheSessionHandler::class), E_USER_DEPRECATED);
-
-/**
- * @author Drak
- *
- * @deprecated since version 3.4, to be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.
- */
-class MemcacheSessionHandler implements \SessionHandlerInterface
-{
- private $memcache;
-
- /**
- * @var int Time to live in seconds
- */
- private $ttl;
-
- /**
- * @var string Key prefix for shared environments
- */
- private $prefix;
-
- /**
- * Constructor.
- *
- * List of available options:
- * * prefix: The prefix to use for the memcache keys in order to avoid collision
- * * expiretime: The time to live in seconds
- *
- * @param \Memcache $memcache A \Memcache instance
- * @param array $options An associative array of Memcache options
- *
- * @throws \InvalidArgumentException When unsupported options are passed
- */
- public function __construct(\Memcache $memcache, array $options = array())
- {
- if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) {
- throw new \InvalidArgumentException(sprintf(
- 'The following options are not supported "%s"', implode(', ', $diff)
- ));
- }
-
- $this->memcache = $memcache;
- $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
- $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s';
- }
-
- /**
- * {@inheritdoc}
- */
- public function open($savePath, $sessionName)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function read($sessionId)
- {
- return $this->memcache->get($this->prefix.$sessionId) ?: '';
- }
-
- /**
- * {@inheritdoc}
- */
- public function write($sessionId, $data)
- {
- return $this->memcache->set($this->prefix.$sessionId, $data, 0, time() + $this->ttl);
- }
-
- /**
- * {@inheritdoc}
- */
- public function destroy($sessionId)
- {
- $this->memcache->delete($this->prefix.$sessionId);
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- // not required here because memcache will auto expire the records anyhow.
- return true;
- }
-
- /**
- * Return a Memcache instance.
- *
- * @return \Memcache
- */
- protected function getMemcache()
- {
- return $this->memcache;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
deleted file mode 100755
index dd37eae..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.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\HttpFoundation\Session\Storage\Handler;
-
-/**
- * Memcached based session storage handler based on the Memcached class
- * provided by the PHP memcached extension.
- *
- * @see http://php.net/memcached
- *
- * @author Drak
- */
-class MemcachedSessionHandler extends AbstractSessionHandler
-{
- private $memcached;
-
- /**
- * @var int Time to live in seconds
- */
- private $ttl;
-
- /**
- * @var string Key prefix for shared environments
- */
- private $prefix;
-
- /**
- * Constructor.
- *
- * List of available options:
- * * prefix: The prefix to use for the memcached keys in order to avoid collision
- * * expiretime: The time to live in seconds.
- *
- * @param \Memcached $memcached A \Memcached instance
- * @param array $options An associative array of Memcached options
- *
- * @throws \InvalidArgumentException When unsupported options are passed
- */
- public function __construct(\Memcached $memcached, array $options = array())
- {
- $this->memcached = $memcached;
-
- if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) {
- throw new \InvalidArgumentException(sprintf(
- 'The following options are not supported "%s"', implode(', ', $diff)
- ));
- }
-
- $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
- $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s';
- }
-
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doRead($sessionId)
- {
- return $this->memcached->get($this->prefix.$sessionId) ?: '';
- }
-
- /**
- * {@inheritdoc}
- */
- public function updateTimestamp($sessionId, $data)
- {
- $this->memcached->touch($this->prefix.$sessionId, time() + $this->ttl);
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doWrite($sessionId, $data)
- {
- return $this->memcached->set($this->prefix.$sessionId, $data, time() + $this->ttl);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDestroy($sessionId)
- {
- $result = $this->memcached->delete($this->prefix.$sessionId);
-
- return $result || \Memcached::RES_NOTFOUND == $this->memcached->getResultCode();
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- // not required here because memcached will auto expire the records anyhow.
- return true;
- }
-
- /**
- * Return a Memcached instance.
- *
- * @return \Memcached
- */
- protected function getMemcached()
- {
- return $this->memcached;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
deleted file mode 100755
index 7d3fa21..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
+++ /dev/null
@@ -1,255 +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\Session\Storage\Handler;
-
-/**
- * Session handler using the mongodb/mongodb package and MongoDB driver extension.
- *
- * @author Markus Bachmann
- *
- * @see https://packagist.org/packages/mongodb/mongodb
- * @see http://php.net/manual/en/set.mongodb.php
- */
-class MongoDbSessionHandler extends AbstractSessionHandler
-{
- private $mongo;
-
- /**
- * @var \MongoCollection
- */
- private $collection;
-
- /**
- * @var array
- */
- private $options;
-
- /**
- * Constructor.
- *
- * List of available options:
- * * database: The name of the database [required]
- * * collection: The name of the collection [required]
- * * id_field: The field name for storing the session id [default: _id]
- * * data_field: The field name for storing the session data [default: data]
- * * time_field: The field name for storing the timestamp [default: time]
- * * expiry_field: The field name for storing the expiry-timestamp [default: expires_at].
- *
- * It is strongly recommended to put an index on the `expiry_field` for
- * garbage-collection. Alternatively it's possible to automatically expire
- * the sessions in the database as described below:
- *
- * A TTL collections can be used on MongoDB 2.2+ to cleanup expired sessions
- * automatically. Such an index can for example look like this:
- *
- * db..ensureIndex(
- * { "": 1 },
- * { "expireAfterSeconds": 0 }
- * )
- *
- * More details on: http://docs.mongodb.org/manual/tutorial/expire-data/
- *
- * If you use such an index, you can drop `gc_probability` to 0 since
- * no garbage-collection is required.
- *
- * @param \MongoDB\Client $mongo A MongoDB\Client instance
- * @param array $options An associative array of field options
- *
- * @throws \InvalidArgumentException When MongoClient or Mongo instance not provided
- * @throws \InvalidArgumentException When "database" or "collection" not provided
- */
- public function __construct($mongo, array $options)
- {
- if ($mongo instanceof \MongoClient || $mongo instanceof \Mongo) {
- @trigger_error(sprintf('Using %s with the legacy mongo extension is deprecated as of 3.4 and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.', __CLASS__), E_USER_DEPRECATED);
- }
-
- if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
- throw new \InvalidArgumentException('MongoClient or Mongo instance required');
- }
-
- if (!isset($options['database']) || !isset($options['collection'])) {
- throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler');
- }
-
- $this->mongo = $mongo;
-
- $this->options = array_merge(array(
- 'id_field' => '_id',
- 'data_field' => 'data',
- 'time_field' => 'time',
- 'expiry_field' => 'expires_at',
- ), $options);
- }
-
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDestroy($sessionId)
- {
- $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove';
-
- $this->getCollection()->$methodName(array(
- $this->options['id_field'] => $sessionId,
- ));
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteMany' : 'remove';
-
- $this->getCollection()->$methodName(array(
- $this->options['expiry_field'] => array('$lt' => $this->createDateTime()),
- ));
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doWrite($sessionId, $data)
- {
- $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime'));
-
- $fields = array(
- $this->options['time_field'] => $this->createDateTime(),
- $this->options['expiry_field'] => $expiry,
- );
-
- $options = array('upsert' => true);
-
- if ($this->mongo instanceof \MongoDB\Client) {
- $fields[$this->options['data_field']] = new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY);
- } else {
- $fields[$this->options['data_field']] = new \MongoBinData($data, \MongoBinData::BYTE_ARRAY);
- $options['multiple'] = false;
- }
-
- $methodName = $this->mongo instanceof \MongoDB\Client ? 'updateOne' : 'update';
-
- $this->getCollection()->$methodName(
- array($this->options['id_field'] => $sessionId),
- array('$set' => $fields),
- $options
- );
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function updateTimestamp($sessionId, $data)
- {
- $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime'));
-
- if ($this->mongo instanceof \MongoDB\Client) {
- $methodName = 'updateOne';
- $options = array();
- } else {
- $methodName = 'update';
- $options = array('multiple' => false);
- }
-
- $this->getCollection()->$methodName(
- array($this->options['id_field'] => $sessionId),
- array('$set' => array(
- $this->options['time_field'] => $this->createDateTime(),
- $this->options['expiry_field'] => $expiry,
- )),
- $options
- );
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doRead($sessionId)
- {
- $dbData = $this->getCollection()->findOne(array(
- $this->options['id_field'] => $sessionId,
- $this->options['expiry_field'] => array('$gte' => $this->createDateTime()),
- ));
-
- if (null === $dbData) {
- return '';
- }
-
- if ($dbData[$this->options['data_field']] instanceof \MongoDB\BSON\Binary) {
- return $dbData[$this->options['data_field']]->getData();
- }
-
- return $dbData[$this->options['data_field']]->bin;
- }
-
- /**
- * Return a "MongoCollection" instance.
- *
- * @return \MongoCollection
- */
- private function getCollection()
- {
- if (null === $this->collection) {
- $this->collection = $this->mongo->selectCollection($this->options['database'], $this->options['collection']);
- }
-
- return $this->collection;
- }
-
- /**
- * Return a Mongo instance.
- *
- * @return \Mongo|\MongoClient|\MongoDB\Client
- */
- protected function getMongo()
- {
- return $this->mongo;
- }
-
- /**
- * Create a date object using the class appropriate for the current mongo connection.
- *
- * Return an instance of a MongoDate or \MongoDB\BSON\UTCDateTime
- *
- * @param int $seconds An integer representing UTC seconds since Jan 1 1970. Defaults to now.
- *
- * @return \MongoDate|\MongoDB\BSON\UTCDateTime
- */
- private function createDateTime($seconds = null)
- {
- if (null === $seconds) {
- $seconds = time();
- }
-
- if ($this->mongo instanceof \MongoDB\Client) {
- return new \MongoDB\BSON\UTCDateTime($seconds * 1000);
- }
-
- return new \MongoDate($seconds);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php
deleted file mode 100755
index 4e9704b..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.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\HttpFoundation\Session\Storage\Handler;
-
-/**
- * Native session handler using PHP's built in file storage.
- *
- * @author Drak
- */
-class NativeFileSessionHandler extends NativeSessionHandler
-{
- /**
- * @param string $savePath Path of directory to save session files
- * Default null will leave setting as defined by PHP.
- * '/path', 'N;/path', or 'N;octal-mode;/path
- *
- * @see http://php.net/session.configuration.php#ini.session.save-path for further details.
- *
- * @throws \InvalidArgumentException On invalid $savePath
- * @throws \RuntimeException When failing to create the save directory
- */
- public function __construct($savePath = null)
- {
- if (null === $savePath) {
- $savePath = ini_get('session.save_path');
- }
-
- $baseDir = $savePath;
-
- if ($count = substr_count($savePath, ';')) {
- if ($count > 2) {
- throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath));
- }
-
- // characters after last ';' are the path
- $baseDir = ltrim(strrchr($savePath, ';'), ';');
- }
-
- if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
- throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir));
- }
-
- ini_set('session.save_path', $savePath);
- ini_set('session.save_handler', 'files');
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php
deleted file mode 100755
index 9be4528..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.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\HttpFoundation\Session\Storage\Handler;
-
-/**
- * @deprecated since version 3.4, to be removed in 4.0. Use \SessionHandler instead.
- * @see http://php.net/sessionhandler
- */
-class NativeSessionHandler extends \SessionHandler
-{
- public function __construct()
- {
- @trigger_error('The '.__NAMESPACE__.'\NativeSessionHandler class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the \SessionHandler class instead.', E_USER_DEPRECATED);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php
deleted file mode 100755
index 8d19315..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.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\HttpFoundation\Session\Storage\Handler;
-
-/**
- * Can be used in unit testing or in a situations where persisted sessions are not desired.
- *
- * @author Drak
- */
-class NullSessionHandler extends AbstractSessionHandler
-{
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validateId($sessionId)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doRead($sessionId)
- {
- return '';
- }
-
- /**
- * {@inheritdoc}
- */
- public function updateTimestamp($sessionId, $data)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doWrite($sessionId, $data)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDestroy($sessionId)
- {
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- return true;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
deleted file mode 100755
index c8737be..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
+++ /dev/null
@@ -1,910 +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\Session\Storage\Handler;
-
-/**
- * Session handler using a PDO connection to read and write data.
- *
- * It works with MySQL, PostgreSQL, Oracle, SQL Server and SQLite and implements
- * different locking strategies to handle concurrent access to the same session.
- * Locking is necessary to prevent loss of data due to race conditions and to keep
- * the session data consistent between read() and write(). With locking, requests
- * for the same session will wait until the other one finished writing. For this
- * reason it's best practice to close a session as early as possible to improve
- * concurrency. PHPs internal files session handler also implements locking.
- *
- * Attention: Since SQLite does not support row level locks but locks the whole database,
- * it means only one session can be accessed at a time. Even different sessions would wait
- * for another to finish. So saving session in SQLite should only be considered for
- * development or prototypes.
- *
- * Session data is a binary string that can contain non-printable characters like the null byte.
- * For this reason it must be saved in a binary column in the database like BLOB in MySQL.
- * Saving it in a character column could corrupt the data. You can use createTable()
- * to initialize a correctly defined table.
- *
- * @see http://php.net/sessionhandlerinterface
- *
- * @author Fabien Potencier
- * @author Michael Williams
- * @author Tobias Schultze
- */
-class PdoSessionHandler extends AbstractSessionHandler
-{
- /**
- * No locking is done. This means sessions are prone to loss of data due to
- * race conditions of concurrent requests to the same session. The last session
- * write will win in this case. It might be useful when you implement your own
- * logic to deal with this like an optimistic approach.
- */
- const LOCK_NONE = 0;
-
- /**
- * Creates an application-level lock on a session. The disadvantage is that the
- * lock is not enforced by the database and thus other, unaware parts of the
- * application could still concurrently modify the session. The advantage is it
- * does not require a transaction.
- * This mode is not available for SQLite and not yet implemented for oci and sqlsrv.
- */
- const LOCK_ADVISORY = 1;
-
- /**
- * Issues a real row lock. Since it uses a transaction between opening and
- * closing a session, you have to be careful when you use same database connection
- * that you also use for your application logic. This mode is the default because
- * it's the only reliable solution across DBMSs.
- */
- const LOCK_TRANSACTIONAL = 2;
-
- /**
- * @var \PDO|null PDO instance or null when not connected yet
- */
- private $pdo;
-
- /**
- * @var string|null|false DSN string or null for session.save_path or false when lazy connection disabled
- */
- private $dsn = false;
-
- /**
- * @var string Database driver
- */
- private $driver;
-
- /**
- * @var string Table name
- */
- private $table = 'sessions';
-
- /**
- * @var string Column for session id
- */
- private $idCol = 'sess_id';
-
- /**
- * @var string Column for session data
- */
- private $dataCol = 'sess_data';
-
- /**
- * @var string Column for lifetime
- */
- private $lifetimeCol = 'sess_lifetime';
-
- /**
- * @var string Column for timestamp
- */
- private $timeCol = 'sess_time';
-
- /**
- * @var string Username when lazy-connect
- */
- private $username = '';
-
- /**
- * @var string Password when lazy-connect
- */
- private $password = '';
-
- /**
- * @var array Connection options when lazy-connect
- */
- private $connectionOptions = array();
-
- /**
- * @var int The strategy for locking, see constants
- */
- private $lockMode = self::LOCK_TRANSACTIONAL;
-
- /**
- * It's an array to support multiple reads before closing which is manual, non-standard usage.
- *
- * @var \PDOStatement[] An array of statements to release advisory locks
- */
- private $unlockStatements = array();
-
- /**
- * @var bool True when the current session exists but expired according to session.gc_maxlifetime
- */
- private $sessionExpired = false;
-
- /**
- * @var bool Whether a transaction is active
- */
- private $inTransaction = false;
-
- /**
- * @var bool Whether gc() has been called
- */
- private $gcCalled = false;
-
- /**
- * You can either pass an existing database connection as PDO instance or
- * pass a DSN string that will be used to lazy-connect to the database
- * when the session is actually used. Furthermore it's possible to pass null
- * which will then use the session.save_path ini setting as PDO DSN parameter.
- *
- * List of available options:
- * * db_table: The name of the table [default: sessions]
- * * db_id_col: The column where to store the session id [default: sess_id]
- * * db_data_col: The column where to store the session data [default: sess_data]
- * * db_lifetime_col: The column where to store the lifetime [default: sess_lifetime]
- * * db_time_col: The column where to store the timestamp [default: sess_time]
- * * db_username: The username when lazy-connect [default: '']
- * * db_password: The password when lazy-connect [default: '']
- * * db_connection_options: An array of driver-specific connection options [default: array()]
- * * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL]
- *
- * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null
- * @param array $options An associative array of options
- *
- * @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
- */
- public function __construct($pdoOrDsn = null, array $options = array())
- {
- if ($pdoOrDsn instanceof \PDO) {
- if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
- throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__));
- }
-
- $this->pdo = $pdoOrDsn;
- $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
- } elseif (is_string($pdoOrDsn) && false !== strpos($pdoOrDsn, '://')) {
- $this->dsn = $this->buildDsnFromUrl($pdoOrDsn);
- } else {
- $this->dsn = $pdoOrDsn;
- }
-
- $this->table = isset($options['db_table']) ? $options['db_table'] : $this->table;
- $this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol;
- $this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol;
- $this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol;
- $this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol;
- $this->username = isset($options['db_username']) ? $options['db_username'] : $this->username;
- $this->password = isset($options['db_password']) ? $options['db_password'] : $this->password;
- $this->connectionOptions = isset($options['db_connection_options']) ? $options['db_connection_options'] : $this->connectionOptions;
- $this->lockMode = isset($options['lock_mode']) ? $options['lock_mode'] : $this->lockMode;
- }
-
- /**
- * Creates the table to store sessions which can be called once for setup.
- *
- * Session ID is saved in a column of maximum length 128 because that is enough even
- * for a 512 bit configured session.hash_function like Whirlpool. Session data is
- * saved in a BLOB. One could also use a shorter inlined varbinary column
- * if one was sure the data fits into it.
- *
- * @throws \PDOException When the table already exists
- * @throws \DomainException When an unsupported PDO driver is used
- */
- public function createTable()
- {
- // connect if we are not yet
- $this->getConnection();
-
- switch ($this->driver) {
- case 'mysql':
- // We use varbinary for the ID column because it prevents unwanted conversions:
- // - character set conversions between server and client
- // - trailing space removal
- // - case-insensitivity
- // - language processing like é == e
- $sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol MEDIUMINT NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB";
- break;
- case 'sqlite':
- $sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
- break;
- case 'pgsql':
- $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
- break;
- case 'oci':
- $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
- break;
- case 'sqlsrv':
- $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
- break;
- default:
- throw new \DomainException(sprintf('Creating the session table is currently not implemented for PDO driver "%s".', $this->driver));
- }
-
- try {
- $this->pdo->exec($sql);
- } catch (\PDOException $e) {
- $this->rollback();
-
- throw $e;
- }
- }
-
- /**
- * Returns true when the current session exists but expired according to session.gc_maxlifetime.
- *
- * Can be used to distinguish between a new session and one that expired due to inactivity.
- *
- * @return bool Whether current session expired
- */
- public function isSessionExpired()
- {
- return $this->sessionExpired;
- }
-
- /**
- * {@inheritdoc}
- */
- public function open($savePath, $sessionName)
- {
- $this->sessionExpired = false;
-
- if (null === $this->pdo) {
- $this->connect($this->dsn ?: $savePath);
- }
-
- return parent::open($savePath, $sessionName);
- }
-
- /**
- * {@inheritdoc}
- */
- public function read($sessionId)
- {
- try {
- return parent::read($sessionId);
- } catch (\PDOException $e) {
- $this->rollback();
-
- throw $e;
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- // We delay gc() to close() so that it is executed outside the transactional and blocking read-write process.
- // This way, pruning expired sessions does not block them from being started while the current session is used.
- $this->gcCalled = true;
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDestroy($sessionId)
- {
- // delete the record associated with this id
- $sql = "DELETE FROM $this->table WHERE $this->idCol = :id";
-
- try {
- $stmt = $this->pdo->prepare($sql);
- $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
- $stmt->execute();
- } catch (\PDOException $e) {
- $this->rollback();
-
- throw $e;
- }
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doWrite($sessionId, $data)
- {
- $maxlifetime = (int) ini_get('session.gc_maxlifetime');
-
- try {
- // We use a single MERGE SQL query when supported by the database.
- $mergeStmt = $this->getMergeStatement($sessionId, $data, $maxlifetime);
- if (null !== $mergeStmt) {
- $mergeStmt->execute();
-
- return true;
- }
-
- $updateStmt = $this->getUpdateStatement($sessionId, $data, $maxlifetime);
- $updateStmt->execute();
-
- // When MERGE is not supported, like in Postgres < 9.5, we have to use this approach that can result in
- // duplicate key errors when the same session is written simultaneously (given the LOCK_NONE behavior).
- // We can just catch such an error and re-execute the update. This is similar to a serializable
- // transaction with retry logic on serialization failures but without the overhead and without possible
- // false positives due to longer gap locking.
- if (!$updateStmt->rowCount()) {
- try {
- $insertStmt = $this->getInsertStatement($sessionId, $data, $maxlifetime);
- $insertStmt->execute();
- } catch (\PDOException $e) {
- // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys
- if (0 === strpos($e->getCode(), '23')) {
- $updateStmt->execute();
- } else {
- throw $e;
- }
- }
- }
- } catch (\PDOException $e) {
- $this->rollback();
-
- throw $e;
- }
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function updateTimestamp($sessionId, $data)
- {
- $maxlifetime = (int) ini_get('session.gc_maxlifetime');
-
- try {
- $updateStmt = $this->pdo->prepare(
- "UPDATE $this->table SET $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id"
- );
- $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
- $updateStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
- $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT);
- $updateStmt->execute();
- } catch (\PDOException $e) {
- $this->rollback();
-
- throw $e;
- }
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- $this->commit();
-
- while ($unlockStmt = array_shift($this->unlockStatements)) {
- $unlockStmt->execute();
- }
-
- if ($this->gcCalled) {
- $this->gcCalled = false;
-
- // delete the session records that have expired
- if ('mysql' === $this->driver) {
- $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time";
- } else {
- $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
- }
-
- $stmt = $this->pdo->prepare($sql);
- $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
- $stmt->execute();
- }
-
- if (false !== $this->dsn) {
- $this->pdo = null; // only close lazy-connection
- }
-
- return true;
- }
-
- /**
- * Lazy-connects to the database.
- *
- * @param string $dsn DSN string
- */
- private function connect($dsn)
- {
- $this->pdo = new \PDO($dsn, $this->username, $this->password, $this->connectionOptions);
- $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
- $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
- }
-
- /**
- * Builds a PDO DSN from a URL-like connection string.
- *
- * @param string $dsnOrUrl
- *
- * @return string
- *
- * @todo implement missing support for oci DSN (which look totally different from other PDO ones)
- */
- private function buildDsnFromUrl($dsnOrUrl)
- {
- // (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid
- $url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $dsnOrUrl);
-
- $params = parse_url($url);
-
- if (false === $params) {
- return $dsnOrUrl; // If the URL is not valid, let's assume it might be a DSN already.
- }
-
- $params = array_map('rawurldecode', $params);
-
- // Override the default username and password. Values passed through options will still win over these in the constructor.
- if (isset($params['user'])) {
- $this->username = $params['user'];
- }
-
- if (isset($params['pass'])) {
- $this->password = $params['pass'];
- }
-
- if (!isset($params['scheme'])) {
- throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler');
- }
-
- $driverAliasMap = array(
- 'mssql' => 'sqlsrv',
- 'mysql2' => 'mysql', // Amazon RDS, for some weird reason
- 'postgres' => 'pgsql',
- 'postgresql' => 'pgsql',
- 'sqlite3' => 'sqlite',
- );
-
- $driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme'];
-
- // Doctrine DBAL supports passing its internal pdo_* driver names directly too (allowing both dashes and underscores). This allows supporting the same here.
- if (0 === strpos($driver, 'pdo_') || 0 === strpos($driver, 'pdo-')) {
- $driver = substr($driver, 4);
- }
-
- switch ($driver) {
- case 'mysql':
- case 'pgsql':
- $dsn = $driver.':';
-
- if (isset($params['host']) && '' !== $params['host']) {
- $dsn .= 'host='.$params['host'].';';
- }
-
- if (isset($params['port']) && '' !== $params['port']) {
- $dsn .= 'port='.$params['port'].';';
- }
-
- if (isset($params['path'])) {
- $dbName = substr($params['path'], 1); // Remove the leading slash
- $dsn .= 'dbname='.$dbName.';';
- }
-
- return $dsn;
-
- case 'sqlite':
- return 'sqlite:'.substr($params['path'], 1);
-
- case 'sqlsrv':
- $dsn = 'sqlsrv:server=';
-
- if (isset($params['host'])) {
- $dsn .= $params['host'];
- }
-
- if (isset($params['port']) && '' !== $params['port']) {
- $dsn .= ','.$params['port'];
- }
-
- if (isset($params['path'])) {
- $dbName = substr($params['path'], 1); // Remove the leading slash
- $dsn .= ';Database='.$dbName;
- }
-
- return $dsn;
-
- default:
- throw new \InvalidArgumentException(sprintf('The scheme "%s" is not supported by the PdoSessionHandler URL configuration. Pass a PDO DSN directly.', $params['scheme']));
- }
- }
-
- /**
- * Helper method to begin a transaction.
- *
- * Since SQLite does not support row level locks, we have to acquire a reserved lock
- * on the database immediately. Because of https://bugs.php.net/42766 we have to create
- * such a transaction manually which also means we cannot use PDO::commit or
- * PDO::rollback or PDO::inTransaction for SQLite.
- *
- * Also MySQLs default isolation, REPEATABLE READ, causes deadlock for different sessions
- * due to http://www.mysqlperformanceblog.com/2013/12/12/one-more-innodb-gap-lock-to-avoid/ .
- * So we change it to READ COMMITTED.
- */
- private function beginTransaction()
- {
- if (!$this->inTransaction) {
- if ('sqlite' === $this->driver) {
- $this->pdo->exec('BEGIN IMMEDIATE TRANSACTION');
- } else {
- if ('mysql' === $this->driver) {
- $this->pdo->exec('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
- }
- $this->pdo->beginTransaction();
- }
- $this->inTransaction = true;
- }
- }
-
- /**
- * Helper method to commit a transaction.
- */
- private function commit()
- {
- if ($this->inTransaction) {
- try {
- // commit read-write transaction which also releases the lock
- if ('sqlite' === $this->driver) {
- $this->pdo->exec('COMMIT');
- } else {
- $this->pdo->commit();
- }
- $this->inTransaction = false;
- } catch (\PDOException $e) {
- $this->rollback();
-
- throw $e;
- }
- }
- }
-
- /**
- * Helper method to rollback a transaction.
- */
- private function rollback()
- {
- // We only need to rollback if we are in a transaction. Otherwise the resulting
- // error would hide the real problem why rollback was called. We might not be
- // in a transaction when not using the transactional locking behavior or when
- // two callbacks (e.g. destroy and write) are invoked that both fail.
- if ($this->inTransaction) {
- if ('sqlite' === $this->driver) {
- $this->pdo->exec('ROLLBACK');
- } else {
- $this->pdo->rollBack();
- }
- $this->inTransaction = false;
- }
- }
-
- /**
- * Reads the session data in respect to the different locking strategies.
- *
- * We need to make sure we do not return session data that is already considered garbage according
- * to the session.gc_maxlifetime setting because gc() is called after read() and only sometimes.
- *
- * @param string $sessionId Session ID
- *
- * @return string The session data
- */
- protected function doRead($sessionId)
- {
- if (self::LOCK_ADVISORY === $this->lockMode) {
- $this->unlockStatements[] = $this->doAdvisoryLock($sessionId);
- }
-
- $selectSql = $this->getSelectSql();
- $selectStmt = $this->pdo->prepare($selectSql);
- $selectStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
-
- do {
- $selectStmt->execute();
- $sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM);
-
- if ($sessionRows) {
- if ($sessionRows[0][1] + $sessionRows[0][2] < time()) {
- $this->sessionExpired = true;
-
- return '';
- }
-
- return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0];
- }
-
- if (!ini_get('session.use_strict_mode') && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) {
- // In strict mode, session fixation is not possible: new sessions always start with a unique
- // random id, so that concurrency is not possible and this code path can be skipped.
- // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block
- // until other connections to the session are committed.
- try {
- $insertStmt = $this->getInsertStatement($sessionId, '', 0);
- $insertStmt->execute();
- } catch (\PDOException $e) {
- // Catch duplicate key error because other connection created the session already.
- // It would only not be the case when the other connection destroyed the session.
- if (0 === strpos($e->getCode(), '23')) {
- // Retrieve finished session data written by concurrent connection by restarting the loop.
- // We have to start a new transaction as a failed query will mark the current transaction as
- // aborted in PostgreSQL and disallow further queries within it.
- $this->rollback();
- $this->beginTransaction();
- continue;
- }
-
- throw $e;
- }
- }
-
- return '';
- } while (true);
- }
-
- /**
- * Executes an application-level lock on the database.
- *
- * @param string $sessionId Session ID
- *
- * @return \PDOStatement The statement that needs to be executed later to release the lock
- *
- * @throws \DomainException When an unsupported PDO driver is used
- *
- * @todo implement missing advisory locks
- * - for oci using DBMS_LOCK.REQUEST
- * - for sqlsrv using sp_getapplock with LockOwner = Session
- */
- private function doAdvisoryLock($sessionId)
- {
- switch ($this->driver) {
- case 'mysql':
- // should we handle the return value? 0 on timeout, null on error
- // we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout
- $stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)');
- $stmt->bindValue(':key', $sessionId, \PDO::PARAM_STR);
- $stmt->execute();
-
- $releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)');
- $releaseStmt->bindValue(':key', $sessionId, \PDO::PARAM_STR);
-
- return $releaseStmt;
- case 'pgsql':
- // Obtaining an exclusive session level advisory lock requires an integer key.
- // When session.sid_bits_per_character > 4, the session id can contain non-hex-characters.
- // So we cannot just use hexdec().
- if (4 === \PHP_INT_SIZE) {
- $sessionInt1 = $this->convertStringToInt($sessionId);
- $sessionInt2 = $this->convertStringToInt(substr($sessionId, 4, 4));
-
- $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key1, :key2)');
- $stmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT);
- $stmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT);
- $stmt->execute();
-
- $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key1, :key2)');
- $releaseStmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT);
- $releaseStmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT);
- } else {
- $sessionBigInt = $this->convertStringToInt($sessionId);
-
- $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key)');
- $stmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT);
- $stmt->execute();
-
- $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key)');
- $releaseStmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT);
- }
-
- return $releaseStmt;
- case 'sqlite':
- throw new \DomainException('SQLite does not support advisory locks.');
- default:
- throw new \DomainException(sprintf('Advisory locks are currently not implemented for PDO driver "%s".', $this->driver));
- }
- }
-
- /**
- * Encodes the first 4 (when PHP_INT_SIZE == 4) or 8 characters of the string as an integer.
- *
- * Keep in mind, PHP integers are signed.
- *
- * @param string $string
- *
- * @return int
- */
- private function convertStringToInt($string)
- {
- if (4 === \PHP_INT_SIZE) {
- return (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]);
- }
-
- $int1 = (ord($string[7]) << 24) + (ord($string[6]) << 16) + (ord($string[5]) << 8) + ord($string[4]);
- $int2 = (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]);
-
- return $int2 + ($int1 << 32);
- }
-
- /**
- * Return a locking or nonlocking SQL query to read session information.
- *
- * @return string The SQL string
- *
- * @throws \DomainException When an unsupported PDO driver is used
- */
- private function getSelectSql()
- {
- if (self::LOCK_TRANSACTIONAL === $this->lockMode) {
- $this->beginTransaction();
-
- switch ($this->driver) {
- case 'mysql':
- case 'oci':
- case 'pgsql':
- return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WHERE $this->idCol = :id FOR UPDATE";
- case 'sqlsrv':
- return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WITH (UPDLOCK, ROWLOCK) WHERE $this->idCol = :id";
- case 'sqlite':
- // we already locked when starting transaction
- break;
- default:
- throw new \DomainException(sprintf('Transactional locks are currently not implemented for PDO driver "%s".', $this->driver));
- }
- }
-
- return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WHERE $this->idCol = :id";
- }
-
- /**
- * Returns an insert statement supported by the database for writing session data.
- *
- * @param string $sessionId Session ID
- * @param string $sessionData Encoded session data
- * @param int $maxlifetime session.gc_maxlifetime
- *
- * @return \PDOStatement The insert statement
- */
- private function getInsertStatement($sessionId, $sessionData, $maxlifetime)
- {
- switch ($this->driver) {
- case 'oci':
- $data = fopen('php://memory', 'r+');
- fwrite($data, $sessionData);
- rewind($data);
- $sql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, EMPTY_BLOB(), :lifetime, :time) RETURNING $this->dataCol into :data";
- break;
- default:
- $data = $sessionData;
- $sql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)";
- break;
- }
-
- $stmt = $this->pdo->prepare($sql);
- $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
- $stmt->bindParam(':data', $data, \PDO::PARAM_LOB);
- $stmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
- $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
-
- return $stmt;
- }
-
- /**
- * Returns an update statement supported by the database for writing session data.
- *
- * @param string $sessionId Session ID
- * @param string $sessionData Encoded session data
- * @param int $maxlifetime session.gc_maxlifetime
- *
- * @return \PDOStatement The update statement
- */
- private function getUpdateStatement($sessionId, $sessionData, $maxlifetime)
- {
- switch ($this->driver) {
- case 'oci':
- $data = fopen('php://memory', 'r+');
- fwrite($data, $sessionData);
- rewind($data);
- $sql = "UPDATE $this->table SET $this->dataCol = EMPTY_BLOB(), $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id RETURNING $this->dataCol into :data";
- break;
- default:
- $data = $sessionData;
- $sql = "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id";
- break;
- }
-
- $stmt = $this->pdo->prepare($sql);
- $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
- $stmt->bindParam(':data', $data, \PDO::PARAM_LOB);
- $stmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
- $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
-
- return $stmt;
- }
-
- /**
- * Returns a merge/upsert (i.e. insert or update) statement when supported by the database for writing session data.
- *
- * @param string $sessionId Session ID
- * @param string $data Encoded session data
- * @param int $maxlifetime session.gc_maxlifetime
- *
- * @return \PDOStatement|null The merge statement or null when not supported
- */
- private function getMergeStatement($sessionId, $data, $maxlifetime)
- {
- switch (true) {
- case 'mysql' === $this->driver:
- $mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ".
- "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)";
- break;
- case 'sqlsrv' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='):
- // MERGE is only available since SQL Server 2008 and must be terminated by semicolon
- // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx
- $mergeSql = "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = ?) ".
- "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ".
- "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?;";
- break;
- case 'sqlite' === $this->driver:
- $mergeSql = "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)";
- break;
- case 'pgsql' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '9.5', '>='):
- $mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ".
- "ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)";
- break;
- default:
- // MERGE is not supported with LOBs: http://www.oracle.com/technetwork/articles/fuecks-lobs-095315.html
- return null;
- }
-
- $mergeStmt = $this->pdo->prepare($mergeSql);
-
- if ('sqlsrv' === $this->driver) {
- $mergeStmt->bindParam(1, $sessionId, \PDO::PARAM_STR);
- $mergeStmt->bindParam(2, $sessionId, \PDO::PARAM_STR);
- $mergeStmt->bindParam(3, $data, \PDO::PARAM_LOB);
- $mergeStmt->bindParam(4, $maxlifetime, \PDO::PARAM_INT);
- $mergeStmt->bindValue(5, time(), \PDO::PARAM_INT);
- $mergeStmt->bindParam(6, $data, \PDO::PARAM_LOB);
- $mergeStmt->bindParam(7, $maxlifetime, \PDO::PARAM_INT);
- $mergeStmt->bindValue(8, time(), \PDO::PARAM_INT);
- } else {
- $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
- $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB);
- $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
- $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT);
- }
-
- return $mergeStmt;
- }
-
- /**
- * Return a PDO instance.
- *
- * @return \PDO
- */
- protected function getConnection()
- {
- if (null === $this->pdo) {
- $this->connect($this->dsn ?: ini_get('session.save_path'));
- }
-
- return $this->pdo;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php
deleted file mode 100755
index 2281192..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.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\HttpFoundation\Session\Storage\Handler;
-
-/**
- * Adds basic `SessionUpdateTimestampHandlerInterface` behaviors to another `SessionHandlerInterface`.
- *
- * @author Nicolas Grekas
- */
-class StrictSessionHandler extends AbstractSessionHandler
-{
- private $handler;
- private $doDestroy;
-
- public function __construct(\SessionHandlerInterface $handler)
- {
- if ($handler instanceof \SessionUpdateTimestampHandlerInterface) {
- throw new \LogicException(sprintf('"%s" is already an instance of "SessionUpdateTimestampHandlerInterface", you cannot wrap it with "%s".', get_class($handler), self::class));
- }
-
- $this->handler = $handler;
- }
-
- /**
- * {@inheritdoc}
- */
- public function open($savePath, $sessionName)
- {
- parent::open($savePath, $sessionName);
-
- return $this->handler->open($savePath, $sessionName);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doRead($sessionId)
- {
- return $this->handler->read($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function updateTimestamp($sessionId, $data)
- {
- return $this->write($sessionId, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doWrite($sessionId, $data)
- {
- return $this->handler->write($sessionId, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- public function destroy($sessionId)
- {
- $this->doDestroy = true;
- $destroyed = parent::destroy($sessionId);
-
- return $this->doDestroy ? $this->doDestroy($sessionId) : $destroyed;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function doDestroy($sessionId)
- {
- $this->doDestroy = false;
-
- return $this->handler->destroy($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- return $this->handler->close();
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- return $this->handler->gc($maxlifetime);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php
deleted file mode 100755
index 1541ec4..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.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\HttpFoundation\Session\Storage\Handler;
-
-@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', WriteCheckSessionHandler::class), E_USER_DEPRECATED);
-
-/**
- * Wraps another SessionHandlerInterface to only write the session when it has been modified.
- *
- * @author Adrien Brault
- *
- * @deprecated since version 3.4, to be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.
- */
-class WriteCheckSessionHandler implements \SessionHandlerInterface
-{
- private $wrappedSessionHandler;
-
- /**
- * @var array sessionId => session
- */
- private $readSessions;
-
- public function __construct(\SessionHandlerInterface $wrappedSessionHandler)
- {
- $this->wrappedSessionHandler = $wrappedSessionHandler;
- }
-
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- return $this->wrappedSessionHandler->close();
- }
-
- /**
- * {@inheritdoc}
- */
- public function destroy($sessionId)
- {
- return $this->wrappedSessionHandler->destroy($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- return $this->wrappedSessionHandler->gc($maxlifetime);
- }
-
- /**
- * {@inheritdoc}
- */
- public function open($savePath, $sessionName)
- {
- return $this->wrappedSessionHandler->open($savePath, $sessionName);
- }
-
- /**
- * {@inheritdoc}
- */
- public function read($sessionId)
- {
- $session = $this->wrappedSessionHandler->read($sessionId);
-
- $this->readSessions[$sessionId] = $session;
-
- return $session;
- }
-
- /**
- * {@inheritdoc}
- */
- public function write($sessionId, $data)
- {
- if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) {
- return true;
- }
-
- return $this->wrappedSessionHandler->write($sessionId, $data);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
deleted file mode 100755
index 6f59af4..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
+++ /dev/null
@@ -1,168 +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\Session\Storage;
-
-use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
-
-/**
- * Metadata container.
- *
- * Adds metadata to the session.
- *
- * @author Drak
- */
-class MetadataBag implements SessionBagInterface
-{
- const CREATED = 'c';
- const UPDATED = 'u';
- const LIFETIME = 'l';
-
- /**
- * @var string
- */
- private $name = '__metadata';
-
- /**
- * @var string
- */
- private $storageKey;
-
- /**
- * @var array
- */
- protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0);
-
- /**
- * Unix timestamp.
- *
- * @var int
- */
- private $lastUsed;
-
- /**
- * @var int
- */
- private $updateThreshold;
-
- /**
- * @param string $storageKey The key used to store bag in the session
- * @param int $updateThreshold The time to wait between two UPDATED updates
- */
- public function __construct($storageKey = '_sf2_meta', $updateThreshold = 0)
- {
- $this->storageKey = $storageKey;
- $this->updateThreshold = $updateThreshold;
- }
-
- /**
- * {@inheritdoc}
- */
- public function initialize(array &$array)
- {
- $this->meta = &$array;
-
- if (isset($array[self::CREATED])) {
- $this->lastUsed = $this->meta[self::UPDATED];
-
- $timeStamp = time();
- if ($timeStamp - $array[self::UPDATED] >= $this->updateThreshold) {
- $this->meta[self::UPDATED] = $timeStamp;
- }
- } else {
- $this->stampCreated();
- }
- }
-
- /**
- * Gets the lifetime that the session cookie was set with.
- *
- * @return int
- */
- public function getLifetime()
- {
- return $this->meta[self::LIFETIME];
- }
-
- /**
- * Stamps a new session's metadata.
- *
- * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
- * will leave the system settings unchanged, 0 sets the cookie
- * to expire with browser session. Time is in seconds, and is
- * not a Unix timestamp.
- */
- public function stampNew($lifetime = null)
- {
- $this->stampCreated($lifetime);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStorageKey()
- {
- return $this->storageKey;
- }
-
- /**
- * Gets the created timestamp metadata.
- *
- * @return int Unix timestamp
- */
- public function getCreated()
- {
- return $this->meta[self::CREATED];
- }
-
- /**
- * Gets the last used metadata.
- *
- * @return int Unix timestamp
- */
- public function getLastUsed()
- {
- return $this->lastUsed;
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- // nothing to do
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * Sets name.
- *
- * @param string $name
- */
- public function setName($name)
- {
- $this->name = $name;
- }
-
- private function stampCreated($lifetime = null)
- {
- $timeStamp = time();
- $this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp;
- $this->meta[self::LIFETIME] = (null === $lifetime) ? ini_get('session.cookie_lifetime') : $lifetime;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
deleted file mode 100755
index 027f4ef..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
+++ /dev/null
@@ -1,256 +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\Session\Storage;
-
-use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
-
-/**
- * MockArraySessionStorage mocks the session for unit tests.
- *
- * No PHP session is actually started since a session can be initialized
- * and shutdown only once per PHP execution cycle.
- *
- * When doing functional testing, you should use MockFileSessionStorage instead.
- *
- * @author Fabien Potencier
- * @author Bulat Shakirzyanov
- * @author Drak
- */
-class MockArraySessionStorage implements SessionStorageInterface
-{
- /**
- * @var string
- */
- protected $id = '';
-
- /**
- * @var string
- */
- protected $name;
-
- /**
- * @var bool
- */
- protected $started = false;
-
- /**
- * @var bool
- */
- protected $closed = false;
-
- /**
- * @var array
- */
- protected $data = array();
-
- /**
- * @var MetadataBag
- */
- protected $metadataBag;
-
- /**
- * @var array|SessionBagInterface[]
- */
- protected $bags = array();
-
- /**
- * @param string $name Session name
- * @param MetadataBag $metaBag MetadataBag instance
- */
- public function __construct($name = 'MOCKSESSID', MetadataBag $metaBag = null)
- {
- $this->name = $name;
- $this->setMetadataBag($metaBag);
- }
-
- public function setSessionData(array $array)
- {
- $this->data = $array;
- }
-
- /**
- * {@inheritdoc}
- */
- public function start()
- {
- if ($this->started) {
- return true;
- }
-
- if (empty($this->id)) {
- $this->id = $this->generateId();
- }
-
- $this->loadSession();
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function regenerate($destroy = false, $lifetime = null)
- {
- if (!$this->started) {
- $this->start();
- }
-
- $this->metadataBag->stampNew($lifetime);
- $this->id = $this->generateId();
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setId($id)
- {
- if ($this->started) {
- throw new \LogicException('Cannot set session ID after the session has started.');
- }
-
- $this->id = $id;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setName($name)
- {
- $this->name = $name;
- }
-
- /**
- * {@inheritdoc}
- */
- public function save()
- {
- if (!$this->started || $this->closed) {
- throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
- }
- // nothing to do since we don't persist the session data
- $this->closed = false;
- $this->started = false;
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- // clear out the bags
- foreach ($this->bags as $bag) {
- $bag->clear();
- }
-
- // clear out the session
- $this->data = array();
-
- // reconnect the bags to the session
- $this->loadSession();
- }
-
- /**
- * {@inheritdoc}
- */
- public function registerBag(SessionBagInterface $bag)
- {
- $this->bags[$bag->getName()] = $bag;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getBag($name)
- {
- if (!isset($this->bags[$name])) {
- throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name));
- }
-
- if (!$this->started) {
- $this->start();
- }
-
- return $this->bags[$name];
- }
-
- /**
- * {@inheritdoc}
- */
- public function isStarted()
- {
- return $this->started;
- }
-
- public function setMetadataBag(MetadataBag $bag = null)
- {
- if (null === $bag) {
- $bag = new MetadataBag();
- }
-
- $this->metadataBag = $bag;
- }
-
- /**
- * Gets the MetadataBag.
- *
- * @return MetadataBag
- */
- public function getMetadataBag()
- {
- return $this->metadataBag;
- }
-
- /**
- * Generates a session ID.
- *
- * This doesn't need to be particularly cryptographically secure since this is just
- * a mock.
- *
- * @return string
- */
- protected function generateId()
- {
- return hash('sha256', uniqid('ss_mock_', true));
- }
-
- protected function loadSession()
- {
- $bags = array_merge($this->bags, array($this->metadataBag));
-
- foreach ($bags as $bag) {
- $key = $bag->getStorageKey();
- $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array();
- $bag->initialize($this->data[$key]);
- }
-
- $this->started = true;
- $this->closed = false;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php
deleted file mode 100755
index 14f4270..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php
+++ /dev/null
@@ -1,152 +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\Session\Storage;
-
-/**
- * MockFileSessionStorage is used to mock sessions for
- * functional testing when done in a single PHP process.
- *
- * No PHP session is actually started since a session can be initialized
- * and shutdown only once per PHP execution cycle and this class does
- * not pollute any session related globals, including session_*() functions
- * or session.* PHP ini directives.
- *
- * @author Drak
- */
-class MockFileSessionStorage extends MockArraySessionStorage
-{
- private $savePath;
-
- /**
- * @param string $savePath Path of directory to save session files
- * @param string $name Session name
- * @param MetadataBag $metaBag MetadataBag instance
- */
- public function __construct($savePath = null, $name = 'MOCKSESSID', MetadataBag $metaBag = null)
- {
- if (null === $savePath) {
- $savePath = sys_get_temp_dir();
- }
-
- if (!is_dir($savePath) && !@mkdir($savePath, 0777, true) && !is_dir($savePath)) {
- throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $savePath));
- }
-
- $this->savePath = $savePath;
-
- parent::__construct($name, $metaBag);
- }
-
- /**
- * {@inheritdoc}
- */
- public function start()
- {
- if ($this->started) {
- return true;
- }
-
- if (!$this->id) {
- $this->id = $this->generateId();
- }
-
- $this->read();
-
- $this->started = true;
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function regenerate($destroy = false, $lifetime = null)
- {
- if (!$this->started) {
- $this->start();
- }
-
- if ($destroy) {
- $this->destroy();
- }
-
- return parent::regenerate($destroy, $lifetime);
- }
-
- /**
- * {@inheritdoc}
- */
- public function save()
- {
- if (!$this->started) {
- throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
- }
-
- $data = $this->data;
-
- foreach ($this->bags as $bag) {
- if (empty($data[$key = $bag->getStorageKey()])) {
- unset($data[$key]);
- }
- }
- if (array($key = $this->metadataBag->getStorageKey()) === array_keys($data)) {
- unset($data[$key]);
- }
-
- try {
- if ($data) {
- file_put_contents($this->getFilePath(), serialize($data));
- } else {
- $this->destroy();
- }
- } finally {
- $this->data = $data;
- }
-
- // this is needed for Silex, where the session object is re-used across requests
- // in functional tests. In Symfony, the container is rebooted, so we don't have
- // this issue
- $this->started = false;
- }
-
- /**
- * Deletes a session from persistent storage.
- * Deliberately leaves session data in memory intact.
- */
- private function destroy()
- {
- if (is_file($this->getFilePath())) {
- unlink($this->getFilePath());
- }
- }
-
- /**
- * Calculate path to file.
- *
- * @return string File path
- */
- private function getFilePath()
- {
- return $this->savePath.'/'.$this->id.'.mocksess';
- }
-
- /**
- * Reads session from storage and loads session.
- */
- private function read()
- {
- $filePath = $this->getFilePath();
- $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array();
-
- $this->loadSession();
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
deleted file mode 100755
index 0dfad9a..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
+++ /dev/null
@@ -1,445 +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\Session\Storage;
-
-use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
-use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
-use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
-use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
-
-/**
- * This provides a base class for session attribute storage.
- *
- * @author Drak
- */
-class NativeSessionStorage implements SessionStorageInterface
-{
- /**
- * @var SessionBagInterface[]
- */
- protected $bags = array();
-
- /**
- * @var bool
- */
- protected $started = false;
-
- /**
- * @var bool
- */
- protected $closed = false;
-
- /**
- * @var AbstractProxy|\SessionHandlerInterface
- */
- protected $saveHandler;
-
- /**
- * @var MetadataBag
- */
- protected $metadataBag;
-
- /**
- * Depending on how you want the storage driver to behave you probably
- * want to override this constructor entirely.
- *
- * List of options for $options array with their defaults.
- *
- * @see http://php.net/session.configuration for options
- * but we omit 'session.' from the beginning of the keys for convenience.
- *
- * ("auto_start", is not supported as it tells PHP to start a session before
- * PHP starts to execute user-land code. Setting during runtime has no effect).
- *
- * cache_limiter, "" (use "0" to prevent headers from being sent entirely).
- * cache_expire, "0"
- * cookie_domain, ""
- * cookie_httponly, ""
- * cookie_lifetime, "0"
- * cookie_path, "/"
- * cookie_secure, ""
- * entropy_file, ""
- * entropy_length, "0"
- * gc_divisor, "100"
- * gc_maxlifetime, "1440"
- * gc_probability, "1"
- * hash_bits_per_character, "4"
- * hash_function, "0"
- * lazy_write, "1"
- * name, "PHPSESSID"
- * referer_check, ""
- * serialize_handler, "php"
- * use_strict_mode, "0"
- * use_cookies, "1"
- * use_only_cookies, "1"
- * use_trans_sid, "0"
- * upload_progress.enabled, "1"
- * upload_progress.cleanup, "1"
- * upload_progress.prefix, "upload_progress_"
- * upload_progress.name, "PHP_SESSION_UPLOAD_PROGRESS"
- * upload_progress.freq, "1%"
- * upload_progress.min-freq, "1"
- * url_rewriter.tags, "a=href,area=href,frame=src,form=,fieldset="
- * sid_length, "32"
- * sid_bits_per_character, "5"
- * trans_sid_hosts, $_SERVER['HTTP_HOST']
- * trans_sid_tags, "a=href,area=href,frame=src,form="
- *
- * @param array $options Session configuration options
- * @param \SessionHandlerInterface|null $handler
- * @param MetadataBag $metaBag MetadataBag
- */
- public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null)
- {
- $options += array(
- 'cache_limiter' => '',
- 'cache_expire' => 0,
- 'use_cookies' => 1,
- 'lazy_write' => 1,
- );
-
- session_register_shutdown();
-
- $this->setMetadataBag($metaBag);
- $this->setOptions($options);
- $this->setSaveHandler($handler);
- }
-
- /**
- * Gets the save handler instance.
- *
- * @return AbstractProxy|\SessionHandlerInterface
- */
- public function getSaveHandler()
- {
- return $this->saveHandler;
- }
-
- /**
- * {@inheritdoc}
- */
- public function start()
- {
- if ($this->started) {
- return true;
- }
-
- if (\PHP_SESSION_ACTIVE === session_status()) {
- throw new \RuntimeException('Failed to start the session: already started by PHP.');
- }
-
- if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
- throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
- }
-
- // ok to try and start the session
- if (!session_start()) {
- throw new \RuntimeException('Failed to start the session');
- }
-
- $this->loadSession();
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getId()
- {
- return $this->saveHandler->getId();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setId($id)
- {
- $this->saveHandler->setId($id);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return $this->saveHandler->getName();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setName($name)
- {
- $this->saveHandler->setName($name);
- }
-
- /**
- * {@inheritdoc}
- */
- public function regenerate($destroy = false, $lifetime = null)
- {
- // Cannot regenerate the session ID for non-active sessions.
- if (\PHP_SESSION_ACTIVE !== session_status()) {
- return false;
- }
-
- if (headers_sent()) {
- return false;
- }
-
- if (null !== $lifetime) {
- ini_set('session.cookie_lifetime', $lifetime);
- }
-
- if ($destroy) {
- $this->metadataBag->stampNew();
- }
-
- $isRegenerated = session_regenerate_id($destroy);
-
- // The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
- // @see https://bugs.php.net/bug.php?id=70013
- $this->loadSession();
-
- return $isRegenerated;
- }
-
- /**
- * {@inheritdoc}
- */
- public function save()
- {
- $session = $_SESSION;
-
- foreach ($this->bags as $bag) {
- if (empty($_SESSION[$key = $bag->getStorageKey()])) {
- unset($_SESSION[$key]);
- }
- }
- if (array($key = $this->metadataBag->getStorageKey()) === array_keys($_SESSION)) {
- unset($_SESSION[$key]);
- }
-
- // Register custom error handler to catch a possible failure warning during session write
- set_error_handler(function ($errno, $errstr, $errfile, $errline) {
- throw new \ErrorException($errstr, $errno, E_WARNING, $errfile, $errline);
- }, E_WARNING);
-
- try {
- $e = null;
- session_write_close();
- } catch (\ErrorException $e) {
- } finally {
- restore_error_handler();
- $_SESSION = $session;
- }
- if (null !== $e) {
- // The default PHP error message is not very helpful, as it does not give any information on the current save handler.
- // Therefore, we catch this error and trigger a warning with a better error message
- $handler = $this->getSaveHandler();
- if ($handler instanceof SessionHandlerProxy) {
- $handler = $handler->getHandler();
- }
-
- trigger_error(sprintf('session_write_close(): Failed to write session data with %s handler', get_class($handler)), E_USER_WARNING);
- }
-
- $this->closed = true;
- $this->started = false;
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- // clear out the bags
- foreach ($this->bags as $bag) {
- $bag->clear();
- }
-
- // clear out the session
- $_SESSION = array();
-
- // reconnect the bags to the session
- $this->loadSession();
- }
-
- /**
- * {@inheritdoc}
- */
- public function registerBag(SessionBagInterface $bag)
- {
- if ($this->started) {
- throw new \LogicException('Cannot register a bag when the session is already started.');
- }
-
- $this->bags[$bag->getName()] = $bag;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getBag($name)
- {
- if (!isset($this->bags[$name])) {
- throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name));
- }
-
- if (!$this->started && $this->saveHandler->isActive()) {
- $this->loadSession();
- } elseif (!$this->started) {
- $this->start();
- }
-
- return $this->bags[$name];
- }
-
- public function setMetadataBag(MetadataBag $metaBag = null)
- {
- if (null === $metaBag) {
- $metaBag = new MetadataBag();
- }
-
- $this->metadataBag = $metaBag;
- }
-
- /**
- * Gets the MetadataBag.
- *
- * @return MetadataBag
- */
- public function getMetadataBag()
- {
- return $this->metadataBag;
- }
-
- /**
- * {@inheritdoc}
- */
- public function isStarted()
- {
- return $this->started;
- }
-
- /**
- * Sets session.* ini variables.
- *
- * For convenience we omit 'session.' from the beginning of the keys.
- * Explicitly ignores other ini keys.
- *
- * @param array $options Session ini directives array(key => value)
- *
- * @see http://php.net/session.configuration
- */
- public function setOptions(array $options)
- {
- if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
- return;
- }
-
- $validOptions = array_flip(array(
- 'cache_limiter', 'cache_expire', 'cookie_domain', 'cookie_httponly',
- 'cookie_lifetime', 'cookie_path', 'cookie_secure',
- 'entropy_file', 'entropy_length', 'gc_divisor',
- 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
- 'hash_function', 'lazy_write', 'name', 'referer_check',
- 'serialize_handler', 'use_strict_mode', 'use_cookies',
- 'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
- 'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
- 'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags',
- 'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
- ));
-
- foreach ($options as $key => $value) {
- if (isset($validOptions[$key])) {
- ini_set('session.'.$key, $value);
- }
- }
- }
-
- /**
- * Registers session save handler as a PHP session handler.
- *
- * To use internal PHP session save handlers, override this method using ini_set with
- * session.save_handler and session.save_path e.g.
- *
- * ini_set('session.save_handler', 'files');
- * ini_set('session.save_path', '/tmp');
- *
- * or pass in a \SessionHandler instance which configures session.save_handler in the
- * constructor, for a template see NativeFileSessionHandler or use handlers in
- * composer package drak/native-session
- *
- * @see http://php.net/session-set-save-handler
- * @see http://php.net/sessionhandlerinterface
- * @see http://php.net/sessionhandler
- * @see http://github.com/drak/NativeSession
- *
- * @param \SessionHandlerInterface|null $saveHandler
- *
- * @throws \InvalidArgumentException
- */
- public function setSaveHandler($saveHandler = null)
- {
- if (!$saveHandler instanceof AbstractProxy &&
- !$saveHandler instanceof \SessionHandlerInterface &&
- null !== $saveHandler) {
- throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.');
- }
-
- // Wrap $saveHandler in proxy and prevent double wrapping of proxy
- if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
- $saveHandler = new SessionHandlerProxy($saveHandler);
- } elseif (!$saveHandler instanceof AbstractProxy) {
- $saveHandler = new SessionHandlerProxy(new StrictSessionHandler(new \SessionHandler()));
- }
- $this->saveHandler = $saveHandler;
-
- if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
- return;
- }
-
- if ($this->saveHandler instanceof SessionHandlerProxy) {
- session_set_save_handler($this->saveHandler->getHandler(), false);
- } elseif ($this->saveHandler instanceof \SessionHandlerInterface) {
- session_set_save_handler($this->saveHandler, false);
- }
- }
-
- /**
- * Load the session with attributes.
- *
- * After starting the session, PHP retrieves the session from whatever handlers
- * are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()).
- * PHP takes the return value from the read() handler, unserializes it
- * and populates $_SESSION with the result automatically.
- */
- protected function loadSession(array &$session = null)
- {
- if (null === $session) {
- $session = &$_SESSION;
- }
-
- $bags = array_merge($this->bags, array($this->metadataBag));
-
- foreach ($bags as $bag) {
- $key = $bag->getStorageKey();
- $session[$key] = isset($session[$key]) ? $session[$key] : array();
- $bag->initialize($session[$key]);
- }
-
- $this->started = true;
- $this->closed = false;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php
deleted file mode 100755
index 662ed50..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.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\Session\Storage;
-
-/**
- * Allows session to be started by PHP and managed by Symfony.
- *
- * @author Drak
- */
-class PhpBridgeSessionStorage extends NativeSessionStorage
-{
- /**
- * @param \SessionHandlerInterface|null $handler
- * @param MetadataBag $metaBag MetadataBag
- */
- public function __construct($handler = null, MetadataBag $metaBag = null)
- {
- $this->setMetadataBag($metaBag);
- $this->setSaveHandler($handler);
- }
-
- /**
- * {@inheritdoc}
- */
- public function start()
- {
- if ($this->started) {
- return true;
- }
-
- $this->loadSession();
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- // clear out the bags and nothing else that may be set
- // since the purpose of this driver is to share a handler
- foreach ($this->bags as $bag) {
- $bag->clear();
- }
-
- // reconnect the bags to the session
- $this->loadSession();
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php
deleted file mode 100755
index 09c9248..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php
+++ /dev/null
@@ -1,122 +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\Session\Storage\Proxy;
-
-/**
- * @author Drak
- */
-abstract class AbstractProxy
-{
- /**
- * Flag if handler wraps an internal PHP session handler (using \SessionHandler).
- *
- * @var bool
- */
- protected $wrapper = false;
-
- /**
- * @var string
- */
- protected $saveHandlerName;
-
- /**
- * Gets the session.save_handler name.
- *
- * @return string
- */
- public function getSaveHandlerName()
- {
- return $this->saveHandlerName;
- }
-
- /**
- * Is this proxy handler and instance of \SessionHandlerInterface.
- *
- * @return bool
- */
- public function isSessionHandlerInterface()
- {
- return $this instanceof \SessionHandlerInterface;
- }
-
- /**
- * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
- *
- * @return bool
- */
- public function isWrapper()
- {
- return $this->wrapper;
- }
-
- /**
- * Has a session started?
- *
- * @return bool
- */
- public function isActive()
- {
- return \PHP_SESSION_ACTIVE === session_status();
- }
-
- /**
- * Gets the session ID.
- *
- * @return string
- */
- public function getId()
- {
- return session_id();
- }
-
- /**
- * Sets the session ID.
- *
- * @param string $id
- *
- * @throws \LogicException
- */
- public function setId($id)
- {
- if ($this->isActive()) {
- throw new \LogicException('Cannot change the ID of an active session');
- }
-
- session_id($id);
- }
-
- /**
- * Gets the session name.
- *
- * @return string
- */
- public function getName()
- {
- return session_name();
- }
-
- /**
- * Sets the session name.
- *
- * @param string $name
- *
- * @throws \LogicException
- */
- public function setName($name)
- {
- if ($this->isActive()) {
- throw new \LogicException('Cannot change the name of an active session');
- }
-
- session_name($name);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php
deleted file mode 100755
index 082eed1..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
-
-@trigger_error('The '.__NAMESPACE__.'\NativeProxy class is deprecated since Symfony 3.4 and will be removed in 4.0. Use your session handler implementation directly.', E_USER_DEPRECATED);
-
-/**
- * This proxy is built-in session handlers in PHP 5.3.x.
- *
- * @deprecated since version 3.4, to be removed in 4.0. Use your session handler implementation directly.
- *
- * @author Drak
- */
-class NativeProxy extends AbstractProxy
-{
- public function __construct()
- {
- // this makes an educated guess as to what the handler is since it should already be set.
- $this->saveHandlerName = ini_get('session.save_handler');
- }
-
- /**
- * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
- *
- * @return bool False
- */
- public function isWrapper()
- {
- return false;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php
deleted file mode 100755
index 53c1209..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php
+++ /dev/null
@@ -1,85 +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\Session\Storage\Proxy;
-
-/**
- * @author Drak
- */
-class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface
-{
- protected $handler;
-
- public function __construct(\SessionHandlerInterface $handler)
- {
- $this->handler = $handler;
- $this->wrapper = ($handler instanceof \SessionHandler);
- $this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user';
- }
-
- /**
- * @return \SessionHandlerInterface
- */
- public function getHandler()
- {
- return $this->handler;
- }
-
- // \SessionHandlerInterface
-
- /**
- * {@inheritdoc}
- */
- public function open($savePath, $sessionName)
- {
- return (bool) $this->handler->open($savePath, $sessionName);
- }
-
- /**
- * {@inheritdoc}
- */
- public function close()
- {
- return (bool) $this->handler->close();
- }
-
- /**
- * {@inheritdoc}
- */
- public function read($sessionId)
- {
- return (string) $this->handler->read($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function write($sessionId, $data)
- {
- return (bool) $this->handler->write($sessionId, $data);
- }
-
- /**
- * {@inheritdoc}
- */
- public function destroy($sessionId)
- {
- return (bool) $this->handler->destroy($sessionId);
- }
-
- /**
- * {@inheritdoc}
- */
- public function gc($maxlifetime)
- {
- return (bool) $this->handler->gc($maxlifetime);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php b/assets/php/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php
deleted file mode 100755
index 66e8b33..0000000
--- a/assets/php/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php
+++ /dev/null
@@ -1,137 +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\Session\Storage;
-
-use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
-
-/**
- * StorageInterface.
- *
- * @author Fabien Potencier
- * @author Drak
- */
-interface SessionStorageInterface
-{
- /**
- * Starts the session.
- *
- * @return bool True if started
- *
- * @throws \RuntimeException if something goes wrong starting the session
- */
- public function start();
-
- /**
- * Checks if the session is started.
- *
- * @return bool True if started, false otherwise
- */
- public function isStarted();
-
- /**
- * Returns the session ID.
- *
- * @return string The session ID or empty
- */
- public function getId();
-
- /**
- * Sets the session ID.
- *
- * @param string $id
- */
- public function setId($id);
-
- /**
- * Returns the session name.
- *
- * @return mixed The session name
- */
- public function getName();
-
- /**
- * Sets the session name.
- *
- * @param string $name
- */
- public function setName($name);
-
- /**
- * Regenerates id that represents this storage.
- *
- * This method must invoke session_regenerate_id($destroy) unless
- * this interface is used for a storage object designed for unit
- * or functional testing where a real PHP session would interfere
- * with testing.
- *
- * Note regenerate+destroy should not clear the session data in memory
- * only delete the session data from persistent storage.
- *
- * Care: When regenerating the session ID no locking is involved in PHP's
- * session design. See https://bugs.php.net/bug.php?id=61470 for a discussion.
- * So you must make sure the regenerated session is saved BEFORE sending the
- * headers with the new ID. Symfony's HttpKernel offers a listener for this.
- * See Symfony\Component\HttpKernel\EventListener\SaveSessionListener.
- * Otherwise session data could get lost again for concurrent requests with the
- * new ID. One result could be that you get logged out after just logging in.
- *
- * @param bool $destroy Destroy session when regenerating?
- * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value
- * will leave the system settings unchanged, 0 sets the cookie
- * to expire with browser session. Time is in seconds, and is
- * not a Unix timestamp.
- *
- * @return bool True if session regenerated, false if error
- *
- * @throws \RuntimeException If an error occurs while regenerating this storage
- */
- public function regenerate($destroy = false, $lifetime = null);
-
- /**
- * Force the session to be saved and closed.
- *
- * This method must invoke session_write_close() unless this interface is
- * used for a storage object design for unit or functional testing where
- * a real PHP session would interfere with testing, in which case
- * it should actually persist the session data if required.
- *
- * @throws \RuntimeException if the session is saved without being started, or if the session
- * is already closed
- */
- public function save();
-
- /**
- * Clear all session data in memory.
- */
- public function clear();
-
- /**
- * Gets a SessionBagInterface by name.
- *
- * @param string $name
- *
- * @return SessionBagInterface
- *
- * @throws \InvalidArgumentException If the bag does not exist
- */
- public function getBag($name);
-
- /**
- * Registers a SessionBagInterface for use.
- */
- public function registerBag(SessionBagInterface $bag);
-
- /**
- * @return MetadataBag
- */
- public function getMetadataBag();
-}
diff --git a/assets/php/vendor/symfony/http-foundation/StreamedResponse.php b/assets/php/vendor/symfony/http-foundation/StreamedResponse.php
deleted file mode 100755
index 92868d3..0000000
--- a/assets/php/vendor/symfony/http-foundation/StreamedResponse.php
+++ /dev/null
@@ -1,144 +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;
-
-/**
- * StreamedResponse represents a streamed HTTP response.
- *
- * A StreamedResponse uses a callback for its content.
- *
- * The callback should use the standard PHP functions like echo
- * to stream the response back to the client. The flush() method
- * can also be used if needed.
- *
- * @see flush()
- *
- * @author Fabien Potencier
- */
-class StreamedResponse extends Response
-{
- protected $callback;
- protected $streamed;
- private $headersSent;
-
- /**
- * @param callable|null $callback A valid PHP callback or null to set it later
- * @param int $status The response status code
- * @param array $headers An array of response headers
- */
- public function __construct(callable $callback = null, $status = 200, $headers = array())
- {
- parent::__construct(null, $status, $headers);
-
- if (null !== $callback) {
- $this->setCallback($callback);
- }
- $this->streamed = false;
- $this->headersSent = false;
- }
-
- /**
- * Factory method for chainability.
- *
- * @param callable|null $callback A valid PHP callback or null to set it later
- * @param int $status The response status code
- * @param array $headers An array of response headers
- *
- * @return static
- */
- public static function create($callback = null, $status = 200, $headers = array())
- {
- return new static($callback, $status, $headers);
- }
-
- /**
- * Sets the PHP callback associated with this Response.
- *
- * @param callable $callback A valid PHP callback
- *
- * @return $this
- */
- public function setCallback(callable $callback)
- {
- $this->callback = $callback;
-
- return $this;
- }
-
- /**
- * {@inheritdoc}
- *
- * This method only sends the headers once.
- *
- * @return $this
- */
- public function sendHeaders()
- {
- if ($this->headersSent) {
- return $this;
- }
-
- $this->headersSent = true;
-
- return parent::sendHeaders();
- }
-
- /**
- * {@inheritdoc}
- *
- * This method only sends the content once.
- *
- * @return $this
- */
- public function sendContent()
- {
- if ($this->streamed) {
- return $this;
- }
-
- $this->streamed = true;
-
- if (null === $this->callback) {
- throw new \LogicException('The Response callback must not be null.');
- }
-
- call_user_func($this->callback);
-
- return $this;
- }
-
- /**
- * {@inheritdoc}
- *
- * @throws \LogicException when the content is not null
- *
- * @return $this
- */
- public function setContent($content)
- {
- if (null !== $content) {
- throw new \LogicException('The content cannot be set on a StreamedResponse instance.');
- }
-
- return $this;
- }
-
- /**
- * {@inheritdoc}
- *
- * @return false
- */
- public function getContent()
- {
- return false;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php b/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php
deleted file mode 100755
index cb43bb3..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php
+++ /dev/null
@@ -1,113 +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\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\AcceptHeaderItem;
-
-class AcceptHeaderItemTest extends TestCase
-{
- /**
- * @dataProvider provideFromStringData
- */
- public function testFromString($string, $value, array $attributes)
- {
- $item = AcceptHeaderItem::fromString($string);
- $this->assertEquals($value, $item->getValue());
- $this->assertEquals($attributes, $item->getAttributes());
- }
-
- public function provideFromStringData()
- {
- return array(
- array(
- 'text/html',
- 'text/html', array(),
- ),
- array(
- '"this;should,not=matter"',
- 'this;should,not=matter', array(),
- ),
- array(
- "text/plain; charset=utf-8;param=\"this;should,not=matter\";\tfootnotes=true",
- 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'),
- ),
- array(
- '"this;should,not=matter";charset=utf-8',
- 'this;should,not=matter', array('charset' => 'utf-8'),
- ),
- );
- }
-
- /**
- * @dataProvider provideToStringData
- */
- public function testToString($value, array $attributes, $string)
- {
- $item = new AcceptHeaderItem($value, $attributes);
- $this->assertEquals($string, (string) $item);
- }
-
- public function provideToStringData()
- {
- return array(
- array(
- 'text/html', array(),
- 'text/html',
- ),
- array(
- 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'),
- 'text/plain;charset=utf-8;param="this;should,not=matter";footnotes=true',
- ),
- );
- }
-
- public function testValue()
- {
- $item = new AcceptHeaderItem('value', array());
- $this->assertEquals('value', $item->getValue());
-
- $item->setValue('new value');
- $this->assertEquals('new value', $item->getValue());
-
- $item->setValue(1);
- $this->assertEquals('1', $item->getValue());
- }
-
- public function testQuality()
- {
- $item = new AcceptHeaderItem('value', array());
- $this->assertEquals(1.0, $item->getQuality());
-
- $item->setQuality(0.5);
- $this->assertEquals(0.5, $item->getQuality());
-
- $item->setAttribute('q', 0.75);
- $this->assertEquals(0.75, $item->getQuality());
- $this->assertFalse($item->hasAttribute('q'));
- }
-
- public function testAttribute()
- {
- $item = new AcceptHeaderItem('value', array());
- $this->assertEquals(array(), $item->getAttributes());
- $this->assertFalse($item->hasAttribute('test'));
- $this->assertNull($item->getAttribute('test'));
- $this->assertEquals('default', $item->getAttribute('test', 'default'));
-
- $item->setAttribute('test', 'value');
- $this->assertEquals(array('test' => 'value'), $item->getAttributes());
- $this->assertTrue($item->hasAttribute('test'));
- $this->assertEquals('value', $item->getAttribute('test'));
- $this->assertEquals('value', $item->getAttribute('test', 'default'));
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php b/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php
deleted file mode 100755
index 9929eac..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.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\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\AcceptHeader;
-use Symfony\Component\HttpFoundation\AcceptHeaderItem;
-
-class AcceptHeaderTest extends TestCase
-{
- public function testFirst()
- {
- $header = AcceptHeader::fromString('text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c');
- $this->assertSame('text/html', $header->first()->getValue());
- }
-
- /**
- * @dataProvider provideFromStringData
- */
- public function testFromString($string, array $items)
- {
- $header = AcceptHeader::fromString($string);
- $parsed = array_values($header->all());
- // reset index since the fixtures don't have them set
- foreach ($parsed as $item) {
- $item->setIndex(0);
- }
- $this->assertEquals($items, $parsed);
- }
-
- public function provideFromStringData()
- {
- return array(
- array('', array()),
- array('gzip', array(new AcceptHeaderItem('gzip'))),
- array('gzip,deflate,sdch', array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))),
- array("gzip, deflate\t,sdch", array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))),
- array('"this;should,not=matter"', array(new AcceptHeaderItem('this;should,not=matter'))),
- );
- }
-
- /**
- * @dataProvider provideToStringData
- */
- public function testToString(array $items, $string)
- {
- $header = new AcceptHeader($items);
- $this->assertEquals($string, (string) $header);
- }
-
- public function provideToStringData()
- {
- return array(
- array(array(), ''),
- array(array(new AcceptHeaderItem('gzip')), 'gzip'),
- array(array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')), 'gzip,deflate,sdch'),
- array(array(new AcceptHeaderItem('this;should,not=matter')), 'this;should,not=matter'),
- );
- }
-
- /**
- * @dataProvider provideFilterData
- */
- public function testFilter($string, $filter, array $values)
- {
- $header = AcceptHeader::fromString($string)->filter($filter);
- $this->assertEquals($values, array_keys($header->all()));
- }
-
- public function provideFilterData()
- {
- return array(
- array('fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', array('fr-FR', 'fr')),
- );
- }
-
- /**
- * @dataProvider provideSortingData
- */
- public function testSorting($string, array $values)
- {
- $header = AcceptHeader::fromString($string);
- $this->assertEquals($values, array_keys($header->all()));
- }
-
- public function provideSortingData()
- {
- return array(
- 'quality has priority' => array('*;q=0.3,ISO-8859-1,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')),
- 'order matters when q is equal' => array('*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')),
- 'order matters when q is equal2' => array('*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', array('utf-8', 'ISO-8859-1', '*')),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php
deleted file mode 100755
index 157ab90..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php
+++ /dev/null
@@ -1,93 +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\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\ApacheRequest;
-
-class ApacheRequestTest extends TestCase
-{
- /**
- * @dataProvider provideServerVars
- */
- public function testUriMethods($server, $expectedRequestUri, $expectedBaseUrl, $expectedPathInfo)
- {
- $request = new ApacheRequest();
- $request->server->replace($server);
-
- $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct');
- $this->assertEquals($expectedBaseUrl, $request->getBaseUrl(), '->getBaseUrl() is correct');
- $this->assertEquals($expectedPathInfo, $request->getPathInfo(), '->getPathInfo() is correct');
- }
-
- public function provideServerVars()
- {
- return array(
- array(
- array(
- 'REQUEST_URI' => '/foo/app_dev.php/bar',
- 'SCRIPT_NAME' => '/foo/app_dev.php',
- 'PATH_INFO' => '/bar',
- ),
- '/foo/app_dev.php/bar',
- '/foo/app_dev.php',
- '/bar',
- ),
- array(
- array(
- 'REQUEST_URI' => '/foo/bar',
- 'SCRIPT_NAME' => '/foo/app_dev.php',
- ),
- '/foo/bar',
- '/foo',
- '/bar',
- ),
- array(
- array(
- 'REQUEST_URI' => '/app_dev.php/foo/bar',
- 'SCRIPT_NAME' => '/app_dev.php',
- 'PATH_INFO' => '/foo/bar',
- ),
- '/app_dev.php/foo/bar',
- '/app_dev.php',
- '/foo/bar',
- ),
- array(
- array(
- 'REQUEST_URI' => '/foo/bar',
- 'SCRIPT_NAME' => '/app_dev.php',
- ),
- '/foo/bar',
- '',
- '/foo/bar',
- ),
- array(
- array(
- 'REQUEST_URI' => '/app_dev.php',
- 'SCRIPT_NAME' => '/app_dev.php',
- ),
- '/app_dev.php',
- '/app_dev.php',
- '/',
- ),
- array(
- array(
- 'REQUEST_URI' => '/',
- 'SCRIPT_NAME' => '/app_dev.php',
- ),
- '/',
- '',
- '/',
- ),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/assets/php/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
deleted file mode 100755
index 1b9e589..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
+++ /dev/null
@@ -1,352 +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\Tests;
-
-use Symfony\Component\HttpFoundation\BinaryFileResponse;
-use Symfony\Component\HttpFoundation\File\Stream;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\ResponseHeaderBag;
-use Symfony\Component\HttpFoundation\Tests\File\FakeFile;
-
-class BinaryFileResponseTest extends ResponseTestCase
-{
- public function testConstruction()
- {
- $file = __DIR__.'/../README.md';
- $response = new BinaryFileResponse($file, 404, array('X-Header' => 'Foo'), true, null, true, true);
- $this->assertEquals(404, $response->getStatusCode());
- $this->assertEquals('Foo', $response->headers->get('X-Header'));
- $this->assertTrue($response->headers->has('ETag'));
- $this->assertTrue($response->headers->has('Last-Modified'));
- $this->assertFalse($response->headers->has('Content-Disposition'));
-
- $response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE);
- $this->assertEquals(404, $response->getStatusCode());
- $this->assertFalse($response->headers->has('ETag'));
- $this->assertEquals('inline; filename="README.md"', $response->headers->get('Content-Disposition'));
- }
-
- public function testConstructWithNonAsciiFilename()
- {
- touch(sys_get_temp_dir().'/fööö.html');
-
- $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, array(), true, 'attachment');
-
- @unlink(sys_get_temp_dir().'/fööö.html');
-
- $this->assertSame('fööö.html', $response->getFile()->getFilename());
- }
-
- /**
- * @expectedException \LogicException
- */
- public function testSetContent()
- {
- $response = new BinaryFileResponse(__FILE__);
- $response->setContent('foo');
- }
-
- public function testGetContent()
- {
- $response = new BinaryFileResponse(__FILE__);
- $this->assertFalse($response->getContent());
- }
-
- public function testSetContentDispositionGeneratesSafeFallbackFilename()
- {
- $response = new BinaryFileResponse(__FILE__);
- $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'föö.html');
-
- $this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html', $response->headers->get('Content-Disposition'));
- }
-
- public function testSetContentDispositionGeneratesSafeFallbackFilenameForWronglyEncodedFilename()
- {
- $response = new BinaryFileResponse(__FILE__);
-
- $iso88591EncodedFilename = utf8_decode('föö.html');
- $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $iso88591EncodedFilename);
-
- // the parameter filename* is invalid in this case (rawurldecode('f%F6%F6') does not provide a UTF-8 string but an ISO-8859-1 encoded one)
- $this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%F6%F6.html', $response->headers->get('Content-Disposition'));
- }
-
- /**
- * @dataProvider provideRanges
- */
- public function testRequests($requestRange, $offset, $length, $responseRange)
- {
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
-
- // do a request to get the ETag
- $request = Request::create('/');
- $response->prepare($request);
- $etag = $response->headers->get('ETag');
-
- // prepare a request for a range of the testing file
- $request = Request::create('/');
- $request->headers->set('If-Range', $etag);
- $request->headers->set('Range', $requestRange);
-
- $file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r');
- fseek($file, $offset);
- $data = fread($file, $length);
- fclose($file);
-
- $this->expectOutputString($data);
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(206, $response->getStatusCode());
- $this->assertEquals($responseRange, $response->headers->get('Content-Range'));
- $this->assertSame($length, $response->headers->get('Content-Length'));
- }
-
- /**
- * @dataProvider provideRanges
- */
- public function testRequestsWithoutEtag($requestRange, $offset, $length, $responseRange)
- {
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
-
- // do a request to get the LastModified
- $request = Request::create('/');
- $response->prepare($request);
- $lastModified = $response->headers->get('Last-Modified');
-
- // prepare a request for a range of the testing file
- $request = Request::create('/');
- $request->headers->set('If-Range', $lastModified);
- $request->headers->set('Range', $requestRange);
-
- $file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r');
- fseek($file, $offset);
- $data = fread($file, $length);
- fclose($file);
-
- $this->expectOutputString($data);
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(206, $response->getStatusCode());
- $this->assertEquals($responseRange, $response->headers->get('Content-Range'));
- }
-
- public function provideRanges()
- {
- return array(
- array('bytes=1-4', 1, 4, 'bytes 1-4/35'),
- array('bytes=-5', 30, 5, 'bytes 30-34/35'),
- array('bytes=30-', 30, 5, 'bytes 30-34/35'),
- array('bytes=30-30', 30, 1, 'bytes 30-30/35'),
- array('bytes=30-34', 30, 5, 'bytes 30-34/35'),
- );
- }
-
- public function testRangeRequestsWithoutLastModifiedDate()
- {
- // prevent auto last modified
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'), true, null, false, false);
-
- // prepare a request for a range of the testing file
- $request = Request::create('/');
- $request->headers->set('If-Range', date('D, d M Y H:i:s').' GMT');
- $request->headers->set('Range', 'bytes=1-4');
-
- $this->expectOutputString(file_get_contents(__DIR__.'/File/Fixtures/test.gif'));
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(200, $response->getStatusCode());
- $this->assertNull($response->headers->get('Content-Range'));
- }
-
- /**
- * @dataProvider provideFullFileRanges
- */
- public function testFullFileRequests($requestRange)
- {
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
-
- // prepare a request for a range of the testing file
- $request = Request::create('/');
- $request->headers->set('Range', $requestRange);
-
- $file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r');
- $data = fread($file, 35);
- fclose($file);
-
- $this->expectOutputString($data);
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(200, $response->getStatusCode());
- }
-
- public function provideFullFileRanges()
- {
- return array(
- array('bytes=0-'),
- array('bytes=0-34'),
- array('bytes=-35'),
- // Syntactical invalid range-request should also return the full resource
- array('bytes=20-10'),
- array('bytes=50-40'),
- );
- }
-
- /**
- * @dataProvider provideInvalidRanges
- */
- public function testInvalidRequests($requestRange)
- {
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
-
- // prepare a request for a range of the testing file
- $request = Request::create('/');
- $request->headers->set('Range', $requestRange);
-
- $response = clone $response;
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertEquals(416, $response->getStatusCode());
- $this->assertEquals('bytes */35', $response->headers->get('Content-Range'));
- }
-
- public function provideInvalidRanges()
- {
- return array(
- array('bytes=-40'),
- array('bytes=30-40'),
- );
- }
-
- /**
- * @dataProvider provideXSendfileFiles
- */
- public function testXSendfile($file)
- {
- $request = Request::create('/');
- $request->headers->set('X-Sendfile-Type', 'X-Sendfile');
-
- BinaryFileResponse::trustXSendfileTypeHeader();
- $response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream'));
- $response->prepare($request);
-
- $this->expectOutputString('');
- $response->sendContent();
-
- $this->assertContains('README.md', $response->headers->get('X-Sendfile'));
- }
-
- public function provideXSendfileFiles()
- {
- return array(
- array(__DIR__.'/../README.md'),
- array('file://'.__DIR__.'/../README.md'),
- );
- }
-
- /**
- * @dataProvider getSampleXAccelMappings
- */
- public function testXAccelMapping($realpath, $mapping, $virtual)
- {
- $request = Request::create('/');
- $request->headers->set('X-Sendfile-Type', 'X-Accel-Redirect');
- $request->headers->set('X-Accel-Mapping', $mapping);
-
- $file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
-
- BinaryFileResponse::trustXSendfileTypeHeader();
- $response = new BinaryFileResponse($file, 200, array('Content-Type' => 'application/octet-stream'));
- $reflection = new \ReflectionObject($response);
- $property = $reflection->getProperty('file');
- $property->setAccessible(true);
- $property->setValue($response, $file);
-
- $response->prepare($request);
- $this->assertEquals($virtual, $response->headers->get('X-Accel-Redirect'));
- }
-
- public function testDeleteFileAfterSend()
- {
- $request = Request::create('/');
-
- $path = __DIR__.'/File/Fixtures/to_delete';
- touch($path);
- $realPath = realpath($path);
- $this->assertFileExists($realPath);
-
- $response = new BinaryFileResponse($realPath, 200, array('Content-Type' => 'application/octet-stream'));
- $response->deleteFileAfterSend(true);
-
- $response->prepare($request);
- $response->sendContent();
-
- $this->assertFileNotExists($path);
- }
-
- public function testAcceptRangeOnUnsafeMethods()
- {
- $request = Request::create('/', 'POST');
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
- $response->prepare($request);
-
- $this->assertEquals('none', $response->headers->get('Accept-Ranges'));
- }
-
- public function testAcceptRangeNotOverriden()
- {
- $request = Request::create('/', 'POST');
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
- $response->headers->set('Accept-Ranges', 'foo');
- $response->prepare($request);
-
- $this->assertEquals('foo', $response->headers->get('Accept-Ranges'));
- }
-
- public function getSampleXAccelMappings()
- {
- return array(
- array('/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'),
- array('/home/foo/bar.txt', '/var/www/=/files/,/home/foo/=/baz/', '/baz/bar.txt'),
- );
- }
-
- public function testStream()
- {
- $request = Request::create('/');
- $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, array('Content-Type' => 'text/plain'));
- $response->prepare($request);
-
- $this->assertNull($response->headers->get('Content-Length'));
- }
-
- protected function provideResponse()
- {
- return new BinaryFileResponse(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream'));
- }
-
- public static function tearDownAfterClass()
- {
- $path = __DIR__.'/../Fixtures/to_delete';
- if (file_exists($path)) {
- @unlink($path);
- }
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/CookieTest.php b/assets/php/vendor/symfony/http-foundation/Tests/CookieTest.php
deleted file mode 100755
index 070b7dd..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/CookieTest.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\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\Cookie;
-
-/**
- * CookieTest.
- *
- * @author John Kary
- * @author Hugo Hamon
- *
- * @group time-sensitive
- */
-class CookieTest extends TestCase
-{
- public function invalidNames()
- {
- return array(
- array(''),
- array(',MyName'),
- array(';MyName'),
- array(' MyName'),
- array("\tMyName"),
- array("\rMyName"),
- array("\nMyName"),
- array("\013MyName"),
- array("\014MyName"),
- );
- }
-
- /**
- * @dataProvider invalidNames
- * @expectedException \InvalidArgumentException
- */
- public function testInstantiationThrowsExceptionIfCookieNameContainsInvalidCharacters($name)
- {
- new Cookie($name);
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testInvalidExpiration()
- {
- new Cookie('MyCookie', 'foo', 'bar');
- }
-
- public function testNegativeExpirationIsNotPossible()
- {
- $cookie = new Cookie('foo', 'bar', -100);
-
- $this->assertSame(0, $cookie->getExpiresTime());
- }
-
- public function testGetValue()
- {
- $value = 'MyValue';
- $cookie = new Cookie('MyCookie', $value);
-
- $this->assertSame($value, $cookie->getValue(), '->getValue() returns the proper value');
- }
-
- public function testGetPath()
- {
- $cookie = new Cookie('foo', 'bar');
-
- $this->assertSame('/', $cookie->getPath(), '->getPath() returns / as the default path');
- }
-
- public function testGetExpiresTime()
- {
- $cookie = new Cookie('foo', 'bar');
-
- $this->assertEquals(0, $cookie->getExpiresTime(), '->getExpiresTime() returns the default expire date');
-
- $cookie = new Cookie('foo', 'bar', $expire = time() + 3600);
-
- $this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date');
- }
-
- public function testGetExpiresTimeIsCastToInt()
- {
- $cookie = new Cookie('foo', 'bar', 3600.9);
-
- $this->assertSame(3600, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date as an integer');
- }
-
- public function testConstructorWithDateTime()
- {
- $expire = new \DateTime();
- $cookie = new Cookie('foo', 'bar', $expire);
-
- $this->assertEquals($expire->format('U'), $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date');
- }
-
- /**
- * @requires PHP 5.5
- */
- public function testConstructorWithDateTimeImmutable()
- {
- $expire = new \DateTimeImmutable();
- $cookie = new Cookie('foo', 'bar', $expire);
-
- $this->assertEquals($expire->format('U'), $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date');
- }
-
- public function testGetExpiresTimeWithStringValue()
- {
- $value = '+1 day';
- $cookie = new Cookie('foo', 'bar', $value);
- $expire = strtotime($value);
-
- $this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date', 1);
- }
-
- public function testGetDomain()
- {
- $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com');
-
- $this->assertEquals('.myfoodomain.com', $cookie->getDomain(), '->getDomain() returns the domain name on which the cookie is valid');
- }
-
- public function testIsSecure()
- {
- $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com', true);
-
- $this->assertTrue($cookie->isSecure(), '->isSecure() returns whether the cookie is transmitted over HTTPS');
- }
-
- public function testIsHttpOnly()
- {
- $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com', false, true);
-
- $this->assertTrue($cookie->isHttpOnly(), '->isHttpOnly() returns whether the cookie is only transmitted over HTTP');
- }
-
- public function testCookieIsNotCleared()
- {
- $cookie = new Cookie('foo', 'bar', time() + 3600 * 24);
-
- $this->assertFalse($cookie->isCleared(), '->isCleared() returns false if the cookie did not expire yet');
- }
-
- public function testCookieIsCleared()
- {
- $cookie = new Cookie('foo', 'bar', time() - 20);
-
- $this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired');
- }
-
- public function testToString()
- {
- $cookie = new Cookie('foo', 'bar', $expire = strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
- $this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; max-age='.($expire - time()).'; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() returns string representation of the cookie');
-
- $cookie = new Cookie('foo', 'bar with white spaces', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
- $this->assertEquals('foo=bar%20with%20white%20spaces; expires=Fri, 20-May-2011 15:25:52 GMT; max-age='.($expire - time()).'; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20)');
-
- $cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
- $this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', $expire = time() - 31536001).'; max-age='.($expire - time()).'; path=/admin/; domain=.myfoodomain.com; httponly', (string) $cookie, '->__toString() returns string representation of a cleared cookie if value is NULL');
-
- $cookie = new Cookie('foo', 'bar', 0, '/', '');
- $this->assertEquals('foo=bar; path=/; httponly', (string) $cookie);
- }
-
- public function testRawCookie()
- {
- $cookie = new Cookie('foo', 'b a r', 0, '/', null, false, false);
- $this->assertFalse($cookie->isRaw());
- $this->assertEquals('foo=b%20a%20r; path=/', (string) $cookie);
-
- $cookie = new Cookie('foo', 'b+a+r', 0, '/', null, false, false, true);
- $this->assertTrue($cookie->isRaw());
- $this->assertEquals('foo=b+a+r; path=/', (string) $cookie);
- }
-
- public function testGetMaxAge()
- {
- $cookie = new Cookie('foo', 'bar');
- $this->assertEquals(0, $cookie->getMaxAge());
-
- $cookie = new Cookie('foo', 'bar', $expire = time() + 100);
- $this->assertEquals($expire - time(), $cookie->getMaxAge());
-
- $cookie = new Cookie('foo', 'bar', $expire = time() - 100);
- $this->assertEquals($expire - time(), $cookie->getMaxAge());
- }
-
- public function testFromString()
- {
- $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly');
- $this->assertEquals(new Cookie('foo', 'bar', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true, true, true), $cookie);
-
- $cookie = Cookie::fromString('foo=bar', true);
- $this->assertEquals(new Cookie('foo', 'bar', 0, '/', null, false, false), $cookie);
- }
-
- public function testFromStringWithHttpOnly()
- {
- $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly');
- $this->assertTrue($cookie->isHttpOnly());
-
- $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure');
- $this->assertFalse($cookie->isHttpOnly());
- }
-
- public function testSameSiteAttributeIsCaseInsensitive()
- {
- $cookie = new Cookie('foo', 'bar', 0, '/', null, false, true, false, 'Lax');
- $this->assertEquals('lax', $cookie->getSameSite());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php
deleted file mode 100755
index 1152e46..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.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\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
-use Symfony\Component\HttpFoundation\ExpressionRequestMatcher;
-use Symfony\Component\HttpFoundation\Request;
-
-class ExpressionRequestMatcherTest extends TestCase
-{
- /**
- * @expectedException \LogicException
- */
- public function testWhenNoExpressionIsSet()
- {
- $expressionRequestMatcher = new ExpressionRequestMatcher();
- $expressionRequestMatcher->matches(new Request());
- }
-
- /**
- * @dataProvider provideExpressions
- */
- public function testMatchesWhenParentMatchesIsTrue($expression, $expected)
- {
- $request = Request::create('/foo');
- $expressionRequestMatcher = new ExpressionRequestMatcher();
-
- $expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression);
- $this->assertSame($expected, $expressionRequestMatcher->matches($request));
- }
-
- /**
- * @dataProvider provideExpressions
- */
- public function testMatchesWhenParentMatchesIsFalse($expression)
- {
- $request = Request::create('/foo');
- $request->attributes->set('foo', 'foo');
- $expressionRequestMatcher = new ExpressionRequestMatcher();
- $expressionRequestMatcher->matchAttribute('foo', 'bar');
-
- $expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression);
- $this->assertFalse($expressionRequestMatcher->matches($request));
- }
-
- public function provideExpressions()
- {
- return array(
- array('request.getMethod() == method', true),
- array('request.getPathInfo() == path', true),
- array('request.getHost() == host', true),
- array('request.getClientIp() == ip', true),
- array('request.attributes.all() == attributes', true),
- array('request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true),
- array('request.getMethod() != method', false),
- array('request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/FakeFile.php b/assets/php/vendor/symfony/http-foundation/Tests/File/FakeFile.php
deleted file mode 100755
index c415989..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/FakeFile.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\HttpFoundation\Tests\File;
-
-use Symfony\Component\HttpFoundation\File\File as OrigFile;
-
-class FakeFile extends OrigFile
-{
- private $realpath;
-
- public function __construct($realpath, $path)
- {
- $this->realpath = $realpath;
- parent::__construct($path, false);
- }
-
- public function isReadable()
- {
- return true;
- }
-
- public function getRealpath()
- {
- return $this->realpath;
- }
-
- public function getSize()
- {
- return 42;
- }
-
- public function getMTime()
- {
- return time();
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/FileTest.php b/assets/php/vendor/symfony/http-foundation/Tests/File/FileTest.php
deleted file mode 100755
index dbd9c44..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/FileTest.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\Tests\File;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\File\File;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
-
-class FileTest extends TestCase
-{
- protected $file;
-
- public function testGetMimeTypeUsesMimeTypeGuessers()
- {
- $file = new File(__DIR__.'/Fixtures/test.gif');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
-
- MimeTypeGuesser::getInstance()->register($guesser);
-
- $this->assertEquals('image/gif', $file->getMimeType());
- }
-
- public function testGuessExtensionWithoutGuesser()
- {
- $file = new File(__DIR__.'/Fixtures/directory/.empty');
-
- $this->assertNull($file->guessExtension());
- }
-
- public function testGuessExtensionIsBasedOnMimeType()
- {
- $file = new File(__DIR__.'/Fixtures/test');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
-
- MimeTypeGuesser::getInstance()->register($guesser);
-
- $this->assertEquals('gif', $file->guessExtension());
- }
-
- /**
- * @requires extension fileinfo
- */
- public function testGuessExtensionWithReset()
- {
- $file = new File(__DIR__.'/Fixtures/other-file.example');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
- MimeTypeGuesser::getInstance()->register($guesser);
-
- $this->assertEquals('gif', $file->guessExtension());
-
- MimeTypeGuesser::reset();
-
- $this->assertNull($file->guessExtension());
- }
-
- public function testConstructWhenFileNotExists()
- {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
-
- new File(__DIR__.'/Fixtures/not_here');
- }
-
- public function testMove()
- {
- $path = __DIR__.'/Fixtures/test.copy.gif';
- $targetDir = __DIR__.'/Fixtures/directory';
- $targetPath = $targetDir.'/test.copy.gif';
- @unlink($path);
- @unlink($targetPath);
- copy(__DIR__.'/Fixtures/test.gif', $path);
-
- $file = new File($path);
- $movedFile = $file->move($targetDir);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($path);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($targetPath);
- }
-
- public function testMoveWithNewName()
- {
- $path = __DIR__.'/Fixtures/test.copy.gif';
- $targetDir = __DIR__.'/Fixtures/directory';
- $targetPath = $targetDir.'/test.newname.gif';
- @unlink($path);
- @unlink($targetPath);
- copy(__DIR__.'/Fixtures/test.gif', $path);
-
- $file = new File($path);
- $movedFile = $file->move($targetDir, 'test.newname.gif');
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($path);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($targetPath);
- }
-
- public function getFilenameFixtures()
- {
- return array(
- array('original.gif', 'original.gif'),
- array('..\\..\\original.gif', 'original.gif'),
- array('../../original.gif', 'original.gif'),
- array('файлfile.gif', 'файлfile.gif'),
- array('..\\..\\файлfile.gif', 'файлfile.gif'),
- array('../../файлfile.gif', 'файлfile.gif'),
- );
- }
-
- /**
- * @dataProvider getFilenameFixtures
- */
- public function testMoveWithNonLatinName($filename, $sanitizedFilename)
- {
- $path = __DIR__.'/Fixtures/'.$sanitizedFilename;
- $targetDir = __DIR__.'/Fixtures/directory/';
- $targetPath = $targetDir.$sanitizedFilename;
- @unlink($path);
- @unlink($targetPath);
- copy(__DIR__.'/Fixtures/test.gif', $path);
-
- $file = new File($path);
- $movedFile = $file->move($targetDir, $filename);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($path);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($targetPath);
- }
-
- public function testMoveToAnUnexistentDirectory()
- {
- $sourcePath = __DIR__.'/Fixtures/test.copy.gif';
- $targetDir = __DIR__.'/Fixtures/directory/sub';
- $targetPath = $targetDir.'/test.copy.gif';
- @unlink($sourcePath);
- @unlink($targetPath);
- @rmdir($targetDir);
- copy(__DIR__.'/Fixtures/test.gif', $sourcePath);
-
- $file = new File($sourcePath);
- $movedFile = $file->move($targetDir);
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($sourcePath);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($sourcePath);
- @unlink($targetPath);
- @rmdir($targetDir);
- }
-
- protected function createMockGuesser($path, $mimeType)
- {
- $guesser = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface')->getMock();
- $guesser
- ->expects($this->once())
- ->method('guess')
- ->with($this->equalTo($path))
- ->will($this->returnValue($mimeType))
- ;
-
- return $guesser;
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension
deleted file mode 100755
index 4d1ae35..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension
+++ /dev/null
@@ -1 +0,0 @@
-f
\ No newline at end of file
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty
deleted file mode 100755
index e69de29..0000000
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example
deleted file mode 100755
index e69de29..0000000
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test
deleted file mode 100755
index b636f4b..0000000
Binary files a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test and /dev/null differ
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif b/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif
deleted file mode 100755
index b636f4b..0000000
Binary files a/assets/php/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif and /dev/null differ
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php b/assets/php/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php
deleted file mode 100755
index b3f1f02..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php
+++ /dev/null
@@ -1,90 +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\Tests\File\MimeType;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
-use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
-
-/**
- * @requires extension fileinfo
- */
-class MimeTypeTest extends TestCase
-{
- protected $path;
-
- public function testGuessImageWithoutExtension()
- {
- $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test'));
- }
-
- public function testGuessImageWithDirectory()
- {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
-
- MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory');
- }
-
- public function testGuessImageWithFileBinaryMimeTypeGuesser()
- {
- $guesser = MimeTypeGuesser::getInstance();
- $guesser->register(new FileBinaryMimeTypeGuesser());
- $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test'));
- }
-
- public function testGuessImageWithKnownExtension()
- {
- $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test.gif'));
- }
-
- public function testGuessFileWithUnknownExtension()
- {
- $this->assertEquals('application/octet-stream', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/.unknownextension'));
- }
-
- public function testGuessWithIncorrectPath()
- {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
- MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here');
- }
-
- public function testGuessWithNonReadablePath()
- {
- if ('\\' === DIRECTORY_SEPARATOR) {
- $this->markTestSkipped('Can not verify chmod operations on Windows');
- }
-
- if (!getenv('USER') || 'root' === getenv('USER')) {
- $this->markTestSkipped('This test will fail if run under superuser');
- }
-
- $path = __DIR__.'/../Fixtures/to_delete';
- touch($path);
- @chmod($path, 0333);
-
- if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
- MimeTypeGuesser::getInstance()->guess($path);
- } else {
- $this->markTestSkipped('Can not verify chmod operations, change of file permissions failed');
- }
- }
-
- public static function tearDownAfterClass()
- {
- $path = __DIR__.'/../Fixtures/to_delete';
- if (file_exists($path)) {
- @chmod($path, 0666);
- @unlink($path);
- }
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php b/assets/php/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php
deleted file mode 100755
index 36f122f..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php
+++ /dev/null
@@ -1,273 +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\Tests\File;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\File\UploadedFile;
-
-class UploadedFileTest extends TestCase
-{
- protected function setUp()
- {
- if (!ini_get('file_uploads')) {
- $this->markTestSkipped('file_uploads is disabled in php.ini');
- }
- }
-
- public function testConstructWhenFileNotExists()
- {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
-
- new UploadedFile(
- __DIR__.'/Fixtures/not_here',
- 'original.gif',
- null
- );
- }
-
- public function testFileUploadsWithNoMimeType()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/test.gif'),
- UPLOAD_ERR_OK
- );
-
- $this->assertEquals('application/octet-stream', $file->getClientMimeType());
-
- if (extension_loaded('fileinfo')) {
- $this->assertEquals('image/gif', $file->getMimeType());
- }
- }
-
- public function testFileUploadsWithUnknownMimeType()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/.unknownextension',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/.unknownextension'),
- UPLOAD_ERR_OK
- );
-
- $this->assertEquals('application/octet-stream', $file->getClientMimeType());
- }
-
- public function testGuessClientExtension()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('gif', $file->guessClientExtension());
- }
-
- public function testGuessClientExtensionWithIncorrectMimeType()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/jpeg',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('jpeg', $file->guessClientExtension());
- }
-
- public function testErrorIsOkByDefault()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals(UPLOAD_ERR_OK, $file->getError());
- }
-
- public function testGetClientOriginalName()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('original.gif', $file->getClientOriginalName());
- }
-
- public function testGetClientOriginalExtension()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('gif', $file->getClientOriginalExtension());
- }
-
- /**
- * @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileException
- */
- public function testMoveLocalFileIsNotAllowed()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- UPLOAD_ERR_OK
- );
-
- $movedFile = $file->move(__DIR__.'/Fixtures/directory');
- }
-
- public function testMoveLocalFileIsAllowedInTestMode()
- {
- $path = __DIR__.'/Fixtures/test.copy.gif';
- $targetDir = __DIR__.'/Fixtures/directory';
- $targetPath = $targetDir.'/test.copy.gif';
- @unlink($path);
- @unlink($targetPath);
- copy(__DIR__.'/Fixtures/test.gif', $path);
-
- $file = new UploadedFile(
- $path,
- 'original.gif',
- 'image/gif',
- filesize($path),
- UPLOAD_ERR_OK,
- true
- );
-
- $movedFile = $file->move(__DIR__.'/Fixtures/directory');
-
- $this->assertFileExists($targetPath);
- $this->assertFileNotExists($path);
- $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());
-
- @unlink($targetPath);
- }
-
- public function testGetClientOriginalNameSanitizeFilename()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- '../../original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals('original.gif', $file->getClientOriginalName());
- }
-
- public function testGetSize()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- 'image/gif',
- filesize(__DIR__.'/Fixtures/test.gif'),
- null
- );
-
- $this->assertEquals(filesize(__DIR__.'/Fixtures/test.gif'), $file->getSize());
-
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test',
- 'original.gif',
- 'image/gif'
- );
-
- $this->assertEquals(filesize(__DIR__.'/Fixtures/test'), $file->getSize());
- }
-
- public function testGetExtension()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null
- );
-
- $this->assertEquals('gif', $file->getExtension());
- }
-
- public function testIsValid()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/test.gif'),
- UPLOAD_ERR_OK,
- true
- );
-
- $this->assertTrue($file->isValid());
- }
-
- /**
- * @dataProvider uploadedFileErrorProvider
- */
- public function testIsInvalidOnUploadError($error)
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/test.gif'),
- $error
- );
-
- $this->assertFalse($file->isValid());
- }
-
- public function uploadedFileErrorProvider()
- {
- return array(
- array(UPLOAD_ERR_INI_SIZE),
- array(UPLOAD_ERR_FORM_SIZE),
- array(UPLOAD_ERR_PARTIAL),
- array(UPLOAD_ERR_NO_TMP_DIR),
- array(UPLOAD_ERR_EXTENSION),
- );
- }
-
- public function testIsInvalidIfNotHttpUpload()
- {
- $file = new UploadedFile(
- __DIR__.'/Fixtures/test.gif',
- 'original.gif',
- null,
- filesize(__DIR__.'/Fixtures/test.gif'),
- UPLOAD_ERR_OK
- );
-
- $this->assertFalse($file->isValid());
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/FileBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/FileBagTest.php
deleted file mode 100755
index b1bbba0..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/FileBagTest.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\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\File\UploadedFile;
-use Symfony\Component\HttpFoundation\FileBag;
-
-/**
- * FileBagTest.
- *
- * @author Fabien Potencier
- * @author Bulat Shakirzyanov
- */
-class FileBagTest extends TestCase
-{
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testFileMustBeAnArrayOrUploadedFile()
- {
- new FileBag(array('file' => 'foo'));
- }
-
- public function testShouldConvertsUploadedFiles()
- {
- $tmpFile = $this->createTempFile();
- $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
-
- $bag = new FileBag(array('file' => array(
- 'name' => basename($tmpFile),
- 'type' => 'text/plain',
- 'tmp_name' => $tmpFile,
- 'error' => 0,
- 'size' => 100,
- )));
-
- $this->assertEquals($file, $bag->get('file'));
- }
-
- public function testShouldSetEmptyUploadedFilesToNull()
- {
- $bag = new FileBag(array('file' => array(
- 'name' => '',
- 'type' => '',
- 'tmp_name' => '',
- 'error' => UPLOAD_ERR_NO_FILE,
- 'size' => 0,
- )));
-
- $this->assertNull($bag->get('file'));
- }
-
- public function testShouldRemoveEmptyUploadedFilesForMultiUpload()
- {
- $bag = new FileBag(array('files' => array(
- 'name' => array(''),
- 'type' => array(''),
- 'tmp_name' => array(''),
- 'error' => array(UPLOAD_ERR_NO_FILE),
- 'size' => array(0),
- )));
-
- $this->assertSame(array(), $bag->get('files'));
- }
-
- public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray()
- {
- $bag = new FileBag(array('files' => array(
- 'name' => array('file1' => ''),
- 'type' => array('file1' => ''),
- 'tmp_name' => array('file1' => ''),
- 'error' => array('file1' => UPLOAD_ERR_NO_FILE),
- 'size' => array('file1' => 0),
- )));
-
- $this->assertSame(array('file1' => null), $bag->get('files'));
- }
-
- public function testShouldConvertUploadedFilesWithPhpBug()
- {
- $tmpFile = $this->createTempFile();
- $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
-
- $bag = new FileBag(array(
- 'child' => array(
- 'name' => array(
- 'file' => basename($tmpFile),
- ),
- 'type' => array(
- 'file' => 'text/plain',
- ),
- 'tmp_name' => array(
- 'file' => $tmpFile,
- ),
- 'error' => array(
- 'file' => 0,
- ),
- 'size' => array(
- 'file' => 100,
- ),
- ),
- ));
-
- $files = $bag->all();
- $this->assertEquals($file, $files['child']['file']);
- }
-
- public function testShouldConvertNestedUploadedFilesWithPhpBug()
- {
- $tmpFile = $this->createTempFile();
- $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
-
- $bag = new FileBag(array(
- 'child' => array(
- 'name' => array(
- 'sub' => array('file' => basename($tmpFile)),
- ),
- 'type' => array(
- 'sub' => array('file' => 'text/plain'),
- ),
- 'tmp_name' => array(
- 'sub' => array('file' => $tmpFile),
- ),
- 'error' => array(
- 'sub' => array('file' => 0),
- ),
- 'size' => array(
- 'sub' => array('file' => 100),
- ),
- ),
- ));
-
- $files = $bag->all();
- $this->assertEquals($file, $files['child']['sub']['file']);
- }
-
- public function testShouldNotConvertNestedUploadedFiles()
- {
- $tmpFile = $this->createTempFile();
- $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
- $bag = new FileBag(array('image' => array('file' => $file)));
-
- $files = $bag->all();
- $this->assertEquals($file, $files['image']['file']);
- }
-
- protected function createTempFile()
- {
- return tempnam(sys_get_temp_dir().'/form_test', 'FormTest');
- }
-
- protected function setUp()
- {
- mkdir(sys_get_temp_dir().'/form_test', 0777, true);
- }
-
- protected function tearDown()
- {
- foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) {
- unlink($file);
- }
-
- rmdir(sys_get_temp_dir().'/form_test');
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/HeaderBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/HeaderBagTest.php
deleted file mode 100755
index 6d19ceb..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/HeaderBagTest.php
+++ /dev/null
@@ -1,205 +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\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\HeaderBag;
-
-class HeaderBagTest extends TestCase
-{
- public function testConstructor()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
- $this->assertTrue($bag->has('foo'));
- }
-
- public function testToStringNull()
- {
- $bag = new HeaderBag();
- $this->assertEquals('', $bag->__toString());
- }
-
- public function testToStringNotNull()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
- $this->assertEquals("Foo: bar\r\n", $bag->__toString());
- }
-
- public function testKeys()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
- $keys = $bag->keys();
- $this->assertEquals('foo', $keys[0]);
- }
-
- public function testGetDate()
- {
- $bag = new HeaderBag(array('foo' => 'Tue, 4 Sep 2012 20:00:00 +0200'));
- $headerDate = $bag->getDate('foo');
- $this->assertInstanceOf('DateTime', $headerDate);
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function testGetDateException()
- {
- $bag = new HeaderBag(array('foo' => 'Tue'));
- $headerDate = $bag->getDate('foo');
- }
-
- public function testGetCacheControlHeader()
- {
- $bag = new HeaderBag();
- $bag->addCacheControlDirective('public', '#a');
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- $this->assertEquals('#a', $bag->getCacheControlDirective('public'));
- }
-
- public function testAll()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo' => array('bar')), $bag->all(), '->all() gets all the input');
-
- $bag = new HeaderBag(array('FOO' => 'BAR'));
- $this->assertEquals(array('foo' => array('BAR')), $bag->all(), '->all() gets all the input key are lower case');
- }
-
- public function testReplace()
- {
- $bag = new HeaderBag(array('foo' => 'bar'));
-
- $bag->replace(array('NOPE' => 'BAR'));
- $this->assertEquals(array('nope' => array('BAR')), $bag->all(), '->replace() replaces the input with the argument');
- $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input');
- }
-
- public function testGet()
- {
- $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
- $this->assertEquals('bar', $bag->get('foo'), '->get return current value');
- $this->assertEquals('bar', $bag->get('FoO'), '->get key in case insensitive');
- $this->assertEquals(array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array');
-
- // defaults
- $this->assertNull($bag->get('none'), '->get unknown values returns null');
- $this->assertEquals('default', $bag->get('none', 'default'), '->get unknown values returns default');
- $this->assertEquals(array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array');
-
- $bag->set('foo', 'bor', false);
- $this->assertEquals('bar', $bag->get('foo'), '->get return first value');
- $this->assertEquals(array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array');
- }
-
- public function testSetAssociativeArray()
- {
- $bag = new HeaderBag();
- $bag->set('foo', array('bad-assoc-index' => 'value'));
- $this->assertSame('value', $bag->get('foo'));
- $this->assertEquals(array('value'), $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored');
- }
-
- public function testContains()
- {
- $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
- $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
- $this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value');
- $this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value');
- $this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
-
- // Multiple values
- $bag->set('foo', 'bor', false);
- $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
- $this->assertTrue($bag->contains('foo', 'bor'), '->contains second value');
- $this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value');
- }
-
- public function testCacheControlDirectiveAccessors()
- {
- $bag = new HeaderBag();
- $bag->addCacheControlDirective('public');
-
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- $this->assertTrue($bag->getCacheControlDirective('public'));
- $this->assertEquals('public', $bag->get('cache-control'));
-
- $bag->addCacheControlDirective('max-age', 10);
- $this->assertTrue($bag->hasCacheControlDirective('max-age'));
- $this->assertEquals(10, $bag->getCacheControlDirective('max-age'));
- $this->assertEquals('max-age=10, public', $bag->get('cache-control'));
-
- $bag->removeCacheControlDirective('max-age');
- $this->assertFalse($bag->hasCacheControlDirective('max-age'));
- }
-
- public function testCacheControlDirectiveParsing()
- {
- $bag = new HeaderBag(array('cache-control' => 'public, max-age=10'));
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- $this->assertTrue($bag->getCacheControlDirective('public'));
-
- $this->assertTrue($bag->hasCacheControlDirective('max-age'));
- $this->assertEquals(10, $bag->getCacheControlDirective('max-age'));
-
- $bag->addCacheControlDirective('s-maxage', 100);
- $this->assertEquals('max-age=10, public, s-maxage=100', $bag->get('cache-control'));
- }
-
- public function testCacheControlDirectiveParsingQuotedZero()
- {
- $bag = new HeaderBag(array('cache-control' => 'max-age="0"'));
- $this->assertTrue($bag->hasCacheControlDirective('max-age'));
- $this->assertEquals(0, $bag->getCacheControlDirective('max-age'));
- }
-
- public function testCacheControlDirectiveOverrideWithReplace()
- {
- $bag = new HeaderBag(array('cache-control' => 'private, max-age=100'));
- $bag->replace(array('cache-control' => 'public, max-age=10'));
- $this->assertTrue($bag->hasCacheControlDirective('public'));
- $this->assertTrue($bag->getCacheControlDirective('public'));
-
- $this->assertTrue($bag->hasCacheControlDirective('max-age'));
- $this->assertEquals(10, $bag->getCacheControlDirective('max-age'));
- }
-
- public function testCacheControlClone()
- {
- $headers = array('foo' => 'bar');
- $bag1 = new HeaderBag($headers);
- $bag2 = new HeaderBag($bag1->all());
-
- $this->assertEquals($bag1->all(), $bag2->all());
- }
-
- public function testGetIterator()
- {
- $headers = array('foo' => 'bar', 'hello' => 'world', 'third' => 'charm');
- $headerBag = new HeaderBag($headers);
-
- $i = 0;
- foreach ($headerBag as $key => $val) {
- ++$i;
- $this->assertEquals(array($headers[$key]), $val);
- }
-
- $this->assertEquals(count($headers), $i);
- }
-
- public function testCount()
- {
- $headers = array('foo' => 'bar', 'HELLO' => 'WORLD');
- $headerBag = new HeaderBag($headers);
-
- $this->assertCount(count($headers), $headerBag);
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/IpUtilsTest.php b/assets/php/vendor/symfony/http-foundation/Tests/IpUtilsTest.php
deleted file mode 100755
index 7a93f99..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/IpUtilsTest.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\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\IpUtils;
-
-class IpUtilsTest extends TestCase
-{
- /**
- * @dataProvider getIpv4Data
- */
- public function testIpv4($matches, $remoteAddr, $cidr)
- {
- $this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr));
- }
-
- public function getIpv4Data()
- {
- return array(
- array(true, '192.168.1.1', '192.168.1.1'),
- array(true, '192.168.1.1', '192.168.1.1/1'),
- array(true, '192.168.1.1', '192.168.1.0/24'),
- array(false, '192.168.1.1', '1.2.3.4/1'),
- array(false, '192.168.1.1', '192.168.1.1/33'), // invalid subnet
- array(true, '192.168.1.1', array('1.2.3.4/1', '192.168.1.0/24')),
- array(true, '192.168.1.1', array('192.168.1.0/24', '1.2.3.4/1')),
- array(false, '192.168.1.1', array('1.2.3.4/1', '4.3.2.1/1')),
- array(true, '1.2.3.4', '0.0.0.0/0'),
- array(true, '1.2.3.4', '192.168.1.0/0'),
- array(false, '1.2.3.4', '256.256.256/0'), // invalid CIDR notation
- array(false, 'an_invalid_ip', '192.168.1.0/24'),
- );
- }
-
- /**
- * @dataProvider getIpv6Data
- */
- public function testIpv6($matches, $remoteAddr, $cidr)
- {
- if (!defined('AF_INET6')) {
- $this->markTestSkipped('Only works when PHP is compiled without the option "disable-ipv6".');
- }
-
- $this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr));
- }
-
- public function getIpv6Data()
- {
- return array(
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'),
- array(false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'),
- array(true, '0:0:0:0:0:0:0:1', '::1'),
- array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'),
- array(true, '0:0:603:0:396e:4789:8e99:0001', '::/0'),
- array(true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'),
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')),
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')),
- array(false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'),
- );
- }
-
- /**
- * @expectedException \RuntimeException
- * @requires extension sockets
- */
- public function testAnIpv6WithOptionDisabledIpv6()
- {
- if (defined('AF_INET6')) {
- $this->markTestSkipped('Only works when PHP is compiled with the option "disable-ipv6".');
- }
-
- IpUtils::checkIp('2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65');
- }
-
- /**
- * @dataProvider invalidIpAddressData
- */
- public function testInvalidIpAddressesDoNotMatch($requestIp, $proxyIp)
- {
- $this->assertFalse(IpUtils::checkIp4($requestIp, $proxyIp));
- }
-
- public function invalidIpAddressData()
- {
- return array(
- 'invalid proxy wildcard' => array('192.168.20.13', '*'),
- 'invalid proxy missing netmask' => array('192.168.20.13', '0.0.0.0'),
- 'invalid request IP with invalid proxy wildcard' => array('0.0.0.0', '*'),
- );
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/JsonResponseTest.php b/assets/php/vendor/symfony/http-foundation/Tests/JsonResponseTest.php
deleted file mode 100755
index 201839f..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/JsonResponseTest.php
+++ /dev/null
@@ -1,257 +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\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\JsonResponse;
-
-class JsonResponseTest extends TestCase
-{
- public function testConstructorEmptyCreatesJsonObject()
- {
- $response = new JsonResponse();
- $this->assertSame('{}', $response->getContent());
- }
-
- public function testConstructorWithArrayCreatesJsonArray()
- {
- $response = new JsonResponse(array(0, 1, 2, 3));
- $this->assertSame('[0,1,2,3]', $response->getContent());
- }
-
- public function testConstructorWithAssocArrayCreatesJsonObject()
- {
- $response = new JsonResponse(array('foo' => 'bar'));
- $this->assertSame('{"foo":"bar"}', $response->getContent());
- }
-
- public function testConstructorWithSimpleTypes()
- {
- $response = new JsonResponse('foo');
- $this->assertSame('"foo"', $response->getContent());
-
- $response = new JsonResponse(0);
- $this->assertSame('0', $response->getContent());
-
- $response = new JsonResponse(0.1);
- $this->assertSame('0.1', $response->getContent());
-
- $response = new JsonResponse(true);
- $this->assertSame('true', $response->getContent());
- }
-
- public function testConstructorWithCustomStatus()
- {
- $response = new JsonResponse(array(), 202);
- $this->assertSame(202, $response->getStatusCode());
- }
-
- public function testConstructorAddsContentTypeHeader()
- {
- $response = new JsonResponse();
- $this->assertSame('application/json', $response->headers->get('Content-Type'));
- }
-
- public function testConstructorWithCustomHeaders()
- {
- $response = new JsonResponse(array(), 200, array('ETag' => 'foo'));
- $this->assertSame('application/json', $response->headers->get('Content-Type'));
- $this->assertSame('foo', $response->headers->get('ETag'));
- }
-
- public function testConstructorWithCustomContentType()
- {
- $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');
-
- $response = new JsonResponse(array(), 200, $headers);
- $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
- }
-
- public function testSetJson()
- {
- $response = new JsonResponse('1', 200, array(), true);
- $this->assertEquals('1', $response->getContent());
-
- $response = new JsonResponse('[1]', 200, array(), true);
- $this->assertEquals('[1]', $response->getContent());
-
- $response = new JsonResponse(null, 200, array());
- $response->setJson('true');
- $this->assertEquals('true', $response->getContent());
- }
-
- public function testCreate()
- {
- $response = JsonResponse::create(array('foo' => 'bar'), 204);
-
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertEquals('{"foo":"bar"}', $response->getContent());
- $this->assertEquals(204, $response->getStatusCode());
- }
-
- public function testStaticCreateEmptyJsonObject()
- {
- $response = JsonResponse::create();
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('{}', $response->getContent());
- }
-
- public function testStaticCreateJsonArray()
- {
- $response = JsonResponse::create(array(0, 1, 2, 3));
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('[0,1,2,3]', $response->getContent());
- }
-
- public function testStaticCreateJsonObject()
- {
- $response = JsonResponse::create(array('foo' => 'bar'));
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('{"foo":"bar"}', $response->getContent());
- }
-
- public function testStaticCreateWithSimpleTypes()
- {
- $response = JsonResponse::create('foo');
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('"foo"', $response->getContent());
-
- $response = JsonResponse::create(0);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('0', $response->getContent());
-
- $response = JsonResponse::create(0.1);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('0.1', $response->getContent());
-
- $response = JsonResponse::create(true);
- $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('true', $response->getContent());
- }
-
- public function testStaticCreateWithCustomStatus()
- {
- $response = JsonResponse::create(array(), 202);
- $this->assertSame(202, $response->getStatusCode());
- }
-
- public function testStaticCreateAddsContentTypeHeader()
- {
- $response = JsonResponse::create();
- $this->assertSame('application/json', $response->headers->get('Content-Type'));
- }
-
- public function testStaticCreateWithCustomHeaders()
- {
- $response = JsonResponse::create(array(), 200, array('ETag' => 'foo'));
- $this->assertSame('application/json', $response->headers->get('Content-Type'));
- $this->assertSame('foo', $response->headers->get('ETag'));
- }
-
- public function testStaticCreateWithCustomContentType()
- {
- $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');
-
- $response = JsonResponse::create(array(), 200, $headers);
- $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
- }
-
- public function testSetCallback()
- {
- $response = JsonResponse::create(array('foo' => 'bar'))->setCallback('callback');
-
- $this->assertEquals('/**/callback({"foo":"bar"});', $response->getContent());
- $this->assertEquals('text/javascript', $response->headers->get('Content-Type'));
- }
-
- public function testJsonEncodeFlags()
- {
- $response = new JsonResponse('<>\'&"');
-
- $this->assertEquals('"\u003C\u003E\u0027\u0026\u0022"', $response->getContent());
- }
-
- public function testGetEncodingOptions()
- {
- $response = new JsonResponse();
-
- $this->assertEquals(JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT, $response->getEncodingOptions());
- }
-
- public function testSetEncodingOptions()
- {
- $response = new JsonResponse();
- $response->setData(array(array(1, 2, 3)));
-
- $this->assertEquals('[[1,2,3]]', $response->getContent());
-
- $response->setEncodingOptions(JSON_FORCE_OBJECT);
-
- $this->assertEquals('{"0":{"0":1,"1":2,"2":3}}', $response->getContent());
- }
-
- public function testItAcceptsJsonAsString()
- {
- $response = JsonResponse::fromJsonString('{"foo":"bar"}');
- $this->assertSame('{"foo":"bar"}', $response->getContent());
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testSetCallbackInvalidIdentifier()
- {
- $response = new JsonResponse('foo');
- $response->setCallback('+invalid');
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testSetContent()
- {
- JsonResponse::create("\xB1\x31");
- }
-
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage This error is expected
- */
- public function testSetContentJsonSerializeError()
- {
- if (!interface_exists('JsonSerializable', false)) {
- $this->markTestSkipped('JsonSerializable is required.');
- }
-
- $serializable = new JsonSerializableObject();
-
- JsonResponse::create($serializable);
- }
-
- public function testSetComplexCallback()
- {
- $response = JsonResponse::create(array('foo' => 'bar'));
- $response->setCallback('ಠ_ಠ["foo"].bar[0]');
-
- $this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent());
- }
-}
-
-if (interface_exists('JsonSerializable', false)) {
- class JsonSerializableObject implements \JsonSerializable
- {
- public function jsonSerialize()
- {
- throw new \Exception('This error is expected');
- }
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/ParameterBagTest.php b/assets/php/vendor/symfony/http-foundation/Tests/ParameterBagTest.php
deleted file mode 100755
index ab908d8..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/ParameterBagTest.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\HttpFoundation\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\ParameterBag;
-
-class ParameterBagTest extends TestCase
-{
- public function testConstructor()
- {
- $this->testAll();
- }
-
- public function testAll()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo' => 'bar'), $bag->all(), '->all() gets all the input');
- }
-
- public function testKeys()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo'), $bag->keys());
- }
-
- public function testAdd()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
- $bag->add(array('bar' => 'bas'));
- $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all());
- }
-
- public function testRemove()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
- $bag->add(array('bar' => 'bas'));
- $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all());
- $bag->remove('bar');
- $this->assertEquals(array('foo' => 'bar'), $bag->all());
- }
-
- public function testReplace()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
-
- $bag->replace(array('FOO' => 'BAR'));
- $this->assertEquals(array('FOO' => 'BAR'), $bag->all(), '->replace() replaces the input with the argument');
- $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input');
- }
-
- public function testGet()
- {
- $bag = new ParameterBag(array('foo' => 'bar', 'null' => null));
-
- $this->assertEquals('bar', $bag->get('foo'), '->get() gets the value of a parameter');
- $this->assertEquals('default', $bag->get('unknown', 'default'), '->get() returns second argument as default if a parameter is not defined');
- $this->assertNull($bag->get('null', 'default'), '->get() returns null if null is set');
- }
-
- public function testGetDoesNotUseDeepByDefault()
- {
- $bag = new ParameterBag(array('foo' => array('bar' => 'moo')));
-
- $this->assertNull($bag->get('foo[bar]'));
- }
-
- public function testSet()
- {
- $bag = new ParameterBag(array());
-
- $bag->set('foo', 'bar');
- $this->assertEquals('bar', $bag->get('foo'), '->set() sets the value of parameter');
-
- $bag->set('foo', 'baz');
- $this->assertEquals('baz', $bag->get('foo'), '->set() overrides previously set parameter');
- }
-
- public function testHas()
- {
- $bag = new ParameterBag(array('foo' => 'bar'));
-
- $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined');
- $this->assertFalse($bag->has('unknown'), '->has() return false if a parameter is not defined');
- }
-
- public function testGetAlpha()
- {
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
-
- $this->assertEquals('fooBAR', $bag->getAlpha('word'), '->getAlpha() gets only alphabetic characters');
- $this->assertEquals('', $bag->getAlpha('unknown'), '->getAlpha() returns empty string if a parameter is not defined');
- }
-
- public function testGetAlnum()
- {
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
-
- $this->assertEquals('fooBAR012', $bag->getAlnum('word'), '->getAlnum() gets only alphanumeric characters');
- $this->assertEquals('', $bag->getAlnum('unknown'), '->getAlnum() returns empty string if a parameter is not defined');
- }
-
- public function testGetDigits()
- {
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
-
- $this->assertEquals('012', $bag->getDigits('word'), '->getDigits() gets only digits as string');
- $this->assertEquals('', $bag->getDigits('unknown'), '->getDigits() returns empty string if a parameter is not defined');
- }
-
- public function testGetInt()
- {
- $bag = new ParameterBag(array('digits' => '0123'));
-
- $this->assertEquals(123, $bag->getInt('digits'), '->getInt() gets a value of parameter as integer');
- $this->assertEquals(0, $bag->getInt('unknown'), '->getInt() returns zero if a parameter is not defined');
- }
-
- public function testFilter()
- {
- $bag = new ParameterBag(array(
- 'digits' => '0123ab',
- 'email' => 'example@example.com',
- 'url' => 'http://example.com/foo',
- 'dec' => '256',
- 'hex' => '0x100',
- 'array' => array('bang'),
- ));
-
- $this->assertEmpty($bag->filter('nokey'), '->filter() should return empty by default if no key is found');
-
- $this->assertEquals('0123', $bag->filter('digits', '', FILTER_SANITIZE_NUMBER_INT), '->filter() gets a value of parameter as integer filtering out invalid characters');
-
- $this->assertEquals('example@example.com', $bag->filter('email', '', FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email');
-
- $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path');
-
- // This test is repeated for code-coverage
- $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path');
-
- $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, array(
- 'flags' => FILTER_FLAG_ALLOW_HEX,
- 'options' => array('min_range' => 1, 'max_range' => 0xff),
- )), '->filter() gets a value of parameter as integer between boundaries');
-
- $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, array(
- 'flags' => FILTER_FLAG_ALLOW_HEX,
- 'options' => array('min_range' => 1, 'max_range' => 0xff),
- )), '->filter() gets a value of parameter as integer between boundaries');
-
- $this->assertEquals(array('bang'), $bag->filter('array', ''), '->filter() gets a value of parameter as an array');
- }
-
- public function testGetIterator()
- {
- $parameters = array('foo' => 'bar', 'hello' => 'world');
- $bag = new ParameterBag($parameters);
-
- $i = 0;
- foreach ($bag as $key => $val) {
- ++$i;
- $this->assertEquals($parameters[$key], $val);
- }
-
- $this->assertEquals(count($parameters), $i);
- }
-
- public function testCount()
- {
- $parameters = array('foo' => 'bar', 'hello' => 'world');
- $bag = new ParameterBag($parameters);
-
- $this->assertCount(count($parameters), $bag);
- }
-
- public function testGetBoolean()
- {
- $parameters = array('string_true' => 'true', 'string_false' => 'false');
- $bag = new ParameterBag($parameters);
-
- $this->assertTrue($bag->getBoolean('string_true'), '->getBoolean() gets the string true as boolean true');
- $this->assertFalse($bag->getBoolean('string_false'), '->getBoolean() gets the string false as boolean false');
- $this->assertFalse($bag->getBoolean('unknown'), '->getBoolean() returns false if a parameter is not defined');
- }
-}
diff --git a/assets/php/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php b/assets/php/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php
deleted file mode 100755
index d389e83..0000000
--- a/assets/php/vendor/symfony/http-foundation/Tests/RedirectResponseTest.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\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\HttpFoundation\RedirectResponse;
-
-class RedirectResponseTest extends TestCase
-{
- public function testGenerateMetaRedirect()
- {
- $response = new RedirectResponse('foo.bar');
-
- $this->assertEquals(1, preg_match(
- '#