prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
g\Loader\YamlFileLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers\MyController;
class PhpFileLoaderTest extends TestCase
{
public function testSupports()
{
$loader = new PhpFileLoader($this->createSt... | pports('foo.php', 'foo'), '->supports() checks the resource type if specified');
}
public function testLoadWithRoute()
{
$loader = new PhpFileLoader(new FileLocator([__DIR__.'/../Fixtures']));
$routeCollection = $loader->load(' | s('foo.foo'), '->supports() returns true if the resource is loadable');
$this->assertTrue($loader->supports('foo.php', 'php'), '->supports() checks the resource type if specified');
$this->assertFalse($loader->su | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php",
"language": "php",
"file_size": 22226,
"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\Loader\Configurator\Traits;
use PHPUnit\Framework\TestCase;
use ... | $trait = new class {
use PrefixTrait;
public function add(RouteCollection $c, array $p)
{
$this->addPrefix($c, $p, false);
}
};
$trait->add($collection, ['en' => '/en', | public function testAddLocalizedPrefixUpdatesAliases()
{
$collection = new RouteCollection();
$collection->add('app_route', new Route('/path'));
$collection->addAlias('app_alias', 'app_route');
| {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/Configurator/Traits/PrefixTraitTest.php",
"language": "php",
"file_size": 1775,
"cut_index": 537,
"middle_length": 229
} |
{
$this->assertMatchesRegularExpression(
(new Route('/{slug}', [], ['slug' => Requirement::ASCII_SLUG]))->compile()->getRegex(),
'/'.$slug,
);
}
#[TestWith([''])]
#[TestWith(['-'])]
#[TestWith(['fôo'])]
#[TestWith(['-FOO'])]
#[TestWith(['foo-'])]
#[... | lic function testCatchAllOK(string $path)
{
$this->assertMatchesRegularExpression(
(new Route('/{path}', [], ['path' => Requirement::CATCH_ALL]))->compile()->getRegex(),
'/'.$path,
);
}
#[TestWith([''])] | (new Route('/{slug}', [], ['slug' => Requirement::ASCII_SLUG]))->compile()->getRegex(),
'/'.$slug,
);
}
#[TestWith(['foo'])]
#[TestWith(['foo/bar/ccc'])]
#[TestWith(['///'])]
pub | {
"filepath": "src/Symfony/Component/Routing/Tests/Requirement/RequirementTest.php",
"language": "php",
"file_size": 17567,
"cut_index": 1331,
"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\DependencyInjection;
use PHPUnit\Framework\Te... | lver', LoaderResolver::class);
$container->register('loader1')->addTag('routing.loader');
$container->register('loader2')->addTag('routing.loader');
(new RoutingResolverPass())->process($container);
$this->assertEquals(
| nt\Routing\DependencyInjection\RoutingResolverPass;
class RoutingResolverPassTest extends TestCase
{
public function testProcess()
{
$container = new ContainerBuilder();
$container->register('routing.reso | {
"filepath": "src/Symfony/Component/Routing/Tests/DependencyInjection/RoutingResolverPassTest.php",
"language": "php",
"file_size": 1196,
"cut_index": 518,
"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\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony... | ;
$container->register('routing.loader.attribute.services', \stdClass::class)
->setArguments([null]);
$container->register('ctrl_a', '%ctrl_a.class%')->addTag('routing.controller', ['priority' => 10]);
$container->regi | ntrollerPassTest extends TestCase
{
public function testProcessInjectsTaggedControllerClassesOrderedAndUnique()
{
$container = new ContainerBuilder();
$container->setParameter('ctrl_a.class', CtrlA::class) | {
"filepath": "src/Symfony/Component/Routing/Tests/DependencyInjection/RoutingControllerPassTest.php",
"language": "php",
"file_size": 1968,
"cut_index": 537,
"middle_length": 229
} |
hp
/*
* 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\DependencyInjection;
use Symfony\Component\Depen... | if (!$container->has('router.default')) {
return;
}
$definition = $container->findDefinition('router.default');
foreach ($container->findTaggedServiceIds('routing.expression_language_provider', true) as $id => $attribu | language providers.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class AddExpressionLanguageProvidersPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
| {
"filepath": "src/Symfony/Component/Routing/DependencyInjection/AddExpressionLanguageProvidersPass.php",
"language": "php",
"file_size": 1120,
"cut_index": 515,
"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\DependencyInjection;
use Symfony\Component\DependencyInje... | ainer->hasDefinition('routing.loader.attribute.services')) {
return;
}
$resolve = $container->getParameterBag()->resolveValue(...);
$taggedClasses = [];
foreach ($this->findAndSortTaggedServices('routing.control | Nicolas Grekas <p@tchwork.com>
*/
final class RoutingControllerPass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;
public function process(ContainerBuilder $container): void
{
if (!$cont | {
"filepath": "src/Symfony/Component/Routing/DependencyInjection/RoutingControllerPass.php",
"language": "php",
"file_size": 1278,
"cut_index": 524,
"middle_length": 229
} |
tion $e) {
$this->assertEquals(['POST'], $e->getAllowedMethods());
}
}
public function testMatchRequestHonorsTheRequestsMethodOverTheStaticContext()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', [], [], [], '', [], ['GET']));
$matcher = $t... | ew RequestContext('', 'POST', 'example.com');
$matcher = $this->getUrlMatcher($coll, $originalContext);
$matcher->matchRequest(Request::create('https://other.example/foo', 'GET'));
$this->assertSame('POST', $originalContext->getMet | );
}
public function testMatchRequestRestoresTheContextAfterwards()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', [], [], [], '', [], ['GET']));
$originalContext = n | {
"filepath": "src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php",
"language": "php",
"file_size": 43346,
"cut_index": 2151,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Tests\Matcher\Dumper;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Matcher\Dumper\StaticPrefixCollection;
use Symfony\Component\Routing\Route;
class StaticPrefixCollectionTest extends ... | Collection($collection);
$this->assertEquals($expected, $dumped);
}
public static function routeProvider()
{
return [
'Simple - not nested' => [
[
['/', 'root'],
| s as $route) {
[$path, $name] = $route;
$staticPrefix = (new Route($path))->compile()->getStaticPrefix();
$collection->addRoute($staticPrefix, [$name]);
}
$dumped = $this->dump | {
"filepath": "src/Symfony/Component/Routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php",
"language": "php",
"file_size": 5883,
"cut_index": 716,
"middle_length": 229
} |
ponent\Routing\RouteCollection;
class CompiledUrlGeneratorDumperTest extends TestCase
{
private RouteCollection $routeCollection;
private CompiledUrlGeneratorDumper $generatorDumper;
private string $testTmpFilepath;
private string $largeTestTmpFilepath;
protected function setUp(): void
{
... | own(): void
{
@unlink($this->testTmpFilepath);
@unlink($this->largeTestTmpFilepath);
}
public function testDumpWithRoutes()
{
$this->routeCollection->add('Test', new Route('/testing/{foo}'));
$this->routeCol | '/php_generator.php';
$this->largeTestTmpFilepath = sys_get_temp_dir().'/php_generator.large.php';
@unlink($this->testTmpFilepath);
@unlink($this->largeTestTmpFilepath);
}
protected function tearD | {
"filepath": "src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php",
"language": "php",
"file_size": 19451,
"cut_index": 1331,
"middle_length": 229
} |
\Component\Routing\Tests\Fixtures\AttributeFixtures\AliasLocalizedRouteController;
use Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures\AliasRouteController;
use Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures\BazClass;
use Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures\DefaultValueCont... | Tests\Fixtures\AttributeFixtures\ExtendedRouteOnClassController;
use Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures\ExtendedRouteOnMethodController;
use Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures\GlobalDefaultsClass;
use Symfony | asRouteController;
use Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures\EncodingClass;
use Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures\ExplicitLocalizedActionPathController;
use Symfony\Component\Routing\ | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/AttributeClassLoaderTest.php",
"language": "php",
"file_size": 24005,
"cut_index": 1331,
"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\Exception\InvalidArgumentException;
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
final class Color
{
... | magenta' => 5,
'bright-cyan' => 6,
'bright-white' => 7,
];
private const AVAILABLE_OPTIONS = [
'bold' => ['set' => 1, 'unset' => 22],
'underscore' => ['set' => 4, 'unset' => 24],
'blink' => ['set' => 5, 'uns | te' => 7,
'default' => 9,
];
private const BRIGHT_COLORS = [
'gray' => 0,
'bright-red' => 1,
'bright-green' => 2,
'bright-yellow' => 3,
'bright-blue' => 4,
'bright- | {
"filepath": "src/Symfony/Component/Console/Color.php",
"language": "php",
"file_size": 3785,
"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\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Loader\LoaderResolver... | er = new AttributeServicesLoader();
$this->assertFalse($loader->supports('attributes', null));
$this->assertFalse($loader->supports('attributes', 'attribute'));
$this->assertFalse($loader->supports('other', 'routing.controllers')); | s\AttributeFixtures\MethodActionControllers;
use Symfony\Component\Routing\Tests\Fixtures\TraceableAttributeClassLoader;
class AttributeServicesLoaderTest extends TestCase
{
public function testSupports()
{
$load | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/AttributeServicesLoaderTest.php",
"language": "php",
"file_size": 2291,
"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\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Co... | has the glob type');
$this->assertFalse($loader->supports('any-path'), '->supports() returns false if the resource is not of glob type');
}
public function testLoadAddsTheGlobResourceToTheContainer()
{
$loader = new GlobFileLo | est extends TestCase
{
public function testSupports()
{
$loader = new GlobFileLoader(new FileLocator());
$this->assertTrue($loader->supports('any-path', 'glob'), '->supports() returns true if the resource | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/GlobFileLoaderTest.php",
"language": "php",
"file_size": 1538,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symf... | espace\MyOtherController;
use Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers\SubNamespace\MyChildController;
use Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers\SubNamespace\MyControllerWithATrait;
class Psr4DirectoryLoaderTest extends | nent\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers\MyController;
use Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers\SubNamespace\EvenDeeperNam | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/Psr4DirectoryLoaderTest.php",
"language": "php",
"file_size": 7005,
"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\Routing\Tests\Requirement;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase... | s\Enum\TestUnitEnum;
class EnumRequirementTest extends TestCase
{
public function testNotABackedEnum()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('"Symfony\Component\Routing\Tests\Fixtu | g\Tests\Fixtures\Enum\TestIntBackedEnum;
use Symfony\Component\Routing\Tests\Fixtures\Enum\TestStringBackedEnum;
use Symfony\Component\Routing\Tests\Fixtures\Enum\TestStringBackedEnum2;
use Symfony\Component\Routing\Tests\Fixture | {
"filepath": "src/Symfony/Component/Routing/Tests/Requirement/EnumRequirementTest.php",
"language": "php",
"file_size": 2837,
"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\Requirement;
/*
* A collection of universal regular-expression consta... | onst POSITIVE_INT = '[1-9][0-9]*';
public const UID_BASE32 = '[0-9A-HJKMNP-TV-Z]{26}';
public const UID_BASE58 = '[1-9A-HJ-NP-Za-km-z]{22}';
public const UID_RFC4122 = '[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}';
public const UID_RFC9562 | lic const CATCH_ALL = '.+';
public const DATE_YMD = '[0-9]{4}-(?:0[1-9]|1[012])-(?:0[1-9]|[12][0-9]|(?<!02-)3[01])'; // YYYY-MM-DD
public const DIGITS = '[0-9]+';
public const MONGODB_ID = '[0-9a-f]{24}';
public c | {
"filepath": "src/Symfony/Component/Routing/Requirement/Requirement.php",
"language": "php",
"file_size": 1886,
"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\Tests\Matcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
use Symfony\Component\Routi... | /{name}', [], ['id' => '\w+'], [], '', [], ['POST']));
$coll->add('bar2', new Route('/foo', [], [], [], 'baz'));
$coll->add('bar3', new Route('/foo1', [], [], [], 'baz'));
$coll->add('bar4', new Route('/foo2', [], [], [], 'baz', [], | $coll = new RouteCollection();
$coll->add('foo', new Route('/foo', [], [], [], '', [], ['POST']));
$coll->add('bar', new Route('/bar/{id}', [], ['id' => '\d+']));
$coll->add('bar1', new Route('/bar | {
"filepath": "src/Symfony/Component/Routing/Tests/Matcher/TraceableUrlMatcherTest.php",
"language": "php",
"file_size": 4961,
"cut_index": 614,
"middle_length": 229
} |
testing', $url);
}
public function testAbsoluteUrlWithNonStandardPort()
{
$routes = $this->getRoutes('test', new Route('/testing'));
$url = $this->getGenerator($routes, ['httpPort' => 8080])->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL);
$this->assertEquals('http://loc... | ic function testRelativeUrlWithoutParameters()
{
$routes = $this->getRoutes('test', new Route('/testing'));
$url = $this->getGenerator($routes)->generate('test', [], UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals('/ | = $this->getGenerator($routes, ['httpsPort' => 8080, 'scheme' => 'https'])->generate('test', [], UrlGeneratorInterface::ABSOLUTE_URL);
$this->assertEquals('https://localhost:8080/app.php/testing', $url);
}
publ | {
"filepath": "src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php",
"language": "php",
"file_size": 50090,
"cut_index": 2151,
"middle_length": 229
} |
matterHelper;
use Symfony\Component\Console\Helper\DescriptorHelper;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\ProcessHelper;
use Symfony\Component\Console\Helper\QuestionHelper;... | \Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SignalRegistry\SignalRegistry;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection | eInterface;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony | {
"filepath": "src/Symfony/Component/Console/Application.php",
"language": "php",
"file_size": 51900,
"cut_index": 2151,
"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\Tests\Loader;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Cont... | tSame($expected, (new ContainerLoader(new Container()))->supports('foo', $type));
}
public static function supportsProvider()
{
return [
[true, 'service'],
[false, 'bar'],
[false, null],
];
| ed, ?string $type = null)
{
$this->asser | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/ContainerLoaderTest.php",
"language": "php",
"file_size": 921,
"cut_index": 606,
"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\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjec... | ressionLanguageProvidersPass());
$definition = new Definition(\stdClass::class);
$definition->addTag('routing.expression_language_provider');
$container->setDefinition('some_routing_provider', $definition->setPublic(true));
| nLanguageProvidersPass;
class AddExpressionLanguageProvidersPassTest extends TestCase
{
public function testProcessForRouter()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new AddExp | {
"filepath": "src/Symfony/Component/Routing/Tests/DependencyInjection/AddExpressionLanguageProvidersPassTest.php",
"language": "php",
"file_size": 2349,
"cut_index": 563,
"middle_length": 229
} |
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.custom.com... | $route->setDefault('_canonical_route', 'imported');
$route->setDefault('_controller', 'ImportedController::someAction');
$expectedRoutes->add('imported_not_localized', $route = new Route('/here'));
$route->setDefault('_controller', 'ImportedCo | dController::someAction');
$expectedRoutes->add('imported.nl', $route = new Route('/voorbeeld'));
$route->setHost('www.custom.nl');
$route->setRequirement('_locale', 'nl');
$route->setDefault('_locale', 'nl');
| {
"filepath": "src/Symfony/Component/Routing/Tests/Fixtures/locale_and_host/import-without-host-expected-collection.php",
"language": "php",
"file_size": 1438,
"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\Routing\DependencyInjection;
use Symfony\Component\Dependen... | ce
{
use PriorityTaggedServiceTrait;
public function process(ContainerBuilder $container): void
{
if (false === $container->hasDefinition('routing.resolver')) {
return;
}
$definition = $container->getDefini | ny\Component\DependencyInjection\Reference;
/**
* Adds tagged routing.loader services to routing.resolver service.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class RoutingResolverPass implements CompilerPassInterfa | {
"filepath": "src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php",
"language": "php",
"file_size": 1213,
"cut_index": 518,
"middle_length": 229
} |
use Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers\MyController;
class YamlFileLoaderTest extends TestCase
{
public function testSupports()
{
$loader = new YamlFileLoader($this->createStub(FileLocatorInterface::class));
$this->assertTrue($loader->supports('foo.yml'), '->supports() re... | ader->supports('foo.yaml', 'yaml'), '->supports() checks the resource type if specified');
$this->assertFalse($loader->supports('foo.yml', 'foo'), '->supports() checks the resource type if specified');
}
public function testLoadDoesNothing | >supports('foo.foo'), '->supports() returns true if the resource is loadable');
$this->assertTrue($loader->supports('foo.yml', 'yaml'), '->supports() checks the resource type if specified');
$this->assertTrue($lo | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php",
"language": "php",
"file_size": 23854,
"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\Requirement;
use Symfony\Component\Routing\Exception\InvalidArgumentEx... | intf('"%s" is not a "BackedEnum" class.', $cases));
}
$cases = $cases::cases();
} else {
$class = null;
foreach ($cases as $case) {
if (!$case instanceof \BackedEnum) {
| */
public function __construct(string|array $cases = [])
{
if (\is_string($cases)) {
if (!is_subclass_of($cases, \BackedEnum::class, true)) {
throw new InvalidArgumentException(\spr | {
"filepath": "src/Symfony/Component/Routing/Requirement/EnumRequirement.php",
"language": "php",
"file_size": 1648,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Routing\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Loader\AttributeFileLoader;
use Symfony\Component\Routing\Tests\Fixtures\AttributedClasses\FooClass;
use Symfony\Component\Routing\... | Symfony\Component\Routing\Tests\Fixtures\AttributesFixtures\AttributesClassParamInlineQuotedAfterCommaController;
use Symfony\Component\Routing\Tests\Fixtures\AttributesFixtures\AttributesClassParamInlineQuotedAfterParenthesisController;
use Symfony\Compo | Symfony\Component\Routing\Tests\Fixtures\AttributesFixtures\AttributesClassParamInlineAfterCommaController;
use Symfony\Component\Routing\Tests\Fixtures\AttributesFixtures\AttributesClassParamInlineAfterParenthesisController;
use | {
"filepath": "src/Symfony/Component/Routing/Tests/Loader/AttributeFileLoaderTest.php",
"language": "php",
"file_size": 6577,
"cut_index": 716,
"middle_length": 229
} |
ute;
use Symfony\Component\Routing\RouteCollection;
class CompiledUrlMatcherDumperTest extends TestCase
{
private string $dumpPath;
protected function setUp(): void
{
$this->dumpPath = tempnam(sys_get_temp_dir(), 'sf_matcher_');
}
protected function tearDown(): void
{
@unlink(... | r('getRouteCollections')]
public function testDump(RouteCollection $collection, $fixture)
{
$basePath = __DIR__.'/../../Fixtures/dumper/';
$dumper = new CompiledUrlMatcherDumper($collection);
$this->assertStringEqualsFile($ | $matcher = $this->generateDumpedMatcher($collection);
$matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo')->willReturn([]);
$matcher->match('/foo%3Abar');
}
#[DataProvide | {
"filepath": "src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php",
"language": "php",
"file_size": 20621,
"cut_index": 1331,
"middle_length": 229
} |
hp
/*
* 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\Question;
use Symfony\Component\Console\Exceptio... | ) {
throw new InvalidArgumentException('At least one of allowPaste or allowPath must be true.');
}
$this->setTrimmable(false);
}
public function isPasteAllowed(): bool
{
return $this->allowPaste;
}
|
public function __construct(
string $question,
private bool $allowPaste = true,
private bool $allowPath = true,
) {
parent::__construct($question);
if (!$allowPaste && !$allowPath | {
"filepath": "src/Symfony/Component/Console/Question/FileQuestion.php",
"language": "php",
"file_size": 1086,
"cut_index": 515,
"middle_length": 229
} |
lper\Helper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\String\UnicodeString;
class ReStructuredTextDescriptor extends Descriptor
{
... | object, array $options = []): void
{
$decorated = $output->isDecorated();
$output->setDecorated(false);
parent::describe($output, $object, $options);
$output->setDecorated($decorated);
}
/**
* Override pa | har = '.';
// <h5>
private string $subsubsectionChar = '^';
// <h6>
private string $paragraphsChar = '"';
private array $visibleNamespaces = [];
public function describe(OutputInterface $output, object $ | {
"filepath": "src/Symfony/Component/Console/Descriptor/ReStructuredTextDescriptor.php",
"language": "php",
"file_size": 10668,
"cut_index": 921,
"middle_length": 229
} |
rmatter\OutputFormatter;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
/**
* Text descriptor.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*
* @internal
... | $default = '';
}
$totalWidth = $options['total_width'] ?? Helper::width($argument->getName());
$spacingWidth = $totalWidth - \strlen($argument->getName());
$this->writeText(\sprintf(' <info>%s</info> %s%s%s',
| && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
$default = \sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
} else {
| {
"filepath": "src/Symfony/Component/Console/Descriptor/TextDescriptor.php",
"language": "php",
"file_size": 12302,
"cut_index": 921,
"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\Console\SignalRegistry;
/**
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*/
class SignalMap
{
private static array $map;
public static... | stants();
$map = array_filter($c, static fn ($k) => str_starts_with($k, 'SIG') && !str_starts_with($k, 'SIG_') && 'SIGBABY' !== $k, \ARRAY_FILTER_USE_KEY);
self::$map = array_flip($map);
}
return self::$map[$signal] | ctionExtension('pcntl');
$c = $r->getCon | {
"filepath": "src/Symfony/Component/Console/SignalRegistry/SignalMap.php",
"language": "php",
"file_size": 933,
"cut_index": 606,
"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\Console\Helper;
use Symfony\Component\Console\Exception\InvalidArgumentException;
/**
* @author Yewhen... | ,
'options' => null,
'align' => self::DEFAULT_ALIGN,
'cellFormat' => null,
];
public function __construct(array $options = [])
{
if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
| ;
private const ALIGN_MAP = [
'left' => \STR_PAD_RIGHT,
'center' => \STR_PAD_BOTH,
'right' => \STR_PAD_LEFT,
];
private array $options = [
'fg' => 'default',
'bg' => 'default' | {
"filepath": "src/Symfony/Component/Console/Helper/TableCellStyle.php",
"language": "php",
"file_size": 2221,
"cut_index": 563,
"middle_length": 229
} |
* Defines the styles for a Table.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Саша Стаменковић <umpirsky@gmail.com>
* @author Dany Maillard <danymaillard93b@gmail.com>
*/
class TableStyle
{
private string $paddingChar = ' ';
private string $horizontalOutsideBorderChar = '-';
private s... | '+';
private string $crossingBottomMidChar = '+';
private string $crossingBottomLeftChar = '+';
private string $crossingMidLeftChar = '+';
private string $crossingTopLeftBottomChar = '+';
private string $crossingTopMidBottomChar = '+';
| ivate string $crossingTopRightChar = '+';
private string $crossingTopMidChar = '+';
private string $crossingTopLeftChar = '+';
private string $crossingMidRightChar = '+';
private string $crossingBottomRightChar = | {
"filepath": "src/Symfony/Component/Console/Helper/TableStyle.php",
"language": "php",
"file_size": 13085,
"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\Console\Helper;
/**
* TerminalInputHelper stops Ctrl-C and similar signals from leaving the terminal in
* an unusable state if its settings have been mod... | ternal
*/
final class TerminalInputHelper
{
/** @var resource */
private $inputStream;
private bool $isStdin;
private string $initialState = '';
private int $signalToKill = 0;
private array $signalHandlers = [];
private array $ | ngs
*
* // Wait for input before all input reads
* $inputHelper->waitForInput();
*
* ...read input
*
* // Call finish to restore terminal settings and signal handlers
* $inputHelper->finish()
*
* @in | {
"filepath": "src/Symfony/Component/Console/Helper/TerminalInputHelper.php",
"language": "php",
"file_size": 4468,
"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\Helper;
use Symfony\Component\Console\Output\OutputInterface;
/**
* The TreeHelper class provi... | private readonly TreeStyle $style,
) {
$this->children = new \IteratorIterator($this->node->getChildren());
$this->children->rewind();
}
public static function createTree(OutputInterface $output, string|TreeNode|null $root = | eIterator
{
/**
* @var \Iterator<int, TreeNode>
*/
private \Iterator $children;
private function __construct(
private readonly OutputInterface $output,
private readonly TreeNode $node,
| {
"filepath": "src/Symfony/Component/Console/Helper/TreeHelper.php",
"language": "php",
"file_size": 2910,
"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\Helper;
/**
* @implements \IteratorAggregate<TreeNode>
*
* @author Simon André <smn.andre@gma... | omValues(iterable $nodes, ?self $node = null): self
{
$node ??= new self();
foreach ($nodes as $key => $value) {
if (is_iterable($value)) {
$child = new self($key);
self::fromValues($value, $c | nction __construct(
private readonly string $value = '',
iterable $children = [],
) {
foreach ($children as $child) {
$this->addChild($child);
}
}
public static function fr | {
"filepath": "src/Symfony/Component/Console/Helper/TreeNode.php",
"language": "php",
"file_size": 2367,
"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\Helper;
/**
* Configures the output of the Tree helper.
*
* @author Simon André <smn.andre@gm... | return new self('┃╸ ', '┗╸ ', '', '┃ ', ' ', '');
}
public static function boxDouble(): self
{
return new self('╠═ ', '╚═ ', '', '║ ', ' ', '');
}
public static function compact(): self
{
return new self | y string $prefixLeft,
private readonly string $prefixMidHasNext,
private readonly string $prefixMidLast,
private readonly string $prefixRight,
) {
}
public static function box(): self
{
| {
"filepath": "src/Symfony/Component/Console/Helper/TreeStyle.php",
"language": "php",
"file_size": 2314,
"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\DependencyInjection\Loader\Configurator;
use Symfony\Component\Console\ArgumentResolver\ArgumentResolver;
use Symfony\Component\Console\ArgumentResolver\Va... | r\ValueResolver\MapInputValueResolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\ServiceValueResolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\UidValueResolver;
use Symfony\Component\Console\ArgumentResolver\ValueRes | eValueResolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\DefaultValueResolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\InputFileValueResolver;
use Symfony\Component\Console\ArgumentResolve | {
"filepath": "src/Symfony/Component/Console/Resources/config/console.php",
"language": "php",
"file_size": 4380,
"cut_index": 614,
"middle_length": 229
} |
Helper\HelperSet;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Base class for all commands.
*
* ... | utDefinition $definition;
private bool $hidden = false;
private string $help = '';
private string $description = '';
private ?InputDefinition $fullDefinition = null;
private bool $ignoreValidationErrors = false;
private ?InvokableCo | public const FAILURE = 1;
public const INVALID = 2;
private ?Application $application = null;
private ?string $name = null;
private ?string $processTitle = null;
private array $aliases = [];
private Inp | {
"filepath": "src/Symfony/Component/Console/Command/Command.php",
"language": "php",
"file_size": 22530,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Completion\Output\BashCompletionOutpu... | ole\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Responsible for providing the values to the shell completion.
*
* @author Wouter de Jong <wouter@wouterj.nl>
*/
#[AsCommand(name: '|_complete', description: 'Internal c | put\ZshCompletionOutput;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Cons | {
"filepath": "src/Symfony/Component/Console/Command/CompleteCommand.php",
"language": "php",
"file_size": 9091,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\... | n configure(): void
{
$fullCommand = $_SERVER['PHP_SELF'];
$commandName = basename($fullCommand);
$fullCommand = @realpath($fullCommand) ?: $fullCommand;
$shell = self::guessShell();
[$rcFile, $completionFile] = | uter de Jong <wouter@wouterj.nl>
*/
#[AsCommand(name: 'completion', description: 'Dump the shell completion script')]
final class DumpCompletionCommand extends Command
{
private array $supportedShells;
protected functio | {
"filepath": "src/Symfony/Component/Console/Command/DumpCompletionCommand.php",
"language": "php",
"file_size": 5483,
"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\Command;
use Symfony\Component\Console\Descriptor\ApplicationDescription;
use Symfony\Component\... | protected function configure(): void
{
$this->ignoreValidationErrors();
$this
->setName('help')
->setDefinition([
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name' | fony\Component\Console\Output\OutputInterface;
/**
* HelpCommand displays the help for a given command.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class HelpCommand extends Command
{
private Command $command;
| {
"filepath": "src/Symfony/Component/Console/Command/HelpCommand.php",
"language": "php",
"file_size": 2579,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\ArgumentResolver\ArgumentResolver;
use Symfony\Component\Console\ArgumentResolver\ArgumentResolverInterface;
use Symfony\Component\Console\Attribute\Argument;
use Symf... | teraction\Interaction;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* Represents an invokable command.
*
* @author Yonel Ceruto <open@yceruto.dev>
*
* @internal
*/
class InvokableCommand | mponent\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\RawInputInterface;
use Symfony\Component\Console\In | {
"filepath": "src/Symfony/Component/Console/Command/InvokableCommand.php",
"language": "php",
"file_size": 8721,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Completion\Suggestion;
use Symfony\Component\... | name,
array $aliases,
string $description,
bool $isHidden,
\Closure $commandFactory,
private ?bool $isEnabled = true,
) {
$this->setName($name)
->setAliases($aliases)
->setHidden($ | fony\Component\Console\Output\OutputInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
final class LazyCommand extends Command
{
private \Closure|Command $command;
public function __construct(
string $ | {
"filepath": "src/Symfony/Component/Console/Command/LazyCommand.php",
"language": "php",
"file_size": 5724,
"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\Command;
use Symfony\Component\Console\Descriptor\ApplicationDescription;
use Symfony\Component\... | rotected function configure(): void
{
$this
->setName('list')
->setDefinition([
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', null, fn () => array_keys((new ApplicationDesc | fony\Component\Console\Output\OutputInterface;
/**
* ListCommand displays the list of all available commands for the application.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ListCommand extends Command
{
p | {
"filepath": "src/Symfony/Component/Console/Command/ListCommand.php",
"language": "php",
"file_size": 2699,
"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\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Except... | * Locks a command.
*/
private function lock(?string $name = null, bool $blocking = false): bool
{
if (!class_exists(SemaphoreStore::class)) {
throw new LogicException('To enable the locking feature you must install the symf | re;
/**
* Basic lock feature for commands.
*
* @author Geoffrey Brier <geoffrey.brier@gmail.com>
*/
trait LockableTrait
{
private ?LockInterface $lock = null;
private ?LockFactory $lockFactory = null;
/**
| {
"filepath": "src/Symfony/Component/Console/Command/LockableTrait.php",
"language": "php",
"file_size": 2445,
"cut_index": 563,
"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\Console\Command;
/**
* Interface for command reacting to signal.
*
* @author Grégoire Pineau <lyrixx@lyrix.info>
*/
interface SignalableCommand... | method will be called when the application is signaled.
*
* @return int|false The exit code to return or false to continue the normal execution
*/
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false;
}
| n getSubscribedSignals(): array;
/**
* The | {
"filepath": "src/Symfony/Component/Console/Command/SignalableCommandInterface.php",
"language": "php",
"file_size": 915,
"cut_index": 606,
"middle_length": 52
} |
nsole\Completion\CompletionSuggestions;
use Symfony\Component\Console\Helper\HelperInterface;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\... | ;
public string $maxMemoryUsage = 'n/a';
public InputInterface $input;
public OutputInterface $output;
/** @var array<string, mixed> */
public array $arguments;
/** @var array<string, mixed> */
public array $options;
/** @va | Command
{
public readonly Command $command;
public int $exitCode;
public ?int $interruptedBySignal = null;
public bool $ignoreValidation;
public bool $isInteractive = false;
public string $duration = 'n/a' | {
"filepath": "src/Symfony/Component/Console/Command/TraceableCommand.php",
"language": "php",
"file_size": 10947,
"cut_index": 921,
"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\EventListener;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\ConsoleEvents;
use Sym... | truct(
private ?LoggerInterface $logger = null,
) {
}
public function onConsoleError(ConsoleErrorEvent $event): void
{
if (null === $this->logger) {
return;
}
$error = $event->getError();
| er\EventSubscriberInterface;
/**
* @author James Halsall <james.t.halsall@googlemail.com>
* @author Robin Chalas <robin.chalas@gmail.com>
*/
class ErrorListener implements EventSubscriberInterface
{
public function __cons | {
"filepath": "src/Symfony/Component/Console/EventListener/ErrorListener.php",
"language": "php",
"file_size": 2673,
"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\EventListener;
use Symfony\Component\Console\ConsoleEvent... | n __construct(
private readonly ValidatorInterface $validator,
) {
}
public function onQuestionAnswered(QuestionAnsweredEvent $event): void
{
$violations = $this->validator->validate($event->value, $event->constraints);
|
* Validates Question answers (user input) using the Validator component.
*
* @author Robin Chalas <robin.chalas@gmail.com>
*/
final class ValidateQuestionInputListener implements EventSubscriberInterface
{
public functio | {
"filepath": "src/Symfony/Component/Console/EventListener/ValidateQuestionInputListener.php",
"language": "php",
"file_size": 1275,
"cut_index": 524,
"middle_length": 229
} |
'], array_keys($application->all()), '__construct() registered the help and list commands by default');
}
public function testSetGetName()
{
$application = new Application();
$application->setName('foo');
$this->assertEquals('foo', $application->getName(), '->setName() sets the name... | fo>bar</info>', $application->getLongVersion(), '->getLongVersion() returns the long version of the application');
}
public function testGetLongVersionWithContainer()
{
$container = new ContainerBuilder();
$container->setParame | , $application->getVersion(), '->setVersion() sets the version of the application');
}
public function testGetLongVersion()
{
$application = new Application('foo', 'bar');
$this->assertEquals('foo <in | {
"filepath": "src/Symfony/Component/Console/Tests/ApplicationTest.php",
"language": "php",
"file_size": 133611,
"cut_index": 7068,
"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\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Color;
use Symfony\Componen... | $this->assertSame("\033[91;103m \033[39;49m", $color->apply(' '));
$color = new Color('red', 'yellow', ['underscore']);
$this->assertSame("\033[31;43;4m \033[39;49;24m", $color->apply(' '));
}
public function testTrueColors()
| his->assertSame(' ', $color->apply(' '));
$color = new Color('red', 'yellow');
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));
$color = new Color('bright-red', 'bright-yellow');
| {
"filepath": "src/Symfony/Component/Console/Tests/ColorTest.php",
"language": "php",
"file_size": 2463,
"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\Attribute\Reflection;
use Symfony\Component\String\UnicodeString;
/**
* @internal
*/
class ReflectionMember
{
public function __construct(
... | T of object
*
* @param class-string<T> $class
*
* @return list<T>
*/
public function getAttributes(string $class): array
{
return array_map(
static fn (\ReflectionAttribute $attribute) => $attribute->new | T|null
*/
public function getAttribute(string $class): ?object
{
return ($this->member->getAttributes($class, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null)?->newInstance();
}
/**
* @template | {
"filepath": "src/Symfony/Component/Console/Attribute/Reflection/ReflectionMember.php",
"language": "php",
"file_size": 3411,
"cut_index": 614,
"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\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Co... | rait;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
class ConsoleBundleTest extends TestCase
{
private string $varDir;
protected function setUp(): void
{
$this->varDir = s | ony\Component\Console\Tester\ApplicationTester;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Kernel\AbstractKernel;
use Symfony\Component\DependencyInjection\Kernel\KernelT | {
"filepath": "src/Symfony/Component/Console/Tests/ConsoleBundleTest.php",
"language": "php",
"file_size": 4167,
"cut_index": 614,
"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\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Co... | y\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Compo | e Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\ApplicationTester;
use Symfon | {
"filepath": "src/Symfony/Component/Console/Tests/ConsoleEventsTest.php",
"language": "php",
"file_size": 3517,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Cursor;
use Symfony\Component\Console\Output\StreamOutput;
class CursorTest extends TestCase
{
/** @var resource */
protected $stream;
protected function setUp(): voi... | {
$cursor = new Cursor($output = $this->getOutputStream());
$cursor->moveUp(12);
$this->assertEquals("\x1b[12A", $this->getOutputContent($output));
}
public function testMoveDownOneLine()
{
$cursor = new Cur | {
$cursor = new Cursor($output = $this->getOutputStream());
$cursor->moveUp();
$this->assertEquals("\x1b[1A", $this->getOutputContent($output));
}
public function testMoveUpMultipleLines()
| {
"filepath": "src/Symfony/Component/Console/Tests/CursorTest.php",
"language": "php",
"file_size": 5741,
"cut_index": 716,
"middle_length": 229
} |
de;
use Symfony\Component\Console\Terminal;
class TerminalTest extends TestCase
{
private string|false $colSize;
private string|false $lineSize;
private string|false $ansiCon;
protected function setUp(): void
{
$this->colSize = getenv('COLUMNS');
$this->lineSize = getenv('LINES');
... |
foreach (['height', 'width', 'stty', 'kittyGraphics', 'iterm2Images'] as $name) {
$property = new \ReflectionProperty(Terminal::class, $name);
$property->setValue(null, null);
}
}
public function test()
| UMNS');
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
putenv($this->ansiCon ? 'ANSICON='.$this->ansiCon : 'ANSICON');
$this->resetStatics();
}
private function resetStatics()
{ | {
"filepath": "src/Symfony/Component/Console/Tests/TerminalTest.php",
"language": "php",
"file_size": 9416,
"cut_index": 921,
"middle_length": 229
} |
and;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\TreeHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\Input;
use Symfony\Component\Console\Input\InputInterface;
use Symf... |
class SymfonyStyleTest extends TestCase
{
protected Command $command;
protected CommandTester $tester;
private string|false $colSize;
protected function setUp(): void
{
$this->colSize = getenv('COLUMNS');
putenv('COLUM | le\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Tester\CommandTester;
| {
"filepath": "src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php",
"language": "php",
"file_size": 14687,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests\Tester;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symf... | $this->application->setAutoExit(false);
$this->application->register('foo')
->addArgument('foo')
->setCode(static function (OutputInterface $output): int {
$output->writeln('foo');
return | er;
class ApplicationTesterTest extends TestCase
{
protected Application $application;
protected ApplicationTester $tester;
protected function setUp(): void
{
$this->application = new Application();
| {
"filepath": "src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php",
"language": "php",
"file_size": 5582,
"cut_index": 716,
"middle_length": 229
} |
Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Compo... | fony\Component\Console\Tests\Fixtures\InvokableWithInteractiveChoiceAttributeTestCommand;
use Symfony\Component\Console\Tests\Fixtures\InvokableWithInteractiveHiddenQuestionAttributeTestCommand;
use Symfony\Component\Console\Tests\Fixtures\MethodBasedTestC | omponent\Console\Tests\Fixtures\InvokableTestCommand;
use Symfony\Component\Console\Tests\Fixtures\InvokableWithInputTestCommand;
use Symfony\Component\Console\Tests\Fixtures\InvokableWithInteractiveAttributesTestCommand;
use Sym | {
"filepath": "src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php",
"language": "php",
"file_size": 27202,
"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\Console\Tests\Tester\Constraint;
use PHPUnit\Framework\Attributes\DataProvider... | is->assertTrue($constraint->evaluate(Command::FAILURE, '', true));
$this->assertFalse($constraint->evaluate(Command::INVALID, '', true));
}
#[DataProvider('providesUnsuccessful')]
public function testUnsuccessfulCommand(string $expecte | ;
final class CommandFailedTest extends TestCase
{
public function testConstraint()
{
$constraint = new CommandFailed();
$this->assertFalse($constraint->evaluate(Command::SUCCESS, '', true));
$th | {
"filepath": "src/Symfony/Component/Console/Tests/Tester/Constraint/CommandFailedTest.php",
"language": "php",
"file_size": 1627,
"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\Console\Tests\Tester\Constraint;
use PHPUnit\Framework\Attributes\DataProvider... | $this->assertFalse($constraint->evaluate(Command::FAILURE, '', true));
$this->assertTrue($constraint->evaluate(Command::INVALID, '', true));
}
#[DataProvider('providesUnsuccessful')]
public function testUnsuccessfulCommand(string | lid;
final class CommandIsInvalidTest extends TestCase
{
public function testConstraint()
{
$constraint = new CommandIsInvalid();
$this->assertFalse($constraint->evaluate(Command::SUCCESS, '', true));
| {
"filepath": "src/Symfony/Component/Console/Tests/Tester/Constraint/CommandIsInvalidTest.php",
"language": "php",
"file_size": 1637,
"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\Console\Tests\Tester\Constraint;
use PHPUnit\Framework\Attributes\DataProvider... | ue));
$this->assertFalse($constraint->evaluate(Command::FAILURE, '', true));
$this->assertFalse($constraint->evaluate(Command::INVALID, '', true));
}
#[DataProvider('providesUnsuccessful')]
public function testUnsuccessfulComma | essful;
final class CommandIsSuccessfulTest extends TestCase
{
public function testConstraint()
{
$constraint = new CommandIsSuccessful();
$this->assertTrue($constraint->evaluate(Command::SUCCESS, '', tr | {
"filepath": "src/Symfony/Component/Console/Tests/Tester/Constraint/CommandIsSuccessfulTest.php",
"language": "php",
"file_size": 1646,
"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\Tests\Exception;
use PHPUnit\Framework\TestCase;
use Symf... | self::assertSame(42, $exception->getCode());
}
public function testNonIntegerCodeProvidesZero()
{
$exception = self::createException(new class extends \Exception {
protected $code = 'non-integer-code';
});
| le\Messenger\RunCommandMessage;
class RunCommandFailedExceptionTest extends TestCase
{
public function testDefaultExceptionProvidesCode()
{
$exception = self::createException(new \Exception('Boom!', 42));
| {
"filepath": "src/Symfony/Component/Console/Tests/Exception/RunCommandFailedExceptionTest.php",
"language": "php",
"file_size": 1394,
"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\Console\Question;
/**
* Represents a yes/no question.
*
* @author Fabien Po... | te string $trueAnswerRegex = '/^y/i',
) {
parent::__construct($question, $default);
$this->setNormalizer($this->getDefaultNormalizer());
}
/**
* Returns the default answer normalizer.
*/
private function getDefau | The default answer to return, true or false
* @param string $trueAnswerRegex A regex to match the "yes" answer
*/
public function __construct(
string $question,
bool $default = true,
priva | {
"filepath": "src/Symfony/Component/Console/Question/ConfirmationQuestion.php",
"language": "php",
"file_size": 1522,
"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\Tests\Fixtures;
use Symfony\Component\Console\Comma... | ntexts));
$code = self::SUCCESS;
foreach ($contexts as $ignored) {
$io->progressAdvance();
try {
parent::run($input, $output);
} catch (\Throwable) {
$code = self::FAILURE | LoopCommand extends Command
{
public function run(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$contexts = [1, 2, 3];
$io->progressStart(count($co | {
"filepath": "src/Symfony/Component/Console/Tests/Fixtures/AbstractLoopCommand.php",
"language": "php",
"file_size": 1137,
"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\Console\Helper;
/**
* Helps outputting debug information when running an external program from a command.
*
* An external program can be a Process, an H... | ing $prefix = 'RUN'): string
{
$this->started[$id] = ['border' => ++$this->count % \count(self::COLORS)];
return \sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
}
/**
* | , 'blue', 'magenta', 'cyan', 'white', 'default'];
private array $started = [];
private int $count = -1;
/**
* Starts a debug formatting session.
*/
public function start(string $id, string $message, str | {
"filepath": "src/Symfony/Component/Console/Helper/DebugFormatterHelper.php",
"language": "php",
"file_size": 3328,
"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\Helper;
use Symfony\Component\Console\Output\OutputInterface;
use Symf... | r = null,
) {
if (class_exists(CliDumper::class)) {
$this->handler = function ($var): string {
$dumper = $this->dumper ??= new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
| land@gmail.com>
*/
final class Dumper
{
private \Closure $handler;
public function __construct(
private OutputInterface $output,
private ?CliDumper $dumper = null,
private ?ClonerInterface $clone | {
"filepath": "src/Symfony/Component/Console/Helper/Dumper.php",
"language": "php",
"file_size": 1681,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Helper;
use Symfony\Component\Console\Exception\InvalidFileException;
use Symfony\Component\Console\Exception\MissingInputException;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\File\InputFile;
use Sym... | * @author Robin Chalas <robin.chalas@gmail.com>
*
* @internal
*/
final class FileInputHelper
{
private const BPM_ENABLE = "\x1b[?2004h";
private const BPM_DISABLE = "\x1b[?2004l";
private const PASTE_START = "\x1b[200~";
private const P | otocolInterface;
use Symfony\Component\Console\Terminal\Image\ITerm2Protocol;
use Symfony\Component\Console\Terminal\Image\KittyGraphicsProtocol;
/**
* Orchestrates file input handling through paste detection or path input.
*
| {
"filepath": "src/Symfony/Component/Console/Helper/FileInputHelper.php",
"language": "php",
"file_size": 7318,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Helper;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\String\UnicodeString;
/**
* Helper is the base class for all helper classes.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class Hel... | e string will use.
*/
public static function width(?string $string): int
{
$string ??= '';
if ('' === $string) {
return 0;
}
// Fast path for ASCII-only strings (no multi-byte, no control chars exc | public function getHelperSet(): ?HelperSet
{
return $this->helperSet;
}
/**
* Returns the width of a string, using mb_strwidth if it is available.
* The width is how many characters positions th | {
"filepath": "src/Symfony/Component/Console/Helper/Helper.php",
"language": "php",
"file_size": 5113,
"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\Helper;
/**
* Simple output wrapper for "tagged outputs" instead of wordwrap(). This solution i... | ed, non-linebreak whitespace
* (?: # break types:
* (?<= [^\S\r\n] ) # 1. - Behind a non-linebreak whitespace
* [^\S\r\n]? # ( optionally accept an e | start)
* (?> # Atomic Group - Match words with valid breaks
* .{1,16} # 1-N characters
* # Followed by one of 4 prioritiz | {
"filepath": "src/Symfony/Component/Console/Helper/OutputWrapper.php",
"language": "php",
"file_size": 3011,
"cut_index": 563,
"middle_length": 229
} |
verbose';
public const FORMAT_VERY_VERBOSE = 'very_verbose';
public const FORMAT_DEBUG = 'debug';
public const FORMAT_NORMAL = 'normal';
private const FORMAT_VERBOSE_NOMAX = 'verbose_nomax';
private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax';
private const FORMAT_DEBUG_NOMAX = 'debu... | sBetweenRedraws = 0;
private float $maxSecondsBetweenRedraws = 1;
private OutputInterface $output;
private int $step = 0;
private int $startingStep = 0;
private ?int $max = null;
private int $startTime;
private int $stepWidth;
| ressChar = '>';
private ?string $format = null;
private ?string $internalFormat = null;
private ?int $redrawFreq = 1;
private int $writeCount = 0;
private float $lastWriteTime = 0;
private float $minSecond | {
"filepath": "src/Symfony/Component/Console/Helper/ProgressBar.php",
"language": "php",
"file_size": 24280,
"cut_index": 1331,
"middle_length": 229
} |
StreamableInputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\ConsoleSectionOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\FileQuestion;
use Symfony\... | $stty = true;
private static bool $stdinIsInteractive;
public function __construct(
private ?EventDispatcherInterface $dispatcher = null,
) {
}
/**
* Asks a question to the user.
*
* @return mixed The user answ | nction Symfony\Component\String\s;
/**
* The QuestionHelper class provides helpers to interact with the user.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class QuestionHelper extends Helper
{
private static bool | {
"filepath": "src/Symfony/Component/Console/Helper/QuestionHelper.php",
"language": "php",
"file_size": 22698,
"cut_index": 1331,
"middle_length": 229
} |
nWidths = [];
private int $numberOfColumns;
private TableStyle $style;
private array $columnStyles = [];
private array $columnWidths = [];
private array $columnMaxWidths = [];
private bool $rendered = false;
private string $displayOrientation = self::DISPLAY_ORIENTATION_DEFAULT;
private... | }
/**
* Gets a style definition by name.
*/
public static function getStyleDefinition(string $name): TableStyle
{
self::$styles ??= self::initStyles();
return self::$styles[$name] ?? throw new InvalidArgumentExce | }
/**
* Sets a style definition.
*/
public static function setStyleDefinition(string $name, TableStyle $style): void
{
self::$styles ??= self::initStyles();
self::$styles[$name] = $style;
| {
"filepath": "src/Symfony/Component/Console/Helper/Table.php",
"language": "php",
"file_size": 35293,
"cut_index": 2151,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\DataCollector;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Debug\CliRequest;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SignalRegistry\SignalMap;
use Symfony\Component\HttpFou... | request instanceof CliRequest) {
return;
}
$command = $request->command;
$application = $command->getApplication();
$this->data = [
'command' => $command->invokableCommandInfo ?? $this->cloneVar($co | * @author Jules Pietri <jules@heahprod.com>
*/
final class CommandDataCollector extends DataCollector
{
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
if (!$ | {
"filepath": "src/Symfony/Component/Console/DataCollector/CommandDataCollector.php",
"language": "php",
"file_size": 6829,
"cut_index": 716,
"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\Logger;
use Psr\Log\AbstractLogger;
use Psr\Log\InvalidArgumentException;
use Psr\Log\LogLevel;
use Symfony\Component\Console\Output\ConsoleOutputI... | LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
| sr-3/
*/
class ConsoleLogger extends AbstractLogger
{
public const INFO = 'info';
public const ERROR = 'error';
private array $verbosityLevelMap = [
LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
| {
"filepath": "src/Symfony/Component/Console/Logger/ConsoleLogger.php",
"language": "php",
"file_size": 4199,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOp... | oid
{
$this->writeData($this->getInputOptionData($option), $options);
if ($option->isNegatable()) {
$this->writeData($this->getInputOptionData($option, true), $options);
}
}
protected function describeInputD | (InputArgument $argument, array $options = []): void
{
$this->writeData($this->getInputArgumentData($argument), $options);
}
protected function describeInputOption(InputOption $option, array $options = []): v | {
"filepath": "src/Symfony/Component/Console/Descriptor/JsonDescriptor.php",
"language": "php",
"file_size": 5745,
"cut_index": 716,
"middle_length": 229
} |
put\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
/**
* XML descriptor.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*
* @internal
*/
class XmlDescriptor extends Descriptor
{
public function getInputDefinitionDocument(InputDefinit... | $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
foreach ($definition->getOptions() as $option) {
$this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
}
return $dom | pendChild($argumentsXML = $dom->createElement('arguments'));
foreach ($definition->getArguments() as $argument) {
$this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
}
| {
"filepath": "src/Symfony/Component/Console/Descriptor/XmlDescriptor.php",
"language": "php",
"file_size": 9709,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Question;
use Symfony\Component\Console\Exception\InvalidArgumentException;
/**
* Represents a choice question.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ChoiceQuestion extends Question
{
private bool $multiselect = false;
... | construct(
string $question,
private array $choices,
string|bool|int|float|null $default = null,
) {
if (!$choices) {
throw new \LogicException('Choice question must have at least 1 choice available.');
| the user
* @param array<string|bool|int|float|\Stringable> $choices The list of available choices
* @param string|bool|int|float|null $default The default answer to return
*/
public function __ | {
"filepath": "src/Symfony/Component/Console/Question/ChoiceQuestion.php",
"language": "php",
"file_size": 5185,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Question;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Validator\Constraint;
/**
* Represents a Question.
*
* @author Fabien Potencier <fabien@sym... | ?\Closure $normalizer = null;
private bool $trimmable = true;
private bool $multiline = false;
private ?int $timeout = null;
/**
* @var Constraint[]
*/
private array $constraints = [];
/**
* @param string | l
*/
private ?\Closure $autocompleterCallback = null;
/**
* @var (\Closure(mixed):mixed)|null
*/
private ?\Closure $validator = null;
/**
* @var (\Closure(mixed):mixed)|null
*/
private | {
"filepath": "src/Symfony/Component/Console/Question/Question.php",
"language": "php",
"file_size": 8289,
"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\Helper;
use Symfony\Component\Console\Descriptor\DescriptorInterface;
use Symfony\Component\Cons... | per method to describe objects in various formats.
*
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class DescriptorHelper extends Helper
{
/**
* @var DescriptorInterface[]
*/
private array $descriptors = [];
public functio | escriptor\TextDescriptor;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Output\OutputInterface;
/**
* This class adds hel | {
"filepath": "src/Symfony/Component/Console/Helper/DescriptorHelper.php",
"language": "php",
"file_size": 2617,
"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\Console\Helper;
use Symfony\Component\Console\Exception\InvalidArgumentExcepti... | elpers = [])
{
foreach ($helpers as $alias => $helper) {
$this->set($helper, \is_int($alias) ? null : $alias);
}
}
public function set(HelperInterface $helper, ?string $alias = null): void
{
$this->helpe | */
class HelperSet implements \IteratorAggregate
{
/** @var array<string, HelperInterface> */
private array $helpers = [];
/**
* @param HelperInterface[] $helpers
*/
public function __construct(array $h | {
"filepath": "src/Symfony/Component/Console/Helper/HelperSet.php",
"language": "php",
"file_size": 1837,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Helper;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Output\ConsoleSectionOutput;
use Symfony\Component\Console\Output\OutputInterface;
/**
... | i' => ' %message% (%elapsed:6s%, %memory:6s%)',
];
private int $startTime;
private ?string $format = null;
private ?string $message = null;
private array $indicatorValues;
private int $indicatorCurrent;
private string $finished | 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
'very_verbose_no_ans | {
"filepath": "src/Symfony/Component/Console/Helper/ProgressIndicator.php",
"language": "php",
"file_size": 7552,
"cut_index": 716,
"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\Helper;
use Symfony\Component\Console\Exception\InvalidArgumentExcepti... | throw new InvalidArgumentException(\sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
}
if (isset($options['style']) && !$options['style'] instanceof TableCellStyle) {
| ];
public function __construct(
private string $value = '',
array $options = [],
) {
// check option names
if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
| {
"filepath": "src/Symfony/Component/Console/Helper/TableCell.php",
"language": "php",
"file_size": 1728,
"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\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\Comma... | (
private Application $application,
private ?string $namespace = null,
private bool $showHidden = false,
) {
}
public function getNamespaces(): array
{
if (!isset($this->namespaces)) {
$this->ins | private array $namespaces;
/**
* @var array<string, Command>
*/
private array $commands;
/**
* @var array<string, Command>
*/
private array $aliases = [];
public function __construct | {
"filepath": "src/Symfony/Component/Console/Descriptor/ApplicationDescription.php",
"language": "php",
"file_size": 3690,
"cut_index": 614,
"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\SignalRegistry;
final class SignalRegistry
{
/**
* @var array<int, array<callable>>
*/
private array $signalHandlers = [];
/... | {
$previous = pcntl_signal_get_handler($signal);
if (!isset($this->originalHandlers[$signal])) {
$this->originalHandlers[$signal] = $previous;
}
if (!isset($this->signalHandlers[$signal])) {
if (\is |
public function __construct()
{
if (\function_exists('pcntl_async_signals')) {
pcntl_async_signals(true);
}
}
public function register(int $signal, callable $signalHandler): void
| {
"filepath": "src/Symfony/Component/Console/SignalRegistry/SignalRegistry.php",
"language": "php",
"file_size": 3879,
"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\Helper;
use Symfony\Component\Console\Formatter\OutputFormatter;
/**
* The Formatter class pro... | lock of text.
*/
public function formatBlock(string|array $messages, string $style, bool $large = false): string
{
if (!\is_array($messages)) {
$messages = [$messages];
}
$len = 0;
$lines = [];
| public function formatSection(string $section, string $message, string $style = 'info'): string
{
return \sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
}
/**
* Formats a message as a b | {
"filepath": "src/Symfony/Component/Console/Helper/FormatterHelper.php",
"language": "php",
"file_size": 2238,
"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\Helper;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Pr... | ram callable|null $callback A PHP callback to run whenever there is some
* output available on STDOUT or STDERR
*/
public function run(OutputInterface $output, array|Process $cmd, ?string $error = null, ?callabl | n@symfony.com>
*
* @final
*/
class ProcessHelper extends Helper
{
/**
* Runs an external process.
*
* @param array|Process $cmd An instance of Process or an array of the command and arguments
* @pa | {
"filepath": "src/Symfony/Component/Console/Helper/ProcessHelper.php",
"language": "php",
"file_size": 4829,
"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\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Com... | erface
{
protected OutputInterface $output;
public function describe(OutputInterface $output, object $object, array $options = []): void
{
$this->output = $output;
match (true) {
$object instanceof InputArgument => | onent\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
abstract class Descriptor implements DescriptorInt | {
"filepath": "src/Symfony/Component/Console/Descriptor/Descriptor.php",
"language": "php",
"file_size": 2656,
"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\Helper;
/**
* HelperInterface is the interface al... | elperSet(?HelperSet $helperSet): void;
/**
* Gets the helper set associated with this helper.
*/
public function getHelperSet(): ?HelperSet;
/**
* Returns the canonical name of this helper.
*/
public function getName() | function setH | {
"filepath": "src/Symfony/Component/Console/Helper/HelperInterface.php",
"language": "php",
"file_size": 799,
"cut_index": 517,
"middle_length": 14
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Descriptor;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition... | etDecorated(false);
parent::describe($output, $object, $options);
$output->setDecorated($decorated);
}
protected function write(string $content, bool $decorated = true): void
{
parent::write($content, $decorated);
| * @internal
*/
class MarkdownDescriptor extends Descriptor
{
public function describe(OutputInterface $output, object $object, array $options = []): void
{
$decorated = $output->isDecorated();
$output->s | {
"filepath": "src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php",
"language": "php",
"file_size": 6408,
"cut_index": 716,
"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\Helper;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Consol... | ion): void
{
$text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
$default = $question->getDefault();
if ($question->isMultiline()) {
$text .= \sprintf(' (press %s to continue)', $this->getEof | * Symfony Style Guide compliant question helper.
*
* @author Kevin Bond <kevinbond@gmail.com>
*/
class SymfonyQuestionHelper extends QuestionHelper
{
protected function writePrompt(OutputInterface $output, Question $quest | {
"filepath": "src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php",
"language": "php",
"file_size": 3281,
"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\Console\Tests\Fixtures;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Con... | ->setHelp('command åèä help')
->addUsage('-o|--option_name <argument_name>')
->addUsage('<argument_name>')
->addArgument('argument_åèä', InputArgument::REQUIRED)
->addOption('option_åèä', 'o', InputOption::VA | tDescription('command åèä description')
| {
"filepath": "src/Symfony/Component/Console/Tests/Fixtures/DescriptorCommandMbString.php",
"language": "php",
"file_size": 957,
"cut_index": 606,
"middle_length": 52
} |
hp
/*
* 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\Tests\Descriptor;
use Symfony\Component\Console\... | te function normalizeOutputRecursively($output)
{
if (\is_array($output)) {
return array_map($this->normalizeOutputRecursively(...), $output);
}
return match ($output) {
null, true, false => $output,
| static function getFormat()
{
return 'json';
}
protected function normalizeOutput($output)
{
return array_map($this->normalizeOutputRecursively(...), json_decode($output, true));
}
priva | {
"filepath": "src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php",
"language": "php",
"file_size": 1073,
"cut_index": 515,
"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\Tests\Descriptor;
use Symfony\Component\Console\Descripto... | _mbstring' => new DescriptorCommandMbString()]
));
}
public static function getDescribeApplicationTestData()
{
return self::getDescriptionTestData(array_merge(
ObjectsProvider::getApplications(),
['appli | torTest extends AbstractDescriptorTestCase
{
public static function getDescribeCommandTestData()
{
return self::getDescriptionTestData(array_merge(
ObjectsProvider::getCommands(),
['command | {
"filepath": "src/Symfony/Component/Console/Tests/Descriptor/MarkdownDescriptorTest.php",
"language": "php",
"file_size": 1255,
"cut_index": 524,
"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\Tests\Descriptor;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Con... | ()
{
return [
'input_argument_1' => new InputArgument('argument_name', InputArgument::REQUIRED),
'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'),
'inp | Tests\Fixtures\DescriptorCommand1;
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand2;
/**
* @author Jean-François Simon <contact@jfsimon.fr>
*/
class ObjectsProvider
{
public static function getInputArguments | {
"filepath": "src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php",
"language": "php",
"file_size": 4054,
"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\Console\Tests\Descriptor;
use Symfony\Component\Console\Descripto... | ['command_mbstring' => new DescriptorCommandMbString()]
));
}
public static function getDescribeApplicationTestData()
{
return self::getDescriptionTestData(array_merge(
ObjectsProvider::getApplications(),
| turedTextDescriptorTest extends AbstractDescriptorTestCase
{
public static function getDescribeCommandTestData()
{
return self::getDescriptionTestData(array_merge(
ObjectsProvider::getCommands(),
| {
"filepath": "src/Symfony/Component/Console/Tests/Descriptor/ReStructuredTextDescriptorTest.php",
"language": "php",
"file_size": 1280,
"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\Console\Tests\Descriptor;
use Symfony\Component\Console\Descriptor\TextDescrip... | tsProvider::getCommands(),
['command_mbstring' => new DescriptorCommandMbString()]
));
}
public static function getDescribeApplicationTestData()
{
return self::getDescriptionTestData(array_merge(
Objects | es\DescriptorCommandMbString;
class TextDescriptorTest extends AbstractDescriptorTestCase
{
public static function getDescribeCommandTestData()
{
return self::getDescriptionTestData(array_merge(
Objec | {
"filepath": "src/Symfony/Component/Console/Tests/Descriptor/TextDescriptorTest.php",
"language": "php",
"file_size": 1602,
"cut_index": 537,
"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\Tests\SignalRegistry;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;
use Sy... | $this->assertSame('SIGKILL', SignalMap::getSignalName(\SIGKILL));
$this->assertSame('SIGTERM', SignalMap::getSignalName(\SIGTERM));
$this->assertSame('SIGSYS', SignalMap::getSignalName(\SIGSYS));
}
public function testSigna | tSame('SIGINT', SignalMap::getSignalName(\SIGINT));
| {
"filepath": "src/Symfony/Component/Console/Tests/SignalRegistry/SignalMapTest.php",
"language": "php",
"file_size": 981,
"cut_index": 582,
"middle_length": 52
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.