mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 18:29:39 +02:00
Added vendor directory to source control
This commit is contained in:
parent
b65ed2bc68
commit
1a661614b7
20999 changed files with 2890743 additions and 2883485 deletions
|
@ -1,65 +1,65 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
|
||||
/**
|
||||
* Generates URLs based on rules dumped by CompiledUrlGeneratorDumper.
|
||||
*/
|
||||
class CompiledUrlGenerator extends UrlGenerator
|
||||
{
|
||||
private $compiledRoutes = [];
|
||||
private $defaultLocale;
|
||||
|
||||
public function __construct(array $compiledRoutes, RequestContext $context, LoggerInterface $logger = null, string $defaultLocale = null)
|
||||
{
|
||||
$this->compiledRoutes = $compiledRoutes;
|
||||
$this->context = $context;
|
||||
$this->logger = $logger;
|
||||
$this->defaultLocale = $defaultLocale;
|
||||
}
|
||||
|
||||
public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH)
|
||||
{
|
||||
$locale = $parameters['_locale']
|
||||
?? $this->context->getParameter('_locale')
|
||||
?: $this->defaultLocale;
|
||||
|
||||
if (null !== $locale) {
|
||||
do {
|
||||
if (($this->compiledRoutes[$name.'.'.$locale][1]['_canonical_route'] ?? null) === $name) {
|
||||
$name .= '.'.$locale;
|
||||
break;
|
||||
}
|
||||
} while (false !== $locale = strstr($locale, '_', true));
|
||||
}
|
||||
|
||||
if (!isset($this->compiledRoutes[$name])) {
|
||||
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
|
||||
}
|
||||
|
||||
[$variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes] = $this->compiledRoutes[$name];
|
||||
|
||||
if (isset($defaults['_canonical_route']) && isset($defaults['_locale'])) {
|
||||
if (!\in_array('_locale', $variables, true)) {
|
||||
unset($parameters['_locale']);
|
||||
} elseif (!isset($parameters['_locale'])) {
|
||||
$parameters['_locale'] = $defaults['_locale'];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
|
||||
/**
|
||||
* Generates URLs based on rules dumped by CompiledUrlGeneratorDumper.
|
||||
*/
|
||||
class CompiledUrlGenerator extends UrlGenerator
|
||||
{
|
||||
private $compiledRoutes = [];
|
||||
private $defaultLocale;
|
||||
|
||||
public function __construct(array $compiledRoutes, RequestContext $context, LoggerInterface $logger = null, string $defaultLocale = null)
|
||||
{
|
||||
$this->compiledRoutes = $compiledRoutes;
|
||||
$this->context = $context;
|
||||
$this->logger = $logger;
|
||||
$this->defaultLocale = $defaultLocale;
|
||||
}
|
||||
|
||||
public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH)
|
||||
{
|
||||
$locale = $parameters['_locale']
|
||||
?? $this->context->getParameter('_locale')
|
||||
?: $this->defaultLocale;
|
||||
|
||||
if (null !== $locale) {
|
||||
do {
|
||||
if (($this->compiledRoutes[$name.'.'.$locale][1]['_canonical_route'] ?? null) === $name) {
|
||||
$name .= '.'.$locale;
|
||||
break;
|
||||
}
|
||||
} while (false !== $locale = strstr($locale, '_', true));
|
||||
}
|
||||
|
||||
if (!isset($this->compiledRoutes[$name])) {
|
||||
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
|
||||
}
|
||||
|
||||
[$variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes] = $this->compiledRoutes[$name];
|
||||
|
||||
if (isset($defaults['_canonical_route']) && isset($defaults['_locale'])) {
|
||||
if (!\in_array('_locale', $variables, true)) {
|
||||
unset($parameters['_locale']);
|
||||
} elseif (!isset($parameters['_locale'])) {
|
||||
$parameters['_locale'] = $defaults['_locale'];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator;
|
||||
|
||||
/**
|
||||
* ConfigurableRequirementsInterface must be implemented by URL generators that
|
||||
* can be configured whether an exception should be generated when the parameters
|
||||
* do not match the requirements. It is also possible to disable the requirements
|
||||
* check for URL generation completely.
|
||||
*
|
||||
* The possible configurations and use-cases:
|
||||
* - setStrictRequirements(true): Throw an exception for mismatching requirements. This
|
||||
* is mostly useful in development environment.
|
||||
* - setStrictRequirements(false): Don't throw an exception but return an empty string as URL for
|
||||
* mismatching requirements and log the problem. Useful when you cannot control all
|
||||
* params because they come from third party libs but don't want to have a 404 in
|
||||
* production environment. It should log the mismatch so one can review it.
|
||||
* - setStrictRequirements(null): Return the URL with the given parameters without
|
||||
* checking the requirements at all. When generating a URL you should either trust
|
||||
* your params or you validated them beforehand because otherwise it would break your
|
||||
* link anyway. So in production environment you should know that params always pass
|
||||
* the requirements. Thus this option allows to disable the check on URL generation for
|
||||
* performance reasons (saving a preg_match for each requirement every time a URL is
|
||||
* generated).
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
interface ConfigurableRequirementsInterface
|
||||
{
|
||||
/**
|
||||
* Enables or disables the exception on incorrect parameters.
|
||||
* Passing null will deactivate the requirements check completely.
|
||||
*/
|
||||
public function setStrictRequirements(?bool $enabled);
|
||||
|
||||
/**
|
||||
* Returns whether to throw an exception on incorrect parameters.
|
||||
* Null means the requirements check is deactivated completely.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function isStrictRequirements();
|
||||
}
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator;
|
||||
|
||||
/**
|
||||
* ConfigurableRequirementsInterface must be implemented by URL generators that
|
||||
* can be configured whether an exception should be generated when the parameters
|
||||
* do not match the requirements. It is also possible to disable the requirements
|
||||
* check for URL generation completely.
|
||||
*
|
||||
* The possible configurations and use-cases:
|
||||
* - setStrictRequirements(true): Throw an exception for mismatching requirements. This
|
||||
* is mostly useful in development environment.
|
||||
* - setStrictRequirements(false): Don't throw an exception but return an empty string as URL for
|
||||
* mismatching requirements and log the problem. Useful when you cannot control all
|
||||
* params because they come from third party libs but don't want to have a 404 in
|
||||
* production environment. It should log the mismatch so one can review it.
|
||||
* - setStrictRequirements(null): Return the URL with the given parameters without
|
||||
* checking the requirements at all. When generating a URL you should either trust
|
||||
* your params or you validated them beforehand because otherwise it would break your
|
||||
* link anyway. So in production environment you should know that params always pass
|
||||
* the requirements. Thus this option allows to disable the check on URL generation for
|
||||
* performance reasons (saving a preg_match for each requirement every time a URL is
|
||||
* generated).
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
interface ConfigurableRequirementsInterface
|
||||
{
|
||||
/**
|
||||
* Enables or disables the exception on incorrect parameters.
|
||||
* Passing null will deactivate the requirements check completely.
|
||||
*/
|
||||
public function setStrictRequirements(?bool $enabled);
|
||||
|
||||
/**
|
||||
* Returns whether to throw an exception on incorrect parameters.
|
||||
* Null means the requirements check is deactivated completely.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function isStrictRequirements();
|
||||
}
|
||||
|
|
|
@ -1,82 +1,82 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator;
|
||||
|
||||
use Symfony\Component\Routing\Exception\InvalidParameterException;
|
||||
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
use Symfony\Component\Routing\RequestContextAwareInterface;
|
||||
|
||||
/**
|
||||
* UrlGeneratorInterface is the interface that all URL generator classes must implement.
|
||||
*
|
||||
* The constants in this interface define the different types of resource references that
|
||||
* are declared in RFC 3986: http://tools.ietf.org/html/rfc3986
|
||||
* We are using the term "URL" instead of "URI" as this is more common in web applications
|
||||
* and we do not need to distinguish them as the difference is mostly semantical and
|
||||
* less technical. Generating URIs, i.e. representation-independent resource identifiers,
|
||||
* is also possible.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
interface UrlGeneratorInterface extends RequestContextAwareInterface
|
||||
{
|
||||
/**
|
||||
* Generates an absolute URL, e.g. "http://example.com/dir/file".
|
||||
*/
|
||||
public const ABSOLUTE_URL = 0;
|
||||
|
||||
/**
|
||||
* Generates an absolute path, e.g. "/dir/file".
|
||||
*/
|
||||
public const ABSOLUTE_PATH = 1;
|
||||
|
||||
/**
|
||||
* Generates a relative path based on the current request path, e.g. "../parent-file".
|
||||
*
|
||||
* @see UrlGenerator::getRelativePath()
|
||||
*/
|
||||
public const RELATIVE_PATH = 2;
|
||||
|
||||
/**
|
||||
* Generates a network path, e.g. "//example.com/dir/file".
|
||||
* Such reference reuses the current scheme but specifies the host.
|
||||
*/
|
||||
public const NETWORK_PATH = 3;
|
||||
|
||||
/**
|
||||
* Generates a URL or path for a specific route based on the given parameters.
|
||||
*
|
||||
* Parameters that reference placeholders in the route pattern will substitute them in the
|
||||
* path or host. Extra params are added as query string to the URL.
|
||||
*
|
||||
* When the passed reference type cannot be generated for the route because it requires a different
|
||||
* host or scheme than the current one, the method will return a more comprehensive reference
|
||||
* that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH
|
||||
* but the route requires the https scheme whereas the current scheme is http, it will instead return an
|
||||
* ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches
|
||||
* the route in any case.
|
||||
*
|
||||
* If there is no route with the given name, the generator must throw the RouteNotFoundException.
|
||||
*
|
||||
* The special parameter _fragment will be used as the document fragment suffixed to the final URL.
|
||||
*
|
||||
* @return string The generated URL
|
||||
*
|
||||
* @throws RouteNotFoundException If the named route doesn't exist
|
||||
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
|
||||
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
|
||||
* it does not match the requirement
|
||||
*/
|
||||
public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH);
|
||||
}
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator;
|
||||
|
||||
use Symfony\Component\Routing\Exception\InvalidParameterException;
|
||||
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
use Symfony\Component\Routing\RequestContextAwareInterface;
|
||||
|
||||
/**
|
||||
* UrlGeneratorInterface is the interface that all URL generator classes must implement.
|
||||
*
|
||||
* The constants in this interface define the different types of resource references that
|
||||
* are declared in RFC 3986: http://tools.ietf.org/html/rfc3986
|
||||
* We are using the term "URL" instead of "URI" as this is more common in web applications
|
||||
* and we do not need to distinguish them as the difference is mostly semantical and
|
||||
* less technical. Generating URIs, i.e. representation-independent resource identifiers,
|
||||
* is also possible.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
interface UrlGeneratorInterface extends RequestContextAwareInterface
|
||||
{
|
||||
/**
|
||||
* Generates an absolute URL, e.g. "http://example.com/dir/file".
|
||||
*/
|
||||
public const ABSOLUTE_URL = 0;
|
||||
|
||||
/**
|
||||
* Generates an absolute path, e.g. "/dir/file".
|
||||
*/
|
||||
public const ABSOLUTE_PATH = 1;
|
||||
|
||||
/**
|
||||
* Generates a relative path based on the current request path, e.g. "../parent-file".
|
||||
*
|
||||
* @see UrlGenerator::getRelativePath()
|
||||
*/
|
||||
public const RELATIVE_PATH = 2;
|
||||
|
||||
/**
|
||||
* Generates a network path, e.g. "//example.com/dir/file".
|
||||
* Such reference reuses the current scheme but specifies the host.
|
||||
*/
|
||||
public const NETWORK_PATH = 3;
|
||||
|
||||
/**
|
||||
* Generates a URL or path for a specific route based on the given parameters.
|
||||
*
|
||||
* Parameters that reference placeholders in the route pattern will substitute them in the
|
||||
* path or host. Extra params are added as query string to the URL.
|
||||
*
|
||||
* When the passed reference type cannot be generated for the route because it requires a different
|
||||
* host or scheme than the current one, the method will return a more comprehensive reference
|
||||
* that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH
|
||||
* but the route requires the https scheme whereas the current scheme is http, it will instead return an
|
||||
* ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches
|
||||
* the route in any case.
|
||||
*
|
||||
* If there is no route with the given name, the generator must throw the RouteNotFoundException.
|
||||
*
|
||||
* The special parameter _fragment will be used as the document fragment suffixed to the final URL.
|
||||
*
|
||||
* @return string The generated URL
|
||||
*
|
||||
* @throws RouteNotFoundException If the named route doesn't exist
|
||||
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
|
||||
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
|
||||
* it does not match the requirement
|
||||
*/
|
||||
public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue