prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
buted with this source code.
*/
namespace Symfony\Component\Scheduler\DependencyInjection;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Messenger\RunCommandMessage;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInter... | CallMessage;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
/**
* @internal
*/
class AddScheduleMessengerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
| tion;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Messenger\Message\RedispatchMessage;
use Symfony\Component\Messenger\Transport\TransportInterface;
use Symfony\Component\Scheduler\Messenger\Service | {
"filepath": "src/Symfony/Component/Scheduler/DependencyInjection/AddScheduleMessengerPass.php",
"language": "php",
"file_size": 7046,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Matcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\ExceptionInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* TraceableUrlMatcher helps debug path info ... | info);
} catch (ExceptionInterface) {
}
return $this->traces;
}
public function getTracesForRequest(Request $request): array
{
$this->request = $request;
$traces = $this->getTraces($request->getPathInfo | t ROUTE_ALMOST_MATCHES = 1;
public const ROUTE_MATCHES = 2;
protected array $traces;
public function getTraces(string $pathinfo): array
{
$this->traces = [];
try {
$this->match($path | {
"filepath": "src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php",
"language": "php",
"file_size": 6979,
"cut_index": 716,
"middle_length": 229
} |
n 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;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Matcher\UrlMatcherInt... | ce RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface
{
/**
* Gets the RouteCollection instance associated with this Router.
*
* WARNING: This method should never be used at runtime as it is SLOW.
* You migh | or Fabien Potencier <fabien@symfony.com>
*/
interfa | {
"filepath": "src/Symfony/Component/Routing/RouterInterface.php",
"language": "php",
"file_size": 994,
"cut_index": 582,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Generator\Dumper;
use Symfony\Component\Routing\Exception\RouteCircularReferenceException;
use Symfony\Component\Routing\Exception\RouteNotFoundExc... |
{
$compiledRoutes = [];
foreach ($this->getRoutes()->all() as $name => $route) {
$compiledRoute = $route->compile();
$compiledRoutes[$name] = [
$compiledRoute->getVariables(),
$r | Potencier <fabien@symfony.com>
* @author Tobias Schultze <http://tobion.de>
* @author Nicolas Grekas <p@tchwork.com>
*/
class CompiledUrlGeneratorDumper extends GeneratorDumper
{
public function getCompiledRoutes(): array | {
"filepath": "src/Symfony/Component/Routing/Generator/Dumper/CompiledUrlGeneratorDumper.php",
"language": "php",
"file_size": 4267,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (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\Loader;
use Symfony\Component\Config\Resource\GlobResource;
use Symfony\Component\Routing\RouteC... | lic function load(mixed $path, ?string $type = null): ?RouteCollection
{
if (!is_dir($dir = $this->locator->locate($path))) {
return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection();
}
| e Daubois <alex.daubois@gmail.com>
*/
class AttributeDirectoryLoader extends AttributeFileLoader
{
/**
* @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed
*/
pub | {
"filepath": "src/Symfony/Component/Routing/Loader/AttributeDirectoryLoader.php",
"language": "php",
"file_size": 2630,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Config\FileLocatorInterface;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\Resource\Re... | cted AttributeClassLoader $loader,
) {
if (!\function_exists('token_get_all')) {
throw new \LogicException('The Tokenizer extension is required for the routing attribute loader.');
}
parent::__construct($locator);
| Fabien Potencier <fabien@symfony.com>
* @author Alexandre Daubois <alex.daubois@gmail.com>
*/
class AttributeFileLoader extends FileLoader
{
public function __construct(
FileLocatorInterface $locator,
prote | {
"filepath": "src/Symfony/Component/Routing/Loader/AttributeFileLoader.php",
"language": "php",
"file_size": 4345,
"cut_index": 614,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Loader;
use Psr\Container\ContainerInterface;
/**
* A route loader that executes a service from a PSR-11 container to load the routes.
*... | env);
}
public function supports(mixed $resource, ?string $type = null): bool
{
return 'service' === $type && \is_string($resource);
}
protected function getObject(string $id): object
{
return $this->container->get | g $env = null,
) {
parent::__construct($ | {
"filepath": "src/Symfony/Component/Routing/Loader/ContainerLoader.php",
"language": "php",
"file_size": 929,
"cut_index": 606,
"middle_length": 52
} |
ocalizedRouteTrait;
use Symfony\Component\Routing\Loader\Configurator\Traits\PrefixTrait;
use Symfony\Component\Routing\RouteCollection;
/**
* @internal
*/
trait ContentLoaderTrait
{
use HostTrait;
use LocalizedRouteTrait;
use PrefixTrait;
/**
* Config keys accepted at the route or import level... | ng each entry to {@see parseRoute()} or {@see parseImport()}.
*/
private function loadContent(RouteCollection $collection, array $config, string $path, string $file): void
{
foreach ($config as $name => $config) {
if (!str_ | n', 'controller', 'name_prefix', 'trailing_slash_on_root', 'locale', 'format', 'utf8', 'exclude', 'stateless',
];
/**
* Processes a parsed configuration array, handling `when@<env>` filtering
* before dispatchi | {
"filepath": "src/Symfony/Component/Routing/Loader/ContentLoaderTrait.php",
"language": "php",
"file_size": 10372,
"cut_index": 921,
"middle_length": 229
} |
<?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\Loader;
use Symfony\Component\Config\Loader\F... | $collection->addCollection($this->import($path));
}
$collection->addResource($globResource);
return $collection;
}
public function supports(mixed $resource, ?string $type = null): bool
{
return 'glob' === $t | FileLoader
{
public function load(mixed $resource, ?string $type = null): mixed
{
$collection = new RouteCollection();
foreach ($this->glob($resource, false, $globResource) as $path => $info) {
| {
"filepath": "src/Symfony/Component/Routing/Loader/GlobFileLoader.php",
"language": "php",
"file_size": 1010,
"cut_index": 512,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Config\FileLocatorInterface;
use Symfony\Component\Config\Loader\DirectoryAwareLoaderInterface;
use Symfony\Component... | {
private ?string $currentDirectory = null;
public function __construct(
private readonly FileLocatorInterface $locator,
) {
// PSR-4 directory loader has no env-aware logic, so we drop the $env constructor parameter.
p |
/**
* A loader that discovers controller classes in a directory that follows PSR-4.
*
* @author Alexander M. Turek <me@derrabus.de>
*/
final class Psr4DirectoryLoader extends Loader implements DirectoryAwareLoaderInterface
| {
"filepath": "src/Symfony/Component/Routing/Loader/Psr4DirectoryLoader.php",
"language": "php",
"file_size": 3876,
"cut_index": 614,
"middle_length": 229
} |
/*
* 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\Loader\Configurator;
use Symfony\Component\Dependen... | version of the package that introduced the deprecation
* @param string $message The deprecation message to use
*
* @return $this
*
* @throws InvalidArgumentException when the message template is invalid
*/
public function | /**
* Whether this alias is deprecated, that means it should not be called anymore.
*
* @param string $package The name of the composer package that is triggering the deprecation
* @param string $version The | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/AliasConfigurator.php",
"language": "php",
"file_size": 1177,
"cut_index": 518,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Loader\Configurator;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* @author Nicolas Grekas <p@tchwork.... | ray $parentPrefixes = null,
) {
$this->name = $name;
$this->collection = new RouteCollection();
$this->route = new Route('');
}
public function __serialize(): array
{
throw new \BadMethodCallException('Canno | private bool $trailingSlashOnRoot = true;
public function __construct(
private RouteCollection $parent,
string $name,
private ?self $parentConfigurator = null, // for GC control
private ?ar | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php",
"language": "php",
"file_size": 4005,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (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\Loader\Configurator;
// For the phpdoc to remain compatible with the generation of per-app Route... | > [
* 'resource' => 'routing.controllers',
* ],
* ]);
* ```
*
* @psalm-type RouteConfig = array{
* path: string|array<string,string>,
* controller?: string,
* methods?: string|list<string>,
* requiremen | or configuring the routes of an application.
*
* Example:
*
* ```php
* // config/routes.php
* namespace Symfony\Component\Routing\Loader\Configurator;
*
* return Routes::config([
* 'controllers' = | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/RoutesReference.php",
"language": "php",
"file_size": 2472,
"cut_index": 563,
"middle_length": 229
} |
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\Loader\Configurator\Traits;
use Symfony\Component\Routing\Loader\Confi... | = null;
/**
* Adds a route.
*
* @param string|array $path the path, or the localized paths of the route
*/
public function add(string $name, string|array $path): RouteConfigurator
{
$parentConfigurator = $this inst | Routing\RouteCollection;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
trait AddTrait
{
use LocalizedRouteTrait;
protected RouteCollection $collection;
protected string $name = '';
protected ?array $prefixes | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php",
"language": "php",
"file_size": 1797,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (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\Loader\Configurator\Traits;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\R... | es = [];
foreach ($routes->getAliases() as $name => $alias) {
$aliases[$alias->getId()][] = $name;
}
foreach ($routes->all() as $name => $route) {
if (null === $locale = $route->getDefault | l $trailingSlashOnRoot): void
{
if (\is_array($prefix)) {
foreach ($prefix as $locale => $localePrefix) {
$prefix[$locale] = trim(trim($localePrefix), '/');
}
$alias | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/Traits/PrefixTrait.php",
"language": "php",
"file_size": 3019,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (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\Loader\Configurator\Traits;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\R... | fix = '', ?array $prefixes = null): RouteCollection
{
$paths = [];
$routes = new RouteCollection();
if (\is_array($path)) {
if (null === $prefixes) {
$paths = $path;
} elseif ($missing = | outes.
*
* @param string|array $path the path, or the localized paths of the route
*/
final protected function createLocalizedRoute(RouteCollection $collection, string $name, string|array $path, string $namePre | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/Traits/LocalizedRouteTrait.php",
"language": "php",
"file_size": 2549,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RequestContext;
class RequestContextTest extends TestCase
{
public function testConstr... | od());
$this->assertEquals('foo.bar', $requestContext->getHost());
$this->assertEquals('https', $requestContext->getScheme());
$this->assertSame(8080, $requestContext->getHttpPort());
$this->assertSame(444, $requestContext-> | z',
'bar=foobar',
[
'foo' => 'bar',
]
);
$this->assertEquals('foo', $requestContext->getBaseUrl());
$this->assertEquals('POST', $requestContext->getMeth | {
"filepath": "src/Symfony/Component/Routing/Tests/RequestContextTest.php",
"language": "php",
"file_size": 8728,
"cut_index": 716,
"middle_length": 229
} |
\Component\Routing\RouteCompiler;
class RouteCompilerTest extends TestCase
{
#[DataProvider('provideCompileData')]
public function testCompile($name, $arguments, $prefix, $regex, $variables, $tokens)
{
$r = new \ReflectionClass(Route::class);
$route = $r->newInstanceArgs($arguments);
... | pileData()
{
return [
[
'Static route',
['/foo'],
'/foo', '{^/foo$}sD', [], [
['text', '/foo'],
],
],
[
'Ro | .' (regex)');
$this->assertEquals($variables, $compiled->getVariables(), $name.' (variables)');
$this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)');
}
public static function provideCom | {
"filepath": "src/Symfony/Component/Routing/Tests/RouteCompilerTest.php",
"language": "php",
"file_size": 14672,
"cut_index": 921,
"middle_length": 229
} |
*
* 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\MissingMandatoryParametersExc... | 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.
*
* @ | 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 | {
"filepath": "src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php",
"language": "php",
"file_size": 3468,
"cut_index": 614,
"middle_length": 229
} |
Component\Config\Resource\ReflectionClassResource;
use Symfony\Component\Routing\Attribute\DeprecatedAlias;
use Symfony\Component\Routing\Attribute\Route as RouteAttribute;
use Symfony\Component\Routing\Exception\InvalidArgumentException;
use Symfony\Component\Routing\Exception\LogicException;
use Symfony\Component\Rou... | rs),
* and on each method.
*
* The #[Route] attribute main value is the route path. The attribute also
* recognizes several parameters: requirements, options, defaults, schemes,
* methods, host, and name. The name parameter is mandatory.
* Here is an | or the configureRoute() method. Most of the
* time, this method should define some PHP callable to be called for the route
* (a controller in MVC speak).
*
* The #[Route] attribute can be set on the class (for global paramete | {
"filepath": "src/Symfony/Component/Routing/Loader/AttributeClassLoader.php",
"language": "php",
"file_size": 14495,
"cut_index": 921,
"middle_length": 229
} |
/*
* 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\Loader;
use Symfony\Component\Config\Loader\Loader;... | (mixed $resource, ?string $type = null): RouteCollection
{
$collection = new RouteCollection();
foreach ($this->taggedClasses as $class) {
$collection->addCollection($this->import($class, 'attribute'));
}
r |
final class AttributeServicesLoader extends Loader
{
/**
* @param class-string[] $taggedClasses
*/
public function __construct(
private array $taggedClasses = [],
) {
}
public function load | {
"filepath": "src/Symfony/Component/Routing/Loader/AttributeServicesLoader.php",
"language": "php",
"file_size": 1169,
"cut_index": 518,
"middle_length": 229
} |
ge.
*
* (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\Loader;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Config\Resource\FileRe... | d.
*/
abstract protected function getObject(string $id): object;
/**
* Calls the object method that will load the routes.
*/
public function load(mixed $resource, ?string $type = null): RouteCollection
{
if (!preg_ma | ct class ObjectLoader extends Loader
{
/**
* Returns the object that the method will be called on to load routes.
*
* For example, if your application uses a service container,
* the $id may be a service i | {
"filepath": "src/Symfony/Component/Routing/Loader/ObjectLoader.php",
"language": "php",
"file_size": 2663,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\RouteColl... | as doParseRoute;
validate as doValidate;
}
private YamlParser $yamlParser;
/**
* @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid
*/
public function load(mixed $file, ?string $type | *
* @author Fabien Potencier <fabien@symfony.com>
* @author Tobias Schultze <http://tobion.de>
*/
class YamlFileLoader extends FileLoader
{
use ContentLoaderTrait {
parseImport as doParseImport;
parseRoute | {
"filepath": "src/Symfony/Component/Routing/Loader/YamlFileLoader.php",
"language": "php",
"file_size": 3439,
"cut_index": 614,
"middle_length": 229
} |
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\Loader\Configurator;
use Symfony\Component\Routing\RouteC... | ) {
$this->collection = $collection;
$this->route = $route;
$this->name = $name;
$this->prefixes = $prefixes;
}
/**
* Sets the host to use for all child routes.
*
* @param string|array $host the host, | struct(
RouteCollection $collection,
RouteCollection $route,
string $name = '',
protected ?CollectionConfigurator $parentConfigurator = null, // for GC control
?array $prefixes = null,
| {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php",
"language": "php",
"file_size": 1486,
"cut_index": 524,
"middle_length": 229
} |
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\Loader\Configurator\Traits;
use Symfony\Component\Routing\RouteCollect... | etPriority($name) ?? 0;
$routes->remove($name);
foreach ($hosts as $locale => $host) {
$localizedRoute = clone $route;
$localizedRoute->setDefault('_locale', $locale);
| $routes->setHost($hosts ?: '');
return;
}
foreach ($routes->all() as $name => $route) {
if (null === $locale = $route->getDefault('_locale')) {
$priority = $routes->g | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/Traits/HostTrait.php",
"language": "php",
"file_size": 1790,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (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\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfon... | s->assertEquals('prefix', $compiled->getStaticPrefix(), '__construct() takes a static prefix as its second argument');
$this->assertEquals('regex', $compiled->getRegex(), '__construct() takes a regexp as its third argument');
$this->assertE |
return '';
}
}
class CompiledRouteTest extends TestCase
{
public function testAccessors()
{
$compiled = new CompiledRoute('prefix', 'regex', ['tokens'], [], null, [], [], ['variables']);
$thi | {
"filepath": "src/Symfony/Component/Routing/Tests/CompiledRouteTest.php",
"language": "php",
"file_size": 2575,
"cut_index": 563,
"middle_length": 229
} |
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\Dumper;
use Symfony\Component\Routing\RouteCollection;
/*... | sentation of executable code
* that can then be used to generate a URL of such a route.
*/
public function dump(array $options = []): string;
/**
* Gets the routes to dump.
*/
public function getRoutes(): RouteCollection;
} | /**
* Dumps a set of routes to a string repre | {
"filepath": "src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php",
"language": "php",
"file_size": 844,
"cut_index": 535,
"middle_length": 52
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Routing\RouteCollection;
/**
* ClosureLoader loads routes from ... | e, ?string $type = null): RouteCollection
{
return $closure($this->env);
}
public function supports(mixed $resource, ?string $type = null): bool
{
return $resource instanceof \Closure && (!$type || 'closure' === $type);
| sure.
*/
public function load(mixed $closur | {
"filepath": "src/Symfony/Component/Routing/Loader/ClosureLoader.php",
"language": "php",
"file_size": 919,
"cut_index": 606,
"middle_length": 52
} |
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\Loader;
use Symfony\Component\Config\Loader\FileLoader;
u... | if ('.' !== $dir[0]) {
$this->setCurrentDir($path);
$subPath = $path.'/'.$dir;
$subType = null;
if (is_dir($subPath)) {
$subPath .= '/';
$s | $type = null): mixed
{
$path = $this->locator->locate($file);
$collection = new RouteCollection();
$collection->addResource(new DirectoryResource($path));
foreach (scandir($path) as $dir) {
| {
"filepath": "src/Symfony/Component/Routing/Loader/DirectoryLoader.php",
"language": "php",
"file_size": 1466,
"cut_index": 524,
"middle_length": 229
} |
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\Loader\Configurator;
use Symfony\Component\Routing\RouteCollection;
/... | CLASS__);
}
public function __unserialize(array $data): void
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
$this->parent->addCollection($this->route);
}
| private RouteCollection $parent,
RouteCollection $route,
) {
$this->route = $route;
}
public function __serialize(): array
{
throw new \BadMethodCallException('Cannot serialize '.__ | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/ImportConfigurator.php",
"language": "php",
"file_size": 1980,
"cut_index": 537,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Loader\Configurator\Traits;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
trait RouteTrait
{
protected R... | requirements);
return $this;
}
/**
* Adds options.
*
* @return $this
*/
final public function options(array $options): static
{
$this->route->addOptions($options);
return $this;
}
/**
| lts($defaults);
return $this;
}
/**
* Adds requirements.
*
* @return $this
*/
final public function requirements(array $requirements): static
{
$this->route->addRequirements($ | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php",
"language": "php",
"file_size": 3580,
"cut_index": 614,
"middle_length": 229
} |
n new class {
public function __invoke(RoutingConfigurator $routes)
{
$routes
->collection()
->add('foo', '/foo')
->condition('abc')
->options(['utf8' => true])
->add('buz', 'zub')
->controller('foo:act')
->stateless(tru... | $routes->import('php_dsl_sub.php')
->namePrefix('z_')
->prefix('/zub');
$routes->import('php_dsl_sub_root.php')
->prefix('/bus', false);
$routes->add('ouf', '/ouf')
->schemes(['https'] | b')
->requirements(['id' => '\d+']);
| {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/php_object_dsl.php",
"language": "php",
"file_size": 969,
"cut_index": 582,
"middle_length": 52
} |
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\Tests\Matcher;
use Symfony\Component\Routing\Matcher\CompiledUrlMatche... | k = false)
{
$dumper = new CompiledUrlMatcherDumper($routes);
$compiledRoutes = $dumper->getCompiledRoutes();
if (!$mock) {
return new TestCompiledRedirectableUrlMatcher($compiledRoutes, $context ?? new RequestConte | se Symfony\Component\Routing\RouteCollection;
class CompiledRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest
{
protected function getUrlMatcher(RouteCollection $routes, ?RequestContext $context = null, bool $moc | {
"filepath": "src/Symfony/Component/Routing/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php",
"language": "php",
"file_size": 1515,
"cut_index": 537,
"middle_length": 229
} |
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\Tests\Matcher;
use Symfony\Component\Routing\Matcher\CompiledUrlMatche... | $collection->add('static_host_route', new Route('/test', [], [], [], 'API.example.com'));
$context = new RequestContext('/test', 'GET', 'api.example.com');
$matcher = new UrlMatcher($collection, $context);
$result = $matcher->mat | Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class CompiledUrlMatcherTest extends UrlMatcherTest
{
public function testStaticHostIsCaseInsensitive()
{
$collection = new RouteCollection();
| {
"filepath": "src/Symfony/Component/Routing/Tests/Matcher/CompiledUrlMatcherTest.php",
"language": "php",
"file_size": 1806,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (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\Tests\Matcher;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
us... | $functionProvider = new ServiceLocator([
'env' => static fn () => static fn (string $arg) => [
'APP_ENV' => 'test',
'PHP_VERSION' => '7.2',
][$arg] ?? null,
'sum' => static fn () => | ny\Component\Routing\RequestContext;
class ExpressionLanguageProviderTest extends TestCase
{
private RequestContext $context;
private ExpressionLanguage $expressionLanguage;
protected function setUp(): void
{
| {
"filepath": "src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageProviderTest.php",
"language": "php",
"file_size": 2552,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Tests\Matcher;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\... | testExtraTrailingSlash()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo'));
$matcher = $this->getUrlMatcher($coll, null, true);
$matcher->expects($this->once())->method('redirect')->willReturn([]);
| dd('foo', new Route('/foo/'));
$matcher = $this->getUrlMatcher($coll, null, true);
$matcher->expects($this->once())->method('redirect')->willReturn([]);
$matcher->match('/foo');
}
public function | {
"filepath": "src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php",
"language": "php",
"file_size": 8399,
"cut_index": 716,
"middle_length": 229
} |
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\Tests\Fixtures\Psr4Controllers\SubNamespace\EvenDeeperNamespace... | public function firstAction(): Response
{
return new Response('', Response::HTTP_NO_CONTENT);
}
#[Route('/second', name: 'two')]
public function secondAction(): Response
{
return new Response('', Response::HTTP_NO_CON | rController
{
#[Route('/first', name: 'one')]
| {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/Psr4Controllers/SubNamespace/EvenDeeperNamespace/MyOtherController.php",
"language": "php",
"file_size": 852,
"cut_index": 529,
"middle_length": 52
} |
pace Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Routing\Tests\Fixtures\AttributedClasses\BarClass;
use Symfony\Component\Routing\Tests\Fixtures\Enum\TestIntBackedEnum;
use Symfony\Component\Routing\Tests\Fixtures\Enum\TestStringBacke... | e: 'string_enum_action')]
public function stringEnumAction(TestStringBackedEnum $default = TestStringBackedEnum::Diamonds)
{
}
#[Route(path: '/enum/{default<\d+>}', name: 'int_enum_action')]
public function intEnumAction(TestIntBackedE | e<\w+>}', name: 'hello_without_default'),
Route(path: 'hello/{name<\w+>?Symfony}', name: 'hello_with_default'),
]
public function hello(string $name = 'World')
{
}
#[Route(path: '/enum/{default}', nam | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/DefaultValueController.php",
"language": "php",
"file_size": 1436,
"cut_index": 524,
"middle_length": 229
} |
<?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\Tests\Fixtures\AttributeFixtures;
use Symfony... |
#[Route(path: '/redundant-method', name: 'redundant_method', methods: ['GET'])]
public function redundantMethod()
{
}
#[Route(path: '/redundant-scheme', name: 'redundant_scheme', schemes: ['https'])]
public function redundantSch | pecific-locale', name: 'specific_locale', locale: 's_locale')]
public function locale()
{
}
#[Route(path: '/specific-format', name: 'specific_format', format: 's_format')]
public function format()
{
} | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/GlobalDefaultsClass.php",
"language": "php",
"file_size": 1017,
"cut_index": 512,
"middle_length": 229
} |
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\Tests\Fixtures\AttributeFixtures;
use Symfony\Component\Routin... | _deprecated', 'MyFirstBundleFixture', '1.0'),
new DeprecatedAlias('my_second_alias_deprecated', 'MySecondBundleFixture', '2.0'),
new DeprecatedAlias('my_third_alias_deprecated', 'SurprisedThirdBundleFixture', '3.0'),
])]
public func | alias: [
new DeprecatedAlias('my_first_alias | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/MultipleDeprecatedAliasRouteController.php",
"language": "php",
"file_size": 865,
"cut_index": 529,
"middle_length": 52
} |
[^/]++)/efe937(*:3171)'
.'|575e/([^/]++)/([^/]++)/([^/]++)/ef575e(*:3218)'
.')'
.'|7b24b/([^/]++)/([^/]++)/([^/]++)/e7b24b(*:3267)'
.'|836d8/([^/]++)/([^/]++)/([^/]++)/e836d8(*:3315)'
.')'
.'|/a(?'
... |
.'|a(?'
.'|b323/([^/]++)/([^/]++)/([^/]++)/aab323(*:3612)'
.'|942a/([^/]++)/([^/]++)/([^/]++)/aa942a(*:3659)'
.')'
.'|5(?'
| .'|f15e/([^/]++)/([^/]++)/([^/]++)/a8f15e(*:3466)'
.'|c88a/([^/]++)/([^/]++)/([^/]++)/a8c88a(*:3513)'
.'|abb4/([^/]++)/([^/]++)/([^/]++)/a8abb4(*:3560)'
.')' | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher10.php",
"language": "php",
"file_size": 187630,
"cut_index": 7068,
"middle_length": 229
} |
null, false, false, null]],
'/test/baz.html' => [[['_route' => 'baz2'], null, null, null, false, false, null]],
'/test/baz3' => [[['_route' => 'baz3'], null, null, null, true, false, null]],
'/foofoo' => [[['_route' => 'foofoo', 'def' => 'test'], null, null, null, false, false, null]],
'... | lse, false, null]],
'/c2/route2' => [[['_route' => 'route2'], 'a.example.com', null, null, false, false, null]],
'/route4' => [[['_route' => 'route4'], 'a.example.com', null, null, false, false, null]],
'/c2/route3' => [[['_route' = | => [[['_route' => 'hey'], null, null, null, true, false, null]],
'/ababa' => [[['_route' => 'ababa'], null, null, null, false, false, null]],
'/route1' => [[['_route' => 'route1'], 'a.example.com', null, null, fa | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher2.php",
"language": "php",
"file_size": 5826,
"cut_index": 716,
"middle_length": 229
} |
ing Component.
*/
return [
false, // $matchHost
[ // $staticRoutes
'/just_head' => [[['_route' => 'just_head'], null, ['HEAD' => 0], null, false, false, null]],
'/head_and_get' => [[['_route' => 'head_and_get'], null, ['HEAD' => 0, 'GET' => 1], null, false, false, null]],
'/get_and_hea... | ' => [
[['_route' => 'put_and_post'], null, ['PUT' => 0, 'POST' => 1], null, false, false, null],
[['_route' => 'put_and_get_and_head'], null, ['PUT' => 0, 'GET' => 1, 'HEAD' => 2], null, false, false, null],
],
],
[ | , null, false, false, null]],
'/put_and_post | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher4.php",
"language": "php",
"file_size": 976,
"cut_index": 582,
"middle_length": 52
} |
by the Symfony Routing Component.
*/
return [
false, // $matchHost
[ // $staticRoutes
'/trailing/simple/no-methods' => [[['_route' => 'simple_trailing_slash_no_methods'], null, null, null, true, false, null]],
'/trailing/simple/get-method' => [[['_route' => 'simple_trailing_slash_GET_method'],... | no_methods'], null, null, null, false, false, null]],
'/not-trailing/simple/get-method' => [[['_route' => 'simple_not_trailing_slash_GET_method'], null, ['GET' => 0], null, false, false, null]],
'/not-trailing/simple/head-method' => [[['_ro | '/trailing/simple/post-method' => [[['_route' => 'simple_trailing_slash_POST_method'], null, ['POST' => 0], null, true, false, null]],
'/not-trailing/simple/no-methods' => [[['_route' => 'simple_not_trailing_slash_ | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher6.php",
"language": "php",
"file_size": 3017,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (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\Loader\Configurator;
use Symfony\Component\Routing\Loader\PhpFileLoader;
use Symfony\Component\R... | tring[]|null $exclude Glob patterns to exclude from the import
*/
final public function import(string|array $resource, ?string $type = null, bool $ignoreErrors = false, string|array|null $exclude = null): ImportConfigurator
{
$this->lo | ction,
private PhpFileLoader $loader,
private string $path,
private string $file,
private ?string $env = null,
) {
$this->collection = $collection;
}
/**
* @param string|s | {
"filepath": "src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php",
"language": "php",
"file_size": 2086,
"cut_index": 563,
"middle_length": 229
} |
ctor()
{
$route = new Route('/{foo}', ['foo' => 'bar'], ['foo' => '\d+'], ['foo' => 'bar'], '{locale}.example.com');
$this->assertEquals('/{foo}', $route->getPath(), '__construct() takes a path as its first argument');
$this->assertEquals(['foo' => 'bar'], $route->getDefaults(), '__construct... | );
$route = new Route('/', [], [], [], '', ['Https'], ['POST', 'put'], 'context.getMethod() == "GET"');
$this->assertEquals(['https'], $route->getSchemes(), '__construct() takes schemes as its sixth argument and lowercases it');
$t | ssertEquals('bar', $route->getOption('foo'), '__construct() takes options as its fourth argument');
$this->assertEquals('{locale}.example.com', $route->getHost(), '__construct() takes a host pattern as its fifth argument' | {
"filepath": "src/Symfony/Component/Routing/Tests/RouteTest.php",
"language": "php",
"file_size": 20756,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Generator\CompiledUrlGenerator;
use Symfony\Component\Routing\Generator\UrlGenera... | (): void
{
$this->cacheDir = tempnam(sys_get_temp_dir(), 'sf_router_');
unlink($this->cacheDir);
mkdir($this->cacheDir);
}
protected function tearDown(): void
{
if (is_dir($this->cacheDir)) {
arr | \Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Router;
class RouterTest extends TestCase
{
private string $cacheDir;
protected function setUp | {
"filepath": "src/Symfony/Component/Routing/Tests/RouterTest.php",
"language": "php",
"file_size": 7513,
"cut_index": 716,
"middle_length": 229
} |
?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\Tests\Fixtures;
use Symfony\Component\Routing\... | printf('Expected string, got "%s"', get_debug_type($class)));
}
$this->foundClasses[] = $class;
return parent::load($class, $type);
}
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMet | ** @var list<string> */
public array $foundClasses = [];
public function load(mixed $class, ?string $type = null): RouteCollection
{
if (!is_string($class)) {
throw new \InvalidArgumentException(s | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/TraceableAttributeClassLoader.php",
"language": "php",
"file_size": 1045,
"cut_index": 513,
"middle_length": 229
} |
source;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
return function (string $format) {
$expectedRoutes = new RouteCollection();
$expectedRoutes->add('imported.en', $route = new Route('/example'));
$route->setHost('www.example.com');
$route->setRequirement('_local... | ', 'imported');
$route->setDefault('_controller', 'ImportedController::someAction');
$expectedRoutes->add('imported_not_localized.en', $route = new Route('/here'));
$route->setHost('www.example.com');
$route->setRequirement('_locale', 'en') | edRoutes->add('imported.nl', $route = new Route('/voorbeeld'));
$route->setHost('www.example.nl');
$route->setRequirement('_locale', 'nl');
$route->setDefault('_locale', 'nl');
$route->setDefault('_canonical_route | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/locale_and_host/import-with-host-expected-collection.php",
"language": "php",
"file_size": 2500,
"cut_index": 563,
"middle_length": 229
} |
\Resource\FileResource;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
return static function (string $format) {
$expectedRoutes = new RouteCollection();
$expectedRoutes->add('route', new Route('/hello'));
$expectedRoutes->addAlias('alias', 'route');
$expectedRoute... | dAlias('deep', 'alias');
$expectedRoutes->addAlias('overrided', 'route');
$expectedRoutes->addResource(new FileResource(__DIR__."/alias.$format"));
if ('yaml' === $format) {
$expectedRoutes->addResource(new FileResource(__DIR__."/overr | '1.0.0', 'foo %alias_id%.');
$expectedRoutes->ad | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/alias/expected.php",
"language": "php",
"file_size": 909,
"cut_index": 547,
"middle_length": 52
} |
null, false, false, null]],
'/test/baz.html' => [[['_route' => 'baz2'], null, null, null, false, false, null]],
'/test/baz3' => [[['_route' => 'baz3'], null, null, null, true, false, null]],
'/foofoo' => [[['_route' => 'foofoo', 'def' => 'test'], null, null, null, false, false, null]],
'... | lse, false, null]],
'/c2/route2' => [[['_route' => 'route2'], 'a.example.com', null, null, false, false, null]],
'/route4' => [[['_route' => 'route4'], 'a.example.com', null, null, false, false, null]],
'/c2/route3' => [[['_route' = | => [[['_route' => 'hey'], null, null, null, true, false, null]],
'/ababa' => [[['_route' => 'ababa'], null, null, null, false, false, null]],
'/route1' => [[['_route' => 'route1'], 'a.example.com', null, null, fa | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher1.php",
"language": "php",
"file_size": 5627,
"cut_index": 716,
"middle_length": 229
} |
* This file has been auto-generated
* by the Symfony Routing Component.
*/
return [
false, // $matchHost
[ // $staticRoutes
],
[ // $regexpList
0 => '{^(?'
.'|/abc([^/]++)/(?'
.'|1(?'
.'|(*:27)'
.'|0(?'
... | micRoutes
27 => [[['_route' => 'r1'], ['foo'], null, null, false, false, null]],
38 => [[['_route' => 'r10'], ['foo'], null, null, false, false, null]],
46 => [[['_route' => 'r100'], ['foo'], null, null, false, false, null]],
| .'|0(?'
.'|(*:70)'
.'|0(*:78)'
.')'
.')'
.')'
.')/?$}sD',
],
[ // $dyna | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher12.php",
"language": "php",
"file_size": 1360,
"cut_index": 524,
"middle_length": 229
} |
?php
/**
* This file has been auto-generated
* by the Symfony Routing Component.
*/
return [
false, // $matchHost
[ // $staticRoutes
'/rootprefix/test' => [[['_route' => 'static'], null, null, null, false, false, null]],
'/with-condition' => [[['_route' => 'with-condition'], null, null, nul... | [null, null, null, null, false, false, 0],
],
],
static function ($condition, $context, $request, $params) { // $checkCondition
switch ($condition) {
case -1: return ($context->getMethod() == "GET");
cas |
],
[ // $dynamicRoutes
27 => [[['_route' => 'dynamic'], ['var'], null, null, false, true, null]],
56 => [
[['_route' => 'with-condition-dynamic'], ['id'], null, null, false, true, -2],
| {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher3.php",
"language": "php",
"file_size": 1054,
"cut_index": 513,
"middle_length": 229
} |
eturns a route by name');
$this->assertNull($collection->get('bar'), '->get() returns null if a route does not exist');
}
public function testOverriddenRoute()
{
$collection = new RouteCollection();
$collection->add('foo', new Route('/foo'));
$collection->add('foo', new Rout... | o', new Route('/foo2'));
$collection1->addCollection($collection2);
$collection->addCollection($collection1);
$this->assertEquals('/foo2', $collection1->get('foo')->getPath());
$this->assertEquals('/foo2', $collection->get | $collection->add('foo', new Route('/foo'));
$collection1 = new RouteCollection();
$collection1->add('foo', new Route('/foo1'));
$collection2 = new RouteCollection();
$collection2->add('fo | {
"filepath": "src/Symfony/Component/Routing/Tests/RouteCollectionTest.php",
"language": "php",
"file_size": 17946,
"cut_index": 1331,
"middle_length": 229
} |
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\Tests\Attribute;
use PHPUnit\Framework\Attributes\DataProvider;
use PH... | ributes(Route::class)[0]->newInstance();
$this->assertEquals($route->$property, $expectedReturn);
}
public static function getValidParameters(): iterable
{
return [
['simplePath', 'path', '/Blog'],
['lo | [DataProvider('getValidParameters')]
public function testLoadFromAttribute(string $methodName, string $property, mixed $expectedReturn)
{
$route = (new \ReflectionMethod(FooController::class, $methodName))->getAtt | {
"filepath": "src/Symfony/Component/Routing/Tests/Attribute/RouteTest.php",
"language": "php",
"file_size": 1667,
"cut_index": 537,
"middle_length": 229
} |
* 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\Tests\Fixtures;
use Symfony\Component\Routing\Matcher\R... | tableUrlMatcherInterface
{
public function redirect(string $path, string $route, ?string $scheme = null): array
{
return [
'_controller' => 'Some controller reference...',
'path' => $path,
'scheme' => $sc | ements Redirec | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php",
"language": "php",
"file_size": 817,
"cut_index": 522,
"middle_length": 14
} |
ymfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
return function (string $format) {
$expectedRoutes = new RouteCollection();
$expectedRoutes->add('imported.en', $route = new Route('/example'));
$route->setHost('www.example.co... | $route->setDefault('_canonical_route', 'imported');
$route->setDefault('_controller', 'ImportedController::someAction');
$expectedRoutes->add('imported_not_localized', $route = new Route('/here'));
$route->setHost('www.example.com');
$r | edController::someAction');
$expectedRoutes->add('imported.nl', $route = new Route('/voorbeeld'));
$route->setHost('www.example.com');
$route->setRequirement('_locale', 'nl');
$route->setDefault('_locale', 'nl');
| {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/locale_and_host/import-with-single-host-expected-collection.php",
"language": "php",
"file_size": 1486,
"cut_index": 524,
"middle_length": 229
} |
onent\Config\Resource\FileResource;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
return function (string $format) {
$expectedRoutes = new RouteCollection();
$expectedRoutes->add('static.en', $route = new Route('/example'));
$route->setHost('www.example.com');
$rou... | $route->setRequirement('_locale', 'nl');
$route->setDefault('_locale', 'nl');
$route->setDefault('_canonical_route', 'static');
$expectedRoutes->addResource(new FileResource(__DIR__."/route-with-hosts.$format"));
return $expectedRoutes; | xample'));
$route->setHost('www.example.nl');
| {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/locale_and_host/route-with-hosts-expected-collection.php",
"language": "php",
"file_size": 847,
"cut_index": 535,
"middle_length": 52
} |
namespace Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures;
use Symfony\Component\Routing\Attribute\Route;
class FooController
{
#[Route('/Blog')]
public function simplePath()
{
}
#[Route(['nl' => '/hier', 'en' => '/here'])]
public function localized()
{
}
#[Route(requ... | schemes()
{
}
#[Route(methods: ['GET', 'POST'])]
public function methods()
{
}
#[Route(host: '{locale}.example.com')]
public function host()
{
}
#[Route(condition: 'context.getMethod() == \'GET\'')]
publi | te(name: 'blog_index')]
public function name()
{
}
#[Route(defaults: ['_controller' => 'MyBlogBundle:Blog:index'])]
public function defaults()
{
}
#[Route(schemes: ['https'])]
public function | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/FooController.php",
"language": "php",
"file_size": 1141,
"cut_index": 518,
"middle_length": 229
} |
by the Symfony Routing Component.
*/
return [
false, // $matchHost
[ // $staticRoutes
],
[ // $regexpList
0 => '{^(?'
.'|/(en|fr)/(?'
.'|admin/post(?'
.'|(*:32)'
.'|/(?'
.'|new(*:46)... | |age/([^/]++)(*:154)'
.'|osts/([^/]++)(*:175)'
.')'
.'|comments/(\\d+)/new(*:202)'
.'|search(*:216)'
.')'
| .')'
.'|blog(?'
.'|(*:110)'
.'|/(?'
.'|rss\\.xml(*:130)'
.'|p(?'
.' | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher11.php",
"language": "php",
"file_size": 2882,
"cut_index": 563,
"middle_length": 229
} |
by the Symfony Routing Component.
*/
return [
false, // $matchHost
[ // $staticRoutes
'/trailing/simple/no-methods' => [[['_route' => 'simple_trailing_slash_no_methods'], null, null, null, true, false, null]],
'/trailing/simple/get-method' => [[['_route' => 'simple_trailing_slash_GET_method'],... | no_methods'], null, null, null, false, false, null]],
'/not-trailing/simple/get-method' => [[['_route' => 'simple_not_trailing_slash_GET_method'], null, ['GET' => 0], null, false, false, null]],
'/not-trailing/simple/head-method' => [[['_ro | '/trailing/simple/post-method' => [[['_route' => 'simple_trailing_slash_POST_method'], null, ['POST' => 0], null, true, false, null]],
'/not-trailing/simple/no-methods' => [[['_route' => 'simple_not_trailing_slash_ | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher7.php",
"language": "php",
"file_size": 3017,
"cut_index": 563,
"middle_length": 229
} |
source;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
return function (string $format) {
$expectedRoutes = new RouteCollection();
$expectedRoutes->add('imported.en', $route = new Route('/en/example'));
$route->setHost('www.example.com');
$route->setRequirement('_lo... | _route', 'imported');
$route->setDefault('_controller', 'ImportedController::someAction');
$expectedRoutes->add('imported_not_localized.en', $route = new Route('/en/here'));
$route->setHost('www.example.com');
$route->setRequirement('_local | ectedRoutes->add('imported.nl', $route = new Route('/nl/voorbeeld'));
$route->setHost('www.example.nl');
$route->setRequirement('_locale', 'nl');
$route->setDefault('_locale', 'nl');
$route->setDefault('_canonical | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/locale_and_host/import-with-locale-and-host-expected-collection.php",
"language": "php",
"file_size": 2529,
"cut_index": 563,
"middle_length": 229
} |
as been auto-generated
* by the Symfony Routing Component.
*/
return [
false, // $matchHost
[ // $staticRoutes
'/a/11' => [[['_route' => 'a_first'], null, null, null, false, false, null]],
'/a/22' => [[['_route' => 'a_second'], null, null, null, false, false, null]],
'/a/333' => [[['_... | '/nested/group/b' => [[['_route' => 'nested_b'], null, null, null, true, false, null]],
'/nested/group/c' => [[['_route' => 'nested_c'], null, null, null, true, false, null]],
'/slashed/group' => [[['_route' => 'slashed_a'], null, null, nu | , null, null, null, true, false, null]],
'/a/66' => [[['_route' => 'a_sixth'], null, null, null, true, false, null]],
'/nested/group/a' => [[['_route' => 'nested_a'], null, null, null, true, false, null]],
| {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/dumper/compiled_url_matcher5.php",
"language": "php",
"file_size": 1723,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (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\Loader;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\Resource\Fi... | tance.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Nicolas grekas <p@tchwork.com>
* @author Jules Pietri <jules@heahprod.com>
*/
class PhpFileLoader extends FileLoader
{
use ContentLoaderTrait;
/**
* Loads a PHP file.
| Reference;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Symfony\Component\Routing\RouteCollection;
/**
* PhpFileLoader loads routes from a PHP file.
*
* The file must return a RouteCollection ins | {
"filepath": "src/Symfony/Component/Routing/Loader/PhpFileLoader.php",
"language": "php",
"file_size": 2983,
"cut_index": 563,
"middle_length": 229
} |
Symfony\Component\Routing\Loader\Configurator;
return function (RoutingConfigurator $routes) {
$routes
->collection()
->add('foo', '/foo')
->condition('abc')
->options(['utf8' => true])
->add('buz', 'zub')
->controller('foo:act')
->stateless(t... | ort('php_dsl_sub.php')
->namePrefix('z_')
->prefix('/zub');
$routes->import('php_dsl_sub_root.php')
->prefix('/bus', false);
$routes->add('ouf', '/ouf')
->schemes(['https'])
->methods(['GET'])
->def | ->requirements(['id' => '\d+']);
$routes->imp | {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/php_dsl.php",
"language": "php",
"file_size": 860,
"cut_index": 529,
"middle_length": 52
} |
ge.
*
* (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\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symf... | oader;
class AttributeDirectoryLoaderTest extends TestCase
{
private AttributeDirectoryLoader $loader;
private TraceableAttributeClassLoader $classLoader;
protected function setUp(): void
{
$this->classLoader = new TraceableAttrib | azClass;
use Symfony\Component\Routing\Tests\Fixtures\AttributedClasses\EncodingClass;
use Symfony\Component\Routing\Tests\Fixtures\AttributedClasses\FooClass;
use Symfony\Component\Routing\Tests\Fixtures\TraceableAttributeClassL | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/AttributeDirectoryLoaderTest.php",
"language": "php",
"file_size": 2722,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console;
use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\ValueResolverInterface;... | omponent\Console\DependencyInjection\RemoveEmptyCommandArgumentLocatorsPass;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilde | e\DependencyInjection\AddConsoleCommandPass;
use Symfony\Component\Console\DependencyInjection\ConsoleArgumentValueResolverPass;
use Symfony\Component\Console\DependencyInjection\RegisterCommandArgumentLocatorsPass;
use Symfony\C | {
"filepath": "src/Symfony/Component/Console/ConsoleBundle.php",
"language": "php",
"file_size": 4510,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (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\Console;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\Co... | * executed by the console. It also allows you to modify the command, input and output
* before they are handed to the command.
*
* @Event("Symfony\Component\Console\Event\ConsoleCommandEvent")
*/
public const COMMAND = 'console.co | /**
* Contains all events dispatched by an Application.
*
* @author Francesco Levorato <git@flevour.net>
*/
final class ConsoleEvents
{
/**
* The COMMAND event allows you to attach listeners before any command is
| {
"filepath": "src/Symfony/Component/Console/ConsoleEvents.php",
"language": "php",
"file_size": 2572,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @author Pierre du Plessis <pdples@gmail.com>
*/
final class Cursor
{
/** @var r... | x1b[%dA", $lines));
return $this;
}
/**
* @return $this
*/
public function moveDown(int $lines = 1): static
{
$this->output->write(\sprintf("\x1b[%dB", $lines));
return $this;
}
/**
* @retu | $this->input = $input ?? (\defined('STDIN') ? \STDIN : fopen('php://input', 'r+'));
}
/**
* @return $this
*/
public function moveUp(int $lines = 1): static
{
$this->output->write(\sprintf("\ | {
"filepath": "src/Symfony/Component/Console/Cursor.php",
"language": "php",
"file_size": 3975,
"cut_index": 614,
"middle_length": 229
} |
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\Console;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\... | on = $version;
return $this;
}
/**
* @final
*
* @return $this
*/
public function setAutoExit(bool $autoExit): static
{
$this->autoExit = $autoExit;
return $this;
}
public function run( | private string $version = 'UNKNOWN';
private bool $autoExit = true;
private bool $running = false;
/**
* @return $this
*/
public function setVersion(string $version): static
{
$this->versi | {
"filepath": "src/Symfony/Component/Console/SingleCommandApplication.php",
"language": "php",
"file_size": 1798,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console;
use Symfony\Component\Console\Output\AnsiColorMode;
class Terminal
{
public const DEFAULT_COLOR_MODE = AnsiColorMode::Ansi4;
private static ?AnsiColorMode $colorMode = null;
private static ?int $width = null;
private static ?int $... | {
// Use Cache from previous run (or user forced mode)
if (null !== self::$colorMode) {
return self::$colorMode;
}
// Try with $COLORTERM first
if (\is_string($colorterm = getenv('COLORTERM'))) {
| ps://en.wikipedia.org/wiki/ANSI_escape_code#Colors
* For more information about true color support with terminals https://github.com/termstandard/colors/.
*/
public static function getColorMode(): AnsiColorMode
| {
"filepath": "src/Symfony/Component/Console/Terminal.php",
"language": "php",
"file_size": 7980,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (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\Console\Style;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\C... | blic function newLine(int $count = 1): void
{
$this->output->write(str_repeat(\PHP_EOL, $count));
}
public function createProgressBar(int $max = 0): ProgressBar
{
return new ProgressBar($this->output, $max);
}
publ | e helpers.
*
* @author Kevin Bond <kevinbond@gmail.com>
*/
abstract class OutputStyle implements OutputInterface, StyleInterface
{
public function __construct(
private OutputInterface $output,
) {
}
pu | {
"filepath": "src/Symfony/Component/Console/Style/OutputStyle.php",
"language": "php",
"file_size": 2761,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (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\Console\Style;
/**
* Output style helpers.
*
* @author Kevin Bond <kevinbond@gmail.com>
*/
interface... | /**
* Formats a success result bar.
*/
public function success(string|array $message): void;
/**
* Formats an error result bar.
*/
public function error(string|array $message): void;
/**
* Formats an warning resul | (string $message): void;
/**
* Formats a list.
*/
public function listing(array $elements): void;
/**
* Formats informational text.
*/
public function text(string|array $message): void;
| {
"filepath": "src/Symfony/Component/Console/Style/StyleInterface.php",
"language": "php",
"file_size": 2542,
"cut_index": 563,
"middle_length": 229
} |
Symfony\Component\Console\Helper\TreeHelper;
use Symfony\Component\Console\Helper\TreeNode;
use Symfony\Component\Console\Helper\TreeStyle;
use Symfony\Component\Console\Input\File\InputFile;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Com... | fony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* Output decorator helpers for the Symfony Style Guide.
*
* @author Kevin Bond <kevinbond@gmail.com>
*/
class SymfonyStyle extends OutputStyle
{
public const MAX_LINE_LENGTH = 120;
| on\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\FileQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Terminal;
use Sym | {
"filepath": "src/Symfony/Component/Console/Style/SymfonyStyle.php",
"language": "php",
"file_size": 20220,
"cut_index": 1331,
"middle_length": 229
} |
ge.
*
* (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\Console\Tester;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArrayInpu... | * Executes the application.
*
* Available options:
*
* * interactive: Sets the input interactive flag
* * decorated: Sets the output decorated flag
* * verbosity: Sets the o | tion->setAutoExit(false);
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ApplicationTester
{
use TesterTrait;
public function __construct(
private Application $application,
) {
}
/**
| {
"filepath": "src/Symfony/Component/Console/Tester/ApplicationTester.php",
"language": "php",
"file_size": 2679,
"cut_index": 563,
"middle_length": 229
} |
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\Console\Tester;
use Symfony\Component\Console\Command\Command;
us... | ic function complete(array $input): array
{
$currentIndex = \count($input);
if ('' === end($input)) {
array_pop($input);
}
array_unshift($input, $this->command->getName());
$completionInput = Complet | marelle <jerome@tamarelle.net>
*/
class CommandCompletionTester
{
public function __construct(
private Command $command,
) {
}
/**
* Create completion suggestions from input tokens.
*/
publ | {
"filepath": "src/Symfony/Component/Console/Tester/CommandCompletionTester.php",
"language": "php",
"file_size": 1497,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tester;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\C... | FormatterInterface $outputFormatter;
/**
* @param OutputInterface::VERBOSITY_* $verbosity
*/
public function __construct(
callable|Command $command,
private ?bool $interactive = null,
private bool $decorated = fal | Fabien Potencier <fabien@symfony.com>
* @author Robin Chalas <robin.chalas@gmail.com>
* @author Théo FIDRY <theo.fidry@gmail.com>
*/
class CommandTester
{
use TesterTrait;
private Command $command;
private Output | {
"filepath": "src/Symfony/Component/Console/Tester/CommandTester.php",
"language": "php",
"file_size": 5434,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (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\Console\Tester;
use Symfony\Component\Console\Tester\Constraint\CommandFailed;
use Symfony\Component\Con... | essful(), $message);
}
public function assertCommandFailed(ExecutionResult $result, string $message = ''): void
{
$this->assertThat($result->statusCode, new CommandFailed(), $message);
}
public function assertCommandIsInvalid( | Y <theo.fidry@gmail.com>
*/
trait ConsoleAssertionsTrait
{
public function assertCommandIsSuccessful(ExecutionResult $result, string $message = ''): void
{
$this->assertThat($result->statusCode, new CommandIsSucc | {
"filepath": "src/Symfony/Component/Console/Tester/ConsoleAssertionsTrait.php",
"language": "php",
"file_size": 2217,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (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\Console\Tester;
use Symfony\Component\Console\Output\TestOutput;
/**
* @author Théo FIDRY <theo.fidry@... |
/**
* Gets the display returned by the execution of the command or application. The display combines what was
* written on both the output and error output.
*/
public function getDisplay(bool $normalize = true): string
{
| */
public function __construct(
public readonly string $input,
public readonly int $statusCode,
private readonly TestOutput $output,
private readonly array $normalizers = [],
) {
}
| {
"filepath": "src/Symfony/Component/Console/Tester/ExecutionResult.php",
"language": "php",
"file_size": 2648,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tester;
use PHPUnit\Framework\Assert;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;
us... | dependently = false;
private InputInterface $input;
private int $statusCode;
/**
* Gets the display returned by the last execution of the command or application.
*
* @throws \RuntimeException If it's called before the execute me | ul;
/**
* @author Amrouche Hamza <hamza.simperfit@gmail.com>
*/
trait TesterTrait
{
private StreamOutput $output;
/**
* @var list<string>
*/
private array $inputs = [];
private bool $captureStreamsIn | {
"filepath": "src/Symfony/Component/Console/Tester/TesterTrait.php",
"language": "php",
"file_size": 6332,
"cut_index": 716,
"middle_length": 229
} |
?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\Console\Tester\Constraint;
use PHPUnit\Framework\Const... | cted function additionalFailureDescription($other): string
{
$mapping = [
Command::SUCCESS => 'Command was successful.',
Command::INVALID => 'Command was invalid.',
];
return $mapping[$other] ?? \sprintf | protected function matches($other): bool
{
return Command::FAILURE === $other;
}
protected function failureDescription($other): string
{
return 'the command '.$this->toString();
}
prote | {
"filepath": "src/Symfony/Component/Console/Tester/Constraint/CommandFailed.php",
"language": "php",
"file_size": 1052,
"cut_index": 513,
"middle_length": 229
} |
?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\Console\Tester\Constraint;
use PHPUnit\Framework\Const... | protected function additionalFailureDescription($other): string
{
$mapping = [
Command::SUCCESS => 'Command was successful.',
Command::FAILURE => 'Command failed.',
];
return $mapping[$other] ?? \sprin | }
protected function matches($other): bool
{
return Command::INVALID === $other;
}
protected function failureDescription($other): string
{
return 'the command '.$this->toString();
}
| {
"filepath": "src/Symfony/Component/Console/Tester/Constraint/CommandIsInvalid.php",
"language": "php",
"file_size": 1054,
"cut_index": 513,
"middle_length": 229
} |
?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\Console\Tester\Constraint;
use PHPUnit\Framework\Const... | }
protected function additionalFailureDescription($other): string
{
$mapping = [
Command::FAILURE => 'Command failed.',
Command::INVALID => 'Command was invalid.',
];
return $mapping[$other] ?? \sp | l';
}
protected function matches($other): bool
{
return Command::SUCCESS === $other;
}
protected function failureDescription($other): string
{
return 'the command '.$this->toString();
| {
"filepath": "src/Symfony/Component/Console/Tester/Constraint/CommandIsSuccessful.php",
"language": "php",
"file_size": 1057,
"cut_index": 513,
"middle_length": 229
} |
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\Console\Interaction;
use Symfony\Component\Console\Attribute\InteractiveAttrib... | le $parameterResolver
*
* @param \Closure(\ReflectionFunction $function, InputInterface $input, OutputInterface $output): array $parameterResolver
*/
public function interact(InputInterface $input, OutputInterface $output, \Closure $para | final class Interaction
{
public function __construct(
private readonly object $owner,
private readonly InteractiveAttributeInterface $attribute,
) {
}
/**
* @param-immediately-invoked-callab | {
"filepath": "src/Symfony/Component/Console/Interaction/Interaction.php",
"language": "php",
"file_size": 1761,
"cut_index": 537,
"middle_length": 229
} |
/*
* 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\Console\Exception;
/**
* Represents an incorrect command n... | l $previous Previous exception used for the exception chaining
*/
public function __construct(
string $message,
private array $alternatives = [],
int $code = 0,
?\Throwable $previous = null,
) {
pare | * @param string $message Exception message to throw
* @param string[] $alternatives List of similar defined names
* @param int $code Exception code
* @param \Throwable|nul | {
"filepath": "src/Symfony/Component/Console/Exception/CommandNotFoundException.php",
"language": "php",
"file_size": 1192,
"cut_index": 518,
"middle_length": 229
} |
ackage.
*
* (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\Console\Exception;
/**
* @author Jérôme Tamarelle <jerome@tamarelle.net>
*/
class InvalidArgumentE... | intf('The value "%s" is not valid for the "%s" argument.', $value, $name);
if (\is_array($suggestedValues)) {
$error .= \sprintf(' Supported values are "%s".', implode('", "', $suggestedValues));
}
return new self($err | $suggestedValues): self
{
$error = \spr | {
"filepath": "src/Symfony/Component/Console/Exception/InvalidArgumentException.php",
"language": "php",
"file_size": 882,
"cut_index": 559,
"middle_length": 52
} |
n 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\Console\Exception;
/**
* Represents an incorrect option name or value typed in the console.
*
* @author Jérôme Tamarelle... | ggestedValues): self
{
$error = \sprintf('The value "%s" is not valid for the "%s" option.', $value, $name);
if (\is_array($suggestedValues)) {
$error .= \sprintf(' Supported values are "%s".', implode('", "', $suggestedVal | alue(string $name, string $value, array|\Closure $su | {
"filepath": "src/Symfony/Component/Console/Exception/InvalidOptionException.php",
"language": "php",
"file_size": 951,
"cut_index": 582,
"middle_length": 52
} |
he 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\Console\Exception;
use Symfony\Component\Console\Messenger\RunCommandContext;
/**
* @a... | uct(
$exception instanceof \Throwable ? $exception->getMessage() : $exception,
$exception instanceof \Throwable && \is_int($exception->getCode()) ? $exception->getCode() : 0,
$exception instanceof \Throwable ? $exception | mandContext $context)
{
parent::__constr | {
"filepath": "src/Symfony/Component/Console/Exception/RunCommandFailedException.php",
"language": "php",
"file_size": 883,
"cut_index": 547,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Attribute;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfo... | s-string<\BackedEnum>
*/
public string $typeName = '';
private ?int $mode = null;
private ?InteractiveAttributeInterface $interactiveAttribute = null;
/**
* Represents a console command <argument> definition.
*
* If uns | g;
#[\Attribute(\Attribute::TARGET_PARAMETER | \Attribute::TARGET_PROPERTY)]
class Argument
{
public mixed $default = null;
public array|\Closure $suggestedValues;
/**
* @internal
*
* @var string|clas | {
"filepath": "src/Symfony/Component/Console/Attribute/Argument.php",
"language": "php",
"file_size": 4781,
"cut_index": 614,
"middle_length": 229
} |
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\Console\Attribute;
/**
* Service tag to autoconfigure commands.
*/
#[\Attrib... | em (i.e. "cache:clean")
* @param bool $hidden If true, the command won't be shown when listing all the available commands, but it can still be run as any other command
* @param string|null $help The help content of the command, | ar")
* @param string|null $description The description of the command, displayed with the help page
* @param string[] $aliases The list of aliases of the command. The command will be executed when using one of th | {
"filepath": "src/Symfony/Component/Console/Attribute/AsCommand.php",
"language": "php",
"file_size": 1695,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Attribute;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Input\File\InputF... | AttributeInterface
{
public ?\Closure $normalizer;
public ?\Closure $validator;
private \Closure $closure;
/**
* @param string $question The question to ask the user
* @param string|bool|int|float|null $def | \Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Validator\Constraint;
#[\Attribute(\Attribute::TARGET_PARAMETER | \Attribute::TARGET_PROPERTY)]
class Ask implements Interactive | {
"filepath": "src/Symfony/Component/Console/Attribute/Ask.php",
"language": "php",
"file_size": 7103,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Attribute;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Sy... | y<string|int|float>|callable():array<string|int|float> $choices The list of available choices (leave empty to use enum cases)
* @param string|int|float|null $default The default answer to return if the us | losure $validator;
public array|\Closure $choices;
private \Closure $closure;
/**
* @param string $question The question to ask the user
* @param arra | {
"filepath": "src/Symfony/Component/Console/Attribute/AskChoice.php",
"language": "php",
"file_size": 5999,
"cut_index": 716,
"middle_length": 229
} |
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\Console\Attribute;
use Symfony\Component\Console\Exception\LogicE... | if (!$method->isPublic() || $method->isStatic()) {
throw new LogicException(\sprintf('The interactive method "%s::%s()" must be public and non-static.', $method->class, $method->getName()));
}
if ('__invoke' === $method-> | c static function tryFrom(\ReflectionMethod $method): ?self
{
/** @var self|null $self */
if (!$self = ($method->getAttributes(self::class)[0] ?? null)?->newInstance()) {
return null;
}
| {
"filepath": "src/Symfony/Component/Console/Attribute/Interact.php",
"language": "php",
"file_size": 1428,
"cut_index": 524,
"middle_length": 229
} |
/*
* 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\Console\Attribute;
/**
* Defines how a DateTime parameter ... | m (mutually exclusive with $argument)
*/
public function __construct(
public readonly ?string $format = null,
public readonly ?string $argument = null,
public readonly ?string $option = null,
) {
if ($argument & | $format The DateTime format (@see https://php.net/datetime.format)
* @param string|null $argument The argument name to read from (defaults to parameter name)
* @param string|null $option The option name to read fro | {
"filepath": "src/Symfony/Component/Console/Attribute/MapDateTime.php",
"language": "php",
"file_size": 1129,
"cut_index": 518,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Attribute;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Interaction\Interaction;
/**
... | onGroups
*/
public function __construct(
public readonly ?array $validationGroups = null,
) {
}
/**
* @internal
*/
public static function tryFrom(\ReflectionParameter|\ReflectionProperty $member): ?self
{
| ion|self>
*/
private array $definition = [];
private \ReflectionClass $class;
/**
* @var list<Interact>
*/
private array $interactiveAttributes = [];
/**
* @param string[]|null $validati | {
"filepath": "src/Symfony/Component/Console/Attribute/MapInput.php",
"language": "php",
"file_size": 7466,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Attribute;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\Suggestion;
use Symfony\Component\Console\Exception\LogicException;
us... | */
public string $typeName = '';
/** @internal */
public bool $allowNull = false;
private ?int $mode = null;
private string $memberName = '';
private string $sourceName = '';
/**
* Represents a console command --option | const ALLOWED_UNION_TYPES = ['bool|string', 'bool|int', 'bool|float'];
public mixed $default = null;
public array|\Closure $suggestedValues;
/**
* @internal
*
* @var string|class-string<\BackedEnum>
| {
"filepath": "src/Symfony/Component/Console/Attribute/Option.php",
"language": "php",
"file_size": 6478,
"cut_index": 716,
"middle_length": 229
} |
n 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\Console\Attribute;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\ValueResolverInterface;
/**
* Defines whi... | of the resolver to use
* @param bool $disabled Whether this value resolver is disabled; this allows to enable a value resolver globally while disabling it in specific cases
*/
public function __construc | ueResolverInterface>|string $resolver The class name | {
"filepath": "src/Symfony/Component/Console/Attribute/ValueResolver.php",
"language": "php",
"file_size": 981,
"cut_index": 582,
"middle_length": 52
} |
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\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Ro... | loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
$this->assertTrue($loader->supports($closure, 'closure'), '->supports() checks the resource type if specified');
$this->assertFalse($loader->supports($c | {
$loader = new ClosureLoader();
$closure = static function () {};
$this->assertTrue($loader->supports($closure), '->supports() returns true if the resource is loadable');
$this->assertFalse($ | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php",
"language": "php",
"file_size": 1581,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (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\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symf... | ivate DirectoryLoader $loader;
protected function setUp(): void
{
$locator = new FileLocator();
$this->loader = new DirectoryLoader($locator);
$resolver = new LoaderResolver([
new YamlFileLoader($locator),
| \YamlFileLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Tests\Fixtures\TraceableAttributeClassLoader;
class DirectoryLoaderTest extends TestCase
{
pr | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php",
"language": "php",
"file_size": 2418,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Loader\ObjectLoader;
use... | oaderMap = [
'my_route_provider_service' => new TestObjectLoaderRouteService($collection, 'some-env'),
];
$actualRoutes = $loader->load(
'my_route_provider_service::loadRoutes',
'service'
);
|
$loader = new TestObjectLoader('some-env');
// create a basic collection that will be returned
$collection = new RouteCollection();
$collection->add('foo', new Route('/foo'));
$loader->l | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php",
"language": "php",
"file_size": 3725,
"cut_index": 614,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.