prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tests\Terminal\Image;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Terminal\Image\KittyGraphicsProtocol;
class KittyGraphicsProto... | eWithoutKittySequence()
{
$data = 'just plain text';
$this->assertFalse((new KittyGraphicsProtocol())->detectPastedImage($data));
}
public function testDecodeValidPayload()
{
$imageData = 'test image data';
| eWithKittySequence()
{
$data = "some text\x1b_Ga=T,f=100;base64data\x1b\\more text";
$this->assertTrue((new KittyGraphicsProtocol())->detectPastedImage($data));
}
public function testDetectPastedImag | {
"filepath": "src/Symfony/Component/Console/Tests/Terminal/Image/KittyGraphicsProtocolTest.php",
"language": "php",
"file_size": 4414,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests\ArgumentResolver\ValueResolver;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\BackedEnumValueResolver;
use Symfony\Component\Console\Attribute\Argument;
use Symfony\Component\Console\Attribute\Opt... | mValueResolverTest extends TestCase
{
public function testResolveBackedEnumArgument()
{
$resolver = new BackedEnumValueResolver();
$input = new ArrayInput(['status' => 'pending'], new InputDefinition([
new InputArgument | nException;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
class BackedEnu | {
"filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/BackedEnumValueResolverTest.php",
"language": "php",
"file_size": 7147,
"cut_index": 716,
"middle_length": 229
} |
nent\Clock\MockClock;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\DateTimeValueResolver;
use Symfony\Component\Console\Attribute\MapDateTime;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArg... | e);
}
public static function getTimeZones()
{
yield ['UTC', false];
yield ['Pacific/Honolulu', false];
yield ['America/Toronto', false];
yield ['UTC', true];
yield ['Pacific/Honolulu', true];
yie | faultTimezone;
protected function setUp(): void
{
$this->defaultTimezone = date_default_timezone_get();
}
protected function tearDown(): void
{
date_default_timezone_set($this->defaultTimezon | {
"filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/DateTimeValueResolverTest.php",
"language": "php",
"file_size": 13866,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests\ArgumentResolver\ValueResolver;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\ArgumentResolver\ArgumentResolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\InputFileValueResolver;
use Symfony\Component\Console... | nent\Console\Input\InputOption;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Tests\Fixtures\InvokableWithInputFileTestCommand;
use Symfony\Component\Filesystem\Filesystem;
class InputFileValueResolverTest extends TestC | eption;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\File\InputFile;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Compo | {
"filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/InputFileValueResolverTest.php",
"language": "php",
"file_size": 8933,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests\ArgumentResolver\ValueResolver;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\ArgumentResolver\Exception\NearMissValueResolverException;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\ServiceValueResolver;
use Sym... | eValueResolver(new ServiceLocator([]));
$input = new ArrayInput(['app:test'], new InputDefinition([
new InputArgument('command'),
]));
$function = static fn (DummyService $dummy) => null;
$reflection = new \Refl | nput\InputDefinition;
use Symfony\Component\DependencyInjection\ServiceLocator;
class ServiceValueResolverTest extends TestCase
{
public function testDoNotSupportWhenCommandDoesNotExist()
{
$resolver = new Servic | {
"filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/ServiceValueResolverTest.php",
"language": "php",
"file_size": 7561,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests\Command;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandCompletionTester;
use Symfony\Component\Console\Tester\CommandTester... | tDisplay(), '->execute() returns a list of available commands');
}
public function testExecuteListsCommandsWithXmlOption()
{
$application = new Application();
$commandTester = new CommandTester($command = $application->get('lis | $application->get('list'));
$commandTester->execute(['command' => $command->getName()], ['decorated' => false]);
$this->assertMatchesRegularExpression('/help\s{2,}Display help for a command/', $commandTester->ge | {
"filepath": "src/Symfony/Component/Console/Tests/Command/ListCommandTest.php",
"language": "php",
"file_size": 5786,
"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\Tests\EventListener;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Compon... | le\Output\NullOutput;
class ErrorListenerTest extends TestCase
{
public function testOnConsoleError()
{
$error = new \TypeError('An error occurred');
$logger = $this->createMock(LoggerInterface::class);
$logger
| rgvInput;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\Input;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Conso | {
"filepath": "src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php",
"language": "php",
"file_size": 4820,
"cut_index": 614,
"middle_length": 229
} |
}
public function testConstructorArguments()
{
$this->initializeArguments();
$definition = new InputDefinition();
$this->assertSame([], $definition->getArguments(), '__construct() creates a new InputDefinition object');
$definition = new InputDefinition([$this->foo, $this... | finition object');
$definition = new InputDefinition([$this->foo, $this->bar]);
$this->assertSame(['foo' => $this->foo, 'bar' => $this->bar], $definition->getOptions(), '__construct() takes an array of InputOption objects as its first argu | }
public function testConstructorOptions()
{
$this->initializeOptions();
$definition = new InputDefinition();
$this->assertSame([], $definition->getOptions(), '__construct() creates a new InputDe | {
"filepath": "src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php",
"language": "php",
"file_size": 17521,
"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\Tests\Input;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\ArgvInput;
use Symf... | ');
$this->assertSame($tokens, $p->getValue($input), $message);
}
public function testInputOptionWithGivenString()
{
$definition = new InputDefinition(
[new InputOption('foo', null, InputOption::VALUE_REQUIRED)]
| ataProvider('getTokenizeData')]
public function testTokenize($input, $tokens, $message)
{
$input = new StringInput($input);
$r = new \ReflectionClass(ArgvInput::class);
$p = $r->getProperty('tokens | {
"filepath": "src/Symfony/Component/Console/Tests/Input/StringInputTest.php",
"language": "php",
"file_size": 4478,
"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\Tests\Completion\Output;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Completio... | getExpectedOptionsOutput(): string;
abstract public function getExpectedValuesOutput(): string;
public function testOptionsOutput()
{
$options = [
new InputOption('option1', 'o', InputOption::VALUE_NONE, 'First Option'),
| utOption;
use Symfony\Component\Console\Output\StreamOutput;
abstract class CompletionOutputTestCase extends TestCase
{
abstract public function getCompletionOutput(): CompletionOutputInterface;
abstract public function | {
"filepath": "src/Symfony/Component/Console/Tests/Completion/Output/CompletionOutputTestCase.php",
"language": "php",
"file_size": 2095,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests\Messenger;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RunCommandFailedException;
use Symfony\Component\Console\Input\InputIn... | Exception\UnrecoverableExceptionInterface;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
/**
* @author Kevin Bond <kevinbond@gmail.com>
*/
final class RunCommandMessageHandlerTest extends TestCase
{
public function | ny\Component\Console\Output\OutputInterface;
use Symfony\Component\Messenger\Exception\RecoverableExceptionInterface;
use Symfony\Component\Messenger\Exception\RecoverableMessageHandlingException;
use Symfony\Component\Messenger\ | {
"filepath": "src/Symfony/Component/Console/Tests/Messenger/RunCommandMessageHandlerTest.php",
"language": "php",
"file_size": 5902,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests\ArgumentResolver\ValueResolver;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\BuiltinTypeValueResolver;
use Symfony\Component\Console\Attribute\Argument;
use Symfony\Component\Console\Attribute\Op... | alueResolver();
$input = new ArrayInput(['username' => 'john'], new InputDefinition([
new InputArgument('username'),
]));
$command = new class {
public function __invoke(
#[Argument]
| ent\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
class BuiltinTypeValueResolverTest extends TestCase
{
public function testResolveStringArgument()
{
$resolver = new BuiltinTypeV | {
"filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/BuiltinTypeValueResolverTest.php",
"language": "php",
"file_size": 8280,
"cut_index": 716,
"middle_length": 229
} |
kedEnumValueResolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\BuiltinTypeValueResolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\DateTimeValueResolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\MapInputValueResolver;
use Symfony\Component\Console\Attribute\Arg... | onsole\Input\InputOption;
use Symfony\Component\Validator\Validation;
class MapInputValueResolverTest extends TestCase
{
public function testResolveMapInput()
{
$resolver = new MapInputValueResolver(new BuiltinTypeValueResolver(), new Back | ent\Console\Exception\InputValidationFailedException;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\C | {
"filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/MapInputValueResolverTest.php",
"language": "php",
"file_size": 11202,
"cut_index": 921,
"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\Command;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Comp... | $command = new class extends SingleCommandApplication {
protected function execute(InputInterface $input, OutputInterface $output): int
{
return 0;
}
};
$command->setAutoExit(false);
| stCase
{
public function testRun()
{
| {
"filepath": "src/Symfony/Component/Console/Tests/Command/SingleCommandApplicationTest.php",
"language": "php",
"file_size": 969,
"cut_index": 582,
"middle_length": 52
} |
\Exception\InvalidFileException;
use Symfony\Component\Console\Input\File\InputFile;
use Symfony\Component\Filesystem\Filesystem;
class InputFileTest extends TestCase
{
private Filesystem $filesystem;
private string $tempDir;
protected function setUp(): void
{
$this->filesystem = new Filesyste... | ta);
$this->assertTrue($file->isValid());
$this->assertTrue($file->isTempFile());
$this->assertSame($data, $file->getContents());
$this->assertStringStartsWith(sys_get_temp_dir().'/symfony_input_', $file->getPathname());
| {
$this->filesystem->remove($this->tempDir);
InputFile::cleanupAll();
}
public function testFromDataCreatesTemporaryFile()
{
$data = 'test content';
$file = InputFile::fromData($da | {
"filepath": "src/Symfony/Component/Console/Tests/Input/File/InputFileTest.php",
"language": "php",
"file_size": 10699,
"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\Tests\Terminal\Image;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Terminal\Image\ITerm2Protocol;
class ITerm2ProtocolTest extend... | ce()
{
$data = 'just plain text';
$this->assertFalse((new ITerm2Protocol())->detectPastedImage($data));
}
public function testDecodeValidPayload()
{
$imageData = 'test image data';
$base64 = base64_encode($ | )
{
$data = "some text\x1b]1337;File=inline=1:base64data\x07more text";
$this->assertTrue((new ITerm2Protocol())->detectPastedImage($data));
}
public function testDetectPastedImageWithoutITerm2Sequen | {
"filepath": "src/Symfony/Component/Console/Tests/Terminal/Image/ITerm2ProtocolTest.php",
"language": "php",
"file_size": 4824,
"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\Tests\ArgumentResolver;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\ArgumentRe... | = new class implements ArgumentResolverInterface {
public function getArguments(InputInterface $input, callable $command, ?\ReflectionFunctionAbstract $reflector = null): array
{
return ['arg1', 'arg2'];
| InputInterface;
use Symfony\Component\Stopwatch\Stopwatch;
class TraceableArgumentResolverTest extends TestCase
{
public function testTimingsInGetArguments()
{
$stopwatch = new Stopwatch();
$innerResolver | {
"filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/TraceableArgumentResolverTest.php",
"language": "php",
"file_size": 2410,
"cut_index": 563,
"middle_length": 229
} |
nput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
class ArrayInputTest extends TestCase
{
public function testGetFirstArgument()
{
$input = new ArrayInput([]);
$this->assertNull($input->... | returns the first passed argument');
}
public function testHasParameterOption()
{
$input = new ArrayInput(['name' => 'Fabien', '--foo' => 'bar']);
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() | Argument(), '->getFirstArgument() returns the first passed argument');
$input = new ArrayInput(['--foo' => 'bar', 'name' => 'Fabien']);
$this->assertSame('Fabien', $input->getFirstArgument(), '->getFirstArgument() | {
"filepath": "src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php",
"language": "php",
"file_size": 16499,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Tests\Completion;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDe... | tOption('with-optional-value', 'o', InputOption::VALUE_OPTIONAL),
new InputOption('without-value', 'n', InputOption::VALUE_NONE),
new InputArgument('required-arg', InputArgument::REQUIRED),
new InputArgument('optional-ar | put, string $expectedType, ?string $expectedName, string $expectedValue)
{
$definition = new InputDefinition([
new InputOption('with-required-value', 'r', InputOption::VALUE_REQUIRED),
new Inpu | {
"filepath": "src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php",
"language": "php",
"file_size": 8510,
"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\Tests\ArgumentResolver\ValueResolver;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Cons... | 'default') => null;
$reflection = new \ReflectionFunction($function);
$parameter = $reflection->getParameters()[0];
$member = new ReflectionMember($parameter);
$result = $resolver->resolve('name', $input, $member);
| eResolverTest extends TestCase
{
public function testResolveParameterWithDefaultValue()
{
$resolver = new DefaultValueResolver();
$input = new ArrayInput([]);
$function = static fn (string $name = | {
"filepath": "src/Symfony/Component/Console/Tests/ArgumentResolver/ValueResolver/DefaultValueResolverTest.php",
"language": "php",
"file_size": 2585,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Input\File;
use Symfony\Component\Console\Exception\InvalidFileException;
use Symfony\Component\Mime\MimeTypes;
/**
* Represents a file provided through console input.
*
* Inspired by HttpFoundation's UploadedFile, this class wraps a file provid... | string $path,
bool $isTempFile = false,
?string $mimeType = null,
) {
parent::__construct($path);
$this->isTempFile = $isTempFile;
$this->mimeType = $mimeType;
if ($isTempFile) {
if (!se | {
/** @var string[] */
private static array $tempFiles = [];
private static bool $shutdownRegistered = false;
private ?string $mimeType = null;
private bool $isTempFile;
public function __construct(
| {
"filepath": "src/Symfony/Component/Console/Input/File/InputFile.php",
"language": "php",
"file_size": 7757,
"cut_index": 716,
"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\ArgumentResolver\ValueResolver;
use Symfony\Component\Console\Attribute\Reflection\Reflectio... | Robin Chalas <robin.chalas@gmail.com>
*/
interface ValueResolverInterface
{
/**
* Returns the possible value(s) for the argument.
*/
public function resolve(string $argumentName, InputInterface $input, ReflectionMember $member): iterable | * @author Nicolas Grekas <p@tchwork.com>
* @author | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ValueResolver/ValueResolverInterface.php",
"language": "php",
"file_size": 871,
"cut_index": 559,
"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\ArgumentResolver\ValueResolver;
use Psr\Clock\ClockInterface;
use Symfony\Component\Console\Attribute\MapDateTime;
use Symfony\Component\Console\At... | (
private readonly ?ClockInterface $clock = null,
) {
}
public function resolve(string $argumentName, InputInterface $input, ReflectionMember $member): iterable
{
$type = $member->getType();
if (!$type instanceof \ | erlei <kontakt@beberlei.de>
* @author Tim Goudriaan <tim@codedmonkey.com>
* @author Robin Chalas <robin.chalas@gmail.com>
*/
final class DateTimeValueResolver implements ValueResolverInterface
{
public function __construct | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ValueResolver/DateTimeValueResolver.php",
"language": "php",
"file_size": 3360,
"cut_index": 614,
"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\ArgumentResolver\ValueResolver;
use Symfony\Comp... | string $argumentName, InputInterface $input, ReflectionMember $member): iterable
{
if ($member->hasDefaultValue()) {
return [$member->getDefaultValue()];
}
if ($member->isNullable() && !$member->isVariadic()) {
| as been explicitly passed.
*
* @author Iltar van der Berg <kjarli@gmail.com>
* @author Robin Chalas <robin.chalas@gmail.com>
*/
final class DefaultValueResolver implements ValueResolverInterface
{
public function resolve( | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ValueResolver/DefaultValueResolver.php",
"language": "php",
"file_size": 1061,
"cut_index": 515,
"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\ArgumentResolver\ValueResolver;
use Symfony\Component\Console\Attribut... | tInterface $input, ReflectionMember $member): iterable
{
if (!$member->isVariadic()) {
return [];
}
if ($argument = Argument::tryFrom($member->getMember())) {
$values = $input->getArgument($argument->nam | lds a variadic argument's values from the input.
*
* @author Robin Chalas <robin.chalas@gmail.com>
*/
final class VariadicValueResolver implements ValueResolverInterface
{
public function resolve(string $argumentName, Inpu | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ValueResolver/VariadicValueResolver.php",
"language": "php",
"file_size": 1814,
"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\Formatter;
/**
* @author Tien Xuan Vo <tien.xuan.v... | ew NullOutputFormatterStyle();
}
public function hasStyle(string $name): bool
{
return false;
}
public function isDecorated(): bool
{
return false;
}
public function setDecorated(bool $decorated): void
|
return null;
}
public function getStyle(string $name): OutputFormatterStyleInterface
{
// to comply with the interface we must return a OutputFormatterStyleInterface
return $this->style ??= n | {
"filepath": "src/Symfony/Component/Console/Formatter/NullOutputFormatter.php",
"language": "php",
"file_size": 1158,
"cut_index": 518,
"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\Formatter;
/**
* @author Tien Xuan Vo <tien.xuan.vo@gmail.com>
*/
final class NullOutputFormatterStyle implements... | ring $color): void
{
// do nothing
}
public function setOption(string $option): void
{
// do nothing
}
public function setOptions(array $options): void
{
// do nothing
}
public function unsetOp | nothing
}
public function setForeground(?st | {
"filepath": "src/Symfony/Component/Console/Formatter/NullOutputFormatterStyle.php",
"language": "php",
"file_size": 953,
"cut_index": 582,
"middle_length": 52
} |
n Symfony\Component\String\b;
/**
* Formatter class for console output.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
* @author Roland Franssen <franssen.roland@gmail.com>
*/
class OutputFormatter implements WrappableOutputFormatterInterface
{
private array $styles = [];
private OutputFormatterSt... | \$2', $text);
return self::escapeTrailingBackslash($text);
}
/**
* Escapes trailing "\" in given text.
*
* @internal
*/
public static function escapeTrailingBackslash(string $text): string
{
if (str_end | ey] = clone $value;
}
}
/**
* Escapes "<" and ">" special chars in given text.
*/
public static function escape(string $text): string
{
$text = preg_replace('/([^\\\\]|^)([<>])/', '$1\\\ | {
"filepath": "src/Symfony/Component/Console/Formatter/OutputFormatter.php",
"language": "php",
"file_size": 9305,
"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\Console\Formatter;
/**
* Formatter interface for console output.... | rface $style): void;
/**
* Checks if output formatter has style with specified name.
*/
public function hasStyle(string $name): bool;
/**
* Gets style options from style with specified name.
*
* @throws \InvalidArgume | ted): void;
/**
* Whether the output will decorate messages.
*/
public function isDecorated(): bool;
/**
* Sets a new style.
*/
public function setStyle(string $name, OutputFormatterStyleInte | {
"filepath": "src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php",
"language": "php",
"file_size": 1259,
"cut_index": 524,
"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\Formatter;
use Symfony\Component\Console\Color;
/**
* Formatter style class for defining style... | nd The style foreground color name
* @param string|null $background The style background color name
*/
public function __construct(?string $foreground = null, ?string $background = null, array $options = [])
{
$this->color = new C | private string $background;
private array $options;
private ?string $href = null;
private bool $handlesHrefGracefully;
/**
* Initializes output formatter style.
*
* @param string|null $foregrou | {
"filepath": "src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php",
"language": "php",
"file_size": 2737,
"cut_index": 563,
"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\Formatter;
/**
* Formatter style interface for ... | tion(string $option): void;
/**
* Unsets some specific style option.
*/
public function unsetOption(string $option): void;
/**
* Sets multiple style options at once.
*/
public function setOptions(array $options): void; | setForeground(?string $color): void;
/**
* Sets style background color.
*/
public function setBackground(?string $color): void;
/**
* Sets some specific style option.
*/
public function setOp | {
"filepath": "src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php",
"language": "php",
"file_size": 1111,
"cut_index": 515,
"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\Formatter;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Contrac... | tyle ?? new OutputFormatterStyle();
$this->reset();
}
/**
* Resets stack (ie. empty internal arrays).
*/
public function reset(): void
{
$this->styles = [];
}
/**
* Pushes a style in the stack.
| rface[]
*/
private array $styles = [];
private OutputFormatterStyleInterface $emptyStyle;
public function __construct(?OutputFormatterStyleInterface $emptyStyle = null)
{
$this->emptyStyle = $emptyS | {
"filepath": "src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php",
"language": "php",
"file_size": 2545,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\DependencyInjection;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\LazyCommand;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
use Symfony... | nent\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\TypedReference;
/**
* Registers console commands.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*/
class AddConsoleCommandPass implements CompilerPassInterface
{
publ | viceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Compo | {
"filepath": "src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php",
"language": "php",
"file_size": 7578,
"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\DependencyInjection;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\TraceableValue... | on\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Gathers and configures the console argument value resolvers.
*
* @author Robin Chalas <robin.chalas@gmail.com>
*/
class ConsoleArgumentValueResolverPass implements Compile | ion\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
use Symfony\Component\DependencyInjecti | {
"filepath": "src/Symfony/Component/Console/DependencyInjection/ConsoleArgumentValueResolverPass.php",
"language": "php",
"file_size": 3030,
"cut_index": 563,
"middle_length": 229
} |
mfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\DependencyInjection\Attribute\AutowireCallable;
use Symfony\Component\DependencyInjection\Attribute\Target;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component... | \TypedReference;
use Symfony\Component\VarExporter\ProxyHelper;
/**
* Creates the service-locators required by ServiceValueResolver for commands.
*
* @author Nicolas Grekas <p@tchwork.com>
* @author Robin Chalas <robin.chalas@gmail.com>
*/
final clas | ymfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection | {
"filepath": "src/Symfony/Component/Console/DependencyInjection/RegisterCommandArgumentLocatorsPass.php",
"language": "php",
"file_size": 9649,
"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\DependencyInjection;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
u... | ver.service')) {
return;
}
$serviceResolverDef = $container->getDefinition('console.argument_resolver.service');
$commandLocatorRef = $serviceResolverDef->getArgument(0);
if (!$commandLocatorRef) {
| il.com>
*/
final class RemoveEmptyCommandArgumentLocatorsPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('console.argument_resol | {
"filepath": "src/Symfony/Component/Console/DependencyInjection/RemoveEmptyCommandArgumentLocatorsPass.php",
"language": "php",
"file_size": 2076,
"cut_index": 563,
"middle_length": 229
} |
s 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\CommandLoader;
use Symfony\Component\Console\Command\Command;
use Sym... | CommandNotFoundException
*/
public function get(string $name): Command;
/**
* Checks if a command exists.
*/
public function has(string $name): bool;
/**
* @return string[]
*/
public function getNames(): array | * @throws | {
"filepath": "src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php",
"language": "php",
"file_size": 810,
"cut_index": 536,
"middle_length": 14
} |
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\CommandLoader;
use Psr\Container\ContainerInterface;
use ... | private ContainerInterface $container,
private array $commandMap,
) {
}
public function get(string $name): Command
{
if (!$this->has($name)) {
throw new CommandNotFoundException(\sprintf('Command "%s" do | halas@gmail.com>
*/
class ContainerCommandLoader implements CommandLoaderInterface
{
/**
* @param array $commandMap An array with command names as keys and service ids as values
*/
public function __construct(
| {
"filepath": "src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php",
"language": "php",
"file_size": 1370,
"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\CommandLoader;
use Symfony\Component\Console\Command\Comm... | ories,
) {
}
public function has(string $name): bool
{
return isset($this->factories[$name]);
}
public function get(string $name): Command
{
if (!isset($this->factories[$name])) {
throw new CommandN | .steinhausser@gmail.com>
*/
class FactoryCommandLoader implements CommandLoaderInterface
{
/**
* @param callable[] $factories Indexed by command names
*/
public function __construct(
private array $fact | {
"filepath": "src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php",
"language": "php",
"file_size": 1263,
"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\Output;
use Symfony\Component\Console\Exception\InvalidArgumentException;
/**
* @author Fabien Potencier <fabien@symfony.com>
* @author Julien B... | kward compatibility).
* Output syntax is: "ESC[38;5;${foreGroundColorcode};48;5;${backGroundColorcode}m"
* Should be compatible with most terminals.
*/
case Ansi8;
/*
* 24-bit Ansi colors (RGB).
* Output syntax is: "ESC[38 | ${backGroundColorcode}m"
* Must be compatible with all terminals and it's the minimal version supported.
*/
case Ansi4;
/*
* 8-bit Ansi colors (240 different colors + 16 duplicate color codes, ensuring bac | {
"filepath": "src/Symfony/Component/Console/Output/AnsiColorMode.php",
"language": "php",
"file_size": 3492,
"cut_index": 614,
"middle_length": 229
} |
s 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\Output;
/**
* @author Jean-François Simon <contact@jfsimon.fr>
*/
c... | er;
$this->buffer = '';
return $content;
}
protected function doWrite(string $message, bool $newline): void
{
$this->buffer .= $message;
if ($newline) {
$this->buffer .= \PHP_EOL;
}
}
} | = $this->buff | {
"filepath": "src/Symfony/Component/Console/Output/BufferedOutput.php",
"language": "php",
"file_size": 808,
"cut_index": 536,
"middle_length": 14
} |
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\Output;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Fo... | = false, int $options = 0): void
{
foreach ($this->outputs as $output) {
$output->write(...\func_get_args());
}
}
public function writeln(iterable|string $messages, int $options = 0): void
{
foreach ($t | onstruct(
private array $outputs,
) {
if (!$outputs) {
throw new LogicException('Expected at least one output.');
}
}
public function write(iterable|string $messages, bool $newline | {
"filepath": "src/Symfony/Component/Console/Output/CombinedOutput.php",
"language": "php",
"file_size": 2568,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
/**
* ConsoleOutput is the default class for all CLI output. It uses STDOUT and STDERR.
*
* This class is a convenient wrapper around `StreamOutput` for both STDOUT and ST... |
/**
* @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
* @param bool|null $decorated Whether to decorate messages (null for auto-guessing)
* @pa | err', 'w'));
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
{
private OutputInterface $stderr;
private array $consoleSectionOutputs = []; | {
"filepath": "src/Symfony/Component/Console/Output/ConsoleOutput.php",
"language": "php",
"file_size": 5543,
"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\Output;
/**
* ConsoleOutputInterface is the ... | s OutputInterface
{
/**
* Gets the OutputInterface for errors.
*/
public function getErrorOutput(): OutputInterface;
public function setErrorOutput(OutputInterface $error): void;
public function section(): ConsoleSectionOutput;
| terface extend | {
"filepath": "src/Symfony/Component/Console/Output/ConsoleOutputInterface.php",
"language": "php",
"file_size": 785,
"cut_index": 512,
"middle_length": 14
} |
ponent\Console\Terminal;
/**
* @author Pierre du Plessis <pdples@gmail.com>
* @author Gabriel Ostrolucký <gabriel.ostrolucky@gmail.com>
*/
class ConsoleSectionOutput extends StreamOutput
{
private array $content = [];
private int $lines = 0;
private array $sections;
private Terminal $terminal;
p... | s;
$this->terminal = new Terminal();
}
/**
* Defines a maximum number of lines for this section.
*
* When more lines are added, the section will automatically scroll to the
* end (i.e. remove the first lines to comply w | s, int $verbosity, bool $decorated, OutputFormatterInterface $formatter)
{
parent::__construct($stream, $verbosity, $decorated, $formatter);
array_unshift($sections, $this);
$this->sections = &$section | {
"filepath": "src/Symfony/Component/Console/Output/ConsoleSectionOutput.php",
"language": "php",
"file_size": 9264,
"cut_index": 921,
"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\Output;
use Symfony\Component\Console\Formatter\NullOutputFormatter;
u... | // do nothing
}
public function getFormatter(): OutputFormatterInterface
{
// to comply with the interface we must return a OutputFormatterInterface
return $this->formatter ??= new NullOutputFormatter();
}
publi | com>
* @author Tobias Schultze <http://tobion.de>
*/
class NullOutput implements OutputInterface
{
private NullOutputFormatter $formatter;
public function setFormatter(OutputFormatterInterface $formatter): void
{
| {
"filepath": "src/Symfony/Component/Console/Output/NullOutput.php",
"language": "php",
"file_size": 2006,
"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\Output;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
/**
* Base cla... | e int $verbosity;
private OutputFormatterInterface $formatter;
/**
* @param int|null $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
* @param bool $decorate | t)
* * debug: -vvv (all debug output)
* * quiet: -q (only output errors)
* * silent: --silent (no output)
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class Output implements OutputInterface
{
privat | {
"filepath": "src/Symfony/Component/Console/Output/Output.php",
"language": "php",
"file_size": 4281,
"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\Output;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
/**
* OutputInterfac... | public const OUTPUT_RAW = 2;
public const OUTPUT_PLAIN = 4;
/**
* Writes a message to the output.
*
* @param bool $newline Whether to add a newline
* @param int-mask-of<self::OUTPUT_ | t VERBOSITY_QUIET = 16;
public const VERBOSITY_NORMAL = 32;
public const VERBOSITY_VERBOSE = 64;
public const VERBOSITY_VERY_VERBOSE = 128;
public const VERBOSITY_DEBUG = 256;
public const OUTPUT_NORMAL = 1;
| {
"filepath": "src/Symfony/Component/Console/Output/OutputInterface.php",
"language": "php",
"file_size": 3018,
"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\Output;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
/**
*... | /**
* @param resource $stream A stream resource
* @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
* @param bool|null $decora | file:
*
* $output = new StreamOutput(fopen('/path/to/output.log', 'a', false));
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class StreamOutput extends Output
{
/** @var resource */
private $stream;
| {
"filepath": "src/Symfony/Component/Console/Output/StreamOutput.php",
"language": "php",
"file_size": 4204,
"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\Output;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Con... | t $errorOutput;
private OutputFormatterInterface $formatter;
/**
* @param OutputInterface::VERBOSITY_* $verbosity
*/
public function __construct(
private bool $decorated,
private int $verbosity,
?OutputFormatt | mplements ConsoleOutputInterface
{
private OutputInterface $innerOutput;
private OutputInterface $innerErrorOutput;
private OutputInterface $displayOutput;
private CombinedOutput $output;
private CombinedOutpu | {
"filepath": "src/Symfony/Component/Console/Output/TestOutput.php",
"language": "php",
"file_size": 4829,
"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\Output;
use Symfony\Component\Console\Exception\InvalidArgumentExcepti... | terface $formatter = null)
{
if ($maxLength <= 0) {
throw new InvalidArgumentException(\sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
}
parent::__construct($verbosity, $d | mmedBufferOutput extends Output
{
private int $maxLength;
private string $buffer = '';
public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterIn | {
"filepath": "src/Symfony/Component/Console/Output/TrimmedBufferOutput.php",
"language": "php",
"file_size": 1553,
"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\JsonStreamer;
use PHPStan\PhpDocParser\Parser\PhpDocParser;
use Psr\Container\ContainerInterface;
use Symfony\Component\Config\ConfigCacheFactoryInterface;... | mfony\Component\JsonStreamer\Read\StreamReaderGenerator;
use Symfony\Component\JsonStreamer\Transformer\DateIntervalValueObjectTransformer;
use Symfony\Component\JsonStreamer\Transformer\DateTimeValueObjectTransformer;
use Symfony\Component\JsonStreamer\Tr | pertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\Mapping\Read\AttributePropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Read\Instantiator;
use Symfony\Component\JsonStreamer\Read\LazyInstantiator;
use Sy | {
"filepath": "src/Symfony/Component/JsonStreamer/JsonStreamReader.php",
"language": "php",
"file_size": 4838,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonStreamer;
use PHPStan\PhpDocParser\Parser\PhpDocParser;
use Psr\Container\ContainerInterface;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\JsonStreamer\Mapping\GenericTypePropertyMetadataLoader;
use Symfony\Component\J... | neValueObjectTransformer;
use Symfony\Component\JsonStreamer\Transformer\PropertyValueTransformerInterface;
use Symfony\Component\JsonStreamer\Transformer\ValueObjectTransformerInterface;
use Symfony\Component\JsonStreamer\Write\StreamWriterGenerator;
use | taLoader;
use Symfony\Component\JsonStreamer\Transformer\DateIntervalValueObjectTransformer;
use Symfony\Component\JsonStreamer\Transformer\DateTimeValueObjectTransformer;
use Symfony\Component\JsonStreamer\Transformer\DateTimeZo | {
"filepath": "src/Symfony/Component/JsonStreamer/JsonStreamWriter.php",
"language": "php",
"file_size": 5237,
"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\JsonStreamer;
/**
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @... | merIdCache[$className];
}
if ($this->transformers->has($className)) {
return $this->valueObjectTransformerIdCache[$className] = $className;
}
$reflection = new \ReflectionClass($className);
if (($parent | className
*/
private function getValueObjectTransformerId(string $className): ?string
{
if (\array_key_exists($className, $this->valueObjectTransformerIdCache)) {
return $this->valueObjectTransfor | {
"filepath": "src/Symfony/Component/JsonStreamer/PhpGeneratorTrait.php",
"language": "php",
"file_size": 1746,
"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\JsonStreamer;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\Config\ConfigCacheInterface;
use Symfony\Component\Config\Res... | = null;
public function __construct(
private PropertyMetadataLoaderInterface $propertyMetadataLoader,
private string $cacheDir,
private ?ConfigCacheFactoryInterface $cacheFactory = null,
) {
}
/**
* Dumps the | Symfony\Component\TypeInfo\Type\GenericType;
use Symfony\Component\TypeInfo\Type\ObjectType;
/**
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @internal
*/
final class StreamerDumper
{
private ?Filesystem $fs | {
"filepath": "src/Symfony/Component/JsonStreamer/StreamerDumper.php",
"language": "php",
"file_size": 3469,
"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\JsonStreamer\Read;
use Symfony\Component\JsonStreamer\Exception\R... | ON_ERROR);
} catch (\JsonException $e) {
throw new UnexpectedValueException('JSON is not valid: '.$e->getMessage());
}
}
/**
* @param resource $stream
*/
public static function decodeStream($stream, int $o | ud <mathias.arlaud@gmail.com>
*
* @internal
*/
final class Decoder
{
public static function decodeString(string $json): mixed
{
try {
return json_decode($json, associative: true, flags: \JSON_THROW_ | {
"filepath": "src/Symfony/Component/JsonStreamer/Read/Decoder.php",
"language": "php",
"file_size": 1280,
"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\JsonStreamer\Read;
use Symfony\Component\JsonStreamer\Excep... |
* @param array<string, mixed> $properties
*
* @return T
*/
public function instantiate(string $className, array $properties): object
{
$object = new $className();
foreach ($properties as $name => $value) {
| e related properties must be public.
*
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @internal
*/
final class Instantiator
{
/**
* @template T of object
*
* @param class-string<T> $className | {
"filepath": "src/Symfony/Component/JsonStreamer/Read/Instantiator.php",
"language": "php",
"file_size": 1239,
"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\JsonStreamer\Read;
use Symfony\Component\JsonStreamer\Exception\RuntimeExcepti... |
/**
* @template T of object
*
* @param class-string<T> $className
* @param callable(T): void $initializer
*
* @return T
*/
public function instantiate(string $className, callable $initializer): object
{
| ud@gmail.com>
*
* @internal
*/
final class LazyInstantiator
{
/**
* @var array{reflection: array<class-string, \ReflectionClass<object>>}
*/
private static array $cache = [
'reflection' => [],
];
| {
"filepath": "src/Symfony/Component/JsonStreamer/Read/LazyInstantiator.php",
"language": "php",
"file_size": 1542,
"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\Console\ArgumentResolver\ValueResolver;
use Psr\Container\ContainerInterface;
use Symfony\Component\Cons... | gmail.com>
*/
final class ServiceValueResolver implements ValueResolverInterface
{
public function __construct(
private readonly ContainerInterface $container,
) {
}
public function resolve(string $argumentName, InputInterface $in | ony\Component\DependencyInjection\Exception\RuntimeException;
/**
* Yields a service from a service locator keyed by command and argument name.
*
* @author Nicolas Grekas <p@tchwork.com>
* @author Robin Chalas <robin.chalas@ | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ValueResolver/ServiceValueResolver.php",
"language": "php",
"file_size": 2965,
"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\Input;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;
/**
* InputInt... | t parameters
* before they have been validated. It must be used carefully.
* Does not necessarily return the correct result for short options
* when multiple flags are combined in the same option.
*
* @param string|array $values | raw parameters (not parsed).
*/
public function getFirstArgument(): ?string;
/**
* Returns true if the raw parameters (not parsed) contain a value.
*
* This method is to be used to introspect the inpu | {
"filepath": "src/Symfony/Component/Console/Input/InputInterface.php",
"language": "php",
"file_size": 4540,
"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\Input;
/**
* Provides access to the original input arguments and options
* before they are mer... | ;
/**
* Returns all the given options NOT merged with the default values.
*
* @return array<string|bool|int|float|array<string|bool|int|float|null>|null>
*/
public function getRawOptions(): array;
/**
* Returns a stri | e
{
/**
* Returns all the given arguments NOT merged with the default values.
*
* @return array<string|bool|int|float|array<string|bool|int|float|null>|null>
*/
public function getRawArguments(): array | {
"filepath": "src/Symfony/Component/Console/Input/RawInputInterface.php",
"language": "php",
"file_size": 2090,
"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\Input;
use Symfony\Component\Console\Exception\InvalidArgumentException;
/**
* StringInput rep... | ng representing the parameters from the CLI
*/
public function __construct(string $input)
{
parent::__construct([]);
$this->setTokens($this->tokenize($input));
}
/**
* Tokenizes a string.
*
* @return li | ArgvInput
{
public const REGEX_UNQUOTED_STRING = '([^\s\\\\]+?)';
public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
/**
* @param string $input A stri | {
"filepath": "src/Symfony/Component/Console/Input/StringInput.php",
"language": "php",
"file_size": 2651,
"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\CI;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Utility class for Github actions.
*
* @author Maxime Steinhausser <maxime.stein... | re/src/command.ts#L87-L94
*/
private const ESCAPED_PROPERTIES = [
'%' => '%25',
"\r" => '%0D',
"\n" => '%0A',
':' => '%3A',
',' => '%2C',
];
public function __construct(
private OutputInterf | */
private const ESCAPED_DATA = [
'%' => '%25',
"\r" => '%0D',
"\n" => '%0A',
];
/**
* @see https://github.com/actions/toolkit/blob/5e5e1b7aacba68a53836a34db4a288c3c1c1585b/packages/co | {
"filepath": "src/Symfony/Component/Console/CI/GithubActionReporter.php",
"language": "php",
"file_size": 3113,
"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\Completion;
use Symfony\Component\Console\Input\InputOption;
/**
* Stores all completion sugge... | $value instanceof Suggestion ? new Suggestion($value) : $value;
return $this;
}
/**
* Add multiple suggested values at once for an input option or argument.
*
* @param list<string|Suggestion> $values
*
* @return $ | tions = [];
/**
* Add a suggested value for an input option or argument.
*
* @return $this
*/
public function suggestValue(string|Suggestion $value): static
{
$this->valueSuggestions[] = ! | {
"filepath": "src/Symfony/Component/Console/Completion/CompletionSuggestions.php",
"language": "php",
"file_size": 2118,
"cut_index": 563,
"middle_length": 229
} |
p
/*
* 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\Completion;
/**
* Represents a single suggested ... | public function getValue(): string
{
return $this->value;
}
public function getDescription(): string
{
return $this->description;
}
public function __toString(): string
{
return $this->getValue();
| eadonly string $description = '',
) {
}
| {
"filepath": "src/Symfony/Component/Console/Completion/Suggestion.php",
"language": "php",
"file_size": 828,
"cut_index": 516,
"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\Console\Completion\Output;
use Symfony\Component\Console\Completi... | lue().($value->getDescription() ? "\t".$value->getDescription() : '');
}
foreach ($suggestions->getOptionSuggestions() as $option) {
$values[] = '--'.$option->getName().($option->getDescription() ? "\t".$option->getDescription() | ce
{
public function write(CompletionSuggestions $suggestions, OutputInterface $output): void
{
$values = [];
foreach ($suggestions->getValueSuggestions() as $value) {
$values[] = $value->getVa | {
"filepath": "src/Symfony/Component/Console/Completion/Output/ZshCompletionOutput.php",
"language": "php",
"file_size": 1266,
"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\Terminal\Image;
/**
* Handles the Kitty Graphics Protocol for terminal image paste/display.
*
* The Kitty Graphics Protocol uses Application Pro... | x1b_G";
public const ST = "\x1b\\";
public function detectPastedImage(string $data): bool
{
return str_contains($data, self::APC_START);
}
public function decode(string $data): array
{
if (false === $start = strpos | @see https://sw.kovidgoyal.net/kitty/graphics-protocol/
*
* @author Robin Chalas <robin.chalas@gmail.com>
*
* @internal
*/
final class KittyGraphicsProtocol implements ImageProtocolInterface
{
public const APC_START = "\ | {
"filepath": "src/Symfony/Component/Console/Terminal/Image/KittyGraphicsProtocol.php",
"language": "php",
"file_size": 4014,
"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\Messenger;
use Symfony\Component\Console\Exception\RunCommandFailedException;
/**
* @author Kevin Bond <kevinbond@gmail.com>
*/
class Ru... | */
public function __construct(
public readonly string $input,
public readonly bool $throwOnFailure = true,
public readonly bool $catchExceptions = false,
) {
}
public function __toString(): string
{
re | ceptions @see Application::setCatchExceptions()
| {
"filepath": "src/Symfony/Component/Console/Messenger/RunCommandMessage.php",
"language": "php",
"file_size": 941,
"cut_index": 606,
"middle_length": 52
} |
?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\ArgumentResolver;
use Symfony\Component\Consol... | mand after resolution.
*
* @throws \RuntimeException When no value could be provided for a required argument
* @throws ResolverNotFoundException
*/
public function getArguments(InputInterface $input, callable $command, ?\Ref | Chalas <robin.chalas@gmail.com>
* @author Fabien Potencier <fabien@symfony.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
interface ArgumentResolverInterface
{
/**
* Returns the arguments to pass to the Console Com | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ArgumentResolverInterface.php",
"language": "php",
"file_size": 1051,
"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\ArgumentResolver;
use Symfony\Component\Conso... | onFunctionAbstract $reflector = null): array
{
$e = $this->stopwatch->start('command.get_arguments');
try {
return $this->resolver->getArguments($input, $command, $reflector);
} finally {
$e->stop();
| ce
{
public function __construct(
private ArgumentResolverInterface $resolver,
private Stopwatch $stopwatch,
) {
}
public function getArguments(InputInterface $input, callable $command, ?\Reflecti | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/TraceableArgumentResolver.php",
"language": "php",
"file_size": 1012,
"cut_index": 512,
"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\ArgumentResolver\ValueResolver;
use Symfony\Component\Console\Attribute\Argument;
use Symfony\Co... | public function resolve(string $argumentName, InputInterface $input, ReflectionMember $member): iterable
{
if ($member->isVariadic()) {
return [];
}
if ($argument = Argument::tryFrom($member->getMember())) {
| nt] or #[Option] attributes for built-in PHP types.
*
* Handles: string, bool, int, float, array
*
* @author Robin Chalas <robin.chalas@gmail.com>
*/
final class BuiltinTypeValueResolver implements ValueResolverInterface
{
| {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ValueResolver/BuiltinTypeValueResolver.php",
"language": "php",
"file_size": 2133,
"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\ArgumentResolver\ValueResolver;
use Symfony\Component\Console\Attribut... | rface $input, ReflectionMember $member): iterable
{
$type = $member->getType();
if (!$type instanceof \ReflectionNamedType || InputFile::class !== $type->getName()) {
return [];
}
if ($argument = Argument:: | \Component\Console\Input\InputInterface;
/**
* @author Robin Chalas <robin.chalas@gmail.com>
*/
final class InputFileValueResolver implements ValueResolverInterface
{
public function resolve(string $argumentName, InputInte | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ValueResolver/InputFileValueResolver.php",
"language": "php",
"file_size": 1707,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Console\ArgumentResolver;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\ArgumentResolver\Exception\NearMissValueResolverException;
use Symfony\Component\Console\ArgumentResolver\Exception\ResolverNotFoundException;
use Symfony\Componen... | omponent\Console\Cursor;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\RawInputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contract | Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Attribute\ValueResolver;
use Symfony\Component\Console\Command\Command;
use Symfony\C | {
"filepath": "src/Symfony/Component/Console/ArgumentResolver/ArgumentResolver.php",
"language": "php",
"file_size": 6777,
"cut_index": 716,
"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\JsonStreamer\Mapping\Write;
use Symfony\Component\JsonSt... | implements PropertyMetadataLoaderInterface
{
public function __construct(
private PropertyMetadataLoaderInterface $decorated,
) {
}
public function load(string $className, array $options = [], array $context = []): array
{
| rtyMetadataLoader::class);
/**
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @deprecated since Symfony 8.1, Date times are handled as value objects
*
* @internal
*/
final class DateTimeTypePropertyMetadataLoader | {
"filepath": "src/Symfony/Component/JsonStreamer/Mapping/Write/DateTimeTypePropertyMetadataLoader.php",
"language": "php",
"file_size": 1075,
"cut_index": 515,
"middle_length": 229
} |
er\Exception\NotEncodableValueException;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Exception\UnexpectedValueException;
use Symfony\Component\JsonStreamer\PhpGeneratorTrait;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\Type\Nullab... | ct(
private ContainerInterface $transformers,
) {
}
/**
* @param array<string, mixed> $options
* @param array<string, mixed> $context
*/
public function generate(DataModelNodeInterface $dataModel, array $options = [] | t writes data to JSON stream.
*
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @internal
*/
final class PhpGenerator
{
use PhpGeneratorTrait;
private string $yieldBuffer = '';
public function __constru | {
"filepath": "src/Symfony/Component/JsonStreamer/Write/PhpGenerator.php",
"language": "php",
"file_size": 18886,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonStreamer\Write;
use Psr\Container\ContainerInterface;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\JsonStreamer\DataModel\Write\BackedEnumNode;
use Symfony\Component\JsonStreamer\DataModel\Write\CollectionNode;
use Sym... | mer\Mapping\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\StreamerDumper;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BackedEnumType;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\ | ode;
use Symfony\Component\JsonStreamer\DataModel\Write\ScalarNode;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Exception\UnsupportedException;
use Symfony\Component\JsonStrea | {
"filepath": "src/Symfony/Component/JsonStreamer/Write/StreamWriterGenerator.php",
"language": "php",
"file_size": 7180,
"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\JsonStreamer\ValueTransformer;
use Symfony\Component\JsonStreamer\Exception\In... | eTimeValueObjectTransformer::class);
/**
* Transforms DateTimeInterface to string during stream writing.
*
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @deprecated since Symfony 8.1, date times will be transformed thanks to DateTimeValueOb | Symfony\Component\TypeInfo\TypeIdentifier;
trigger_deprecation('symfony/json-streamer', '8.1', 'The "%s" class is deprecated. Date times will be transformed thanks to "%s" instead.', DateTimeToStringValueTransformer::class, Dat | {
"filepath": "src/Symfony/Component/JsonStreamer/ValueTransformer/DateTimeToStringValueTransformer.php",
"language": "php",
"file_size": 1707,
"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\JsonStreamer\ValueTransformer;
use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Transformer\DateTi... | utable during stream reading.
*
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @deprecated since Symfony 8.1, date times will be transformed thanks to DateTimeValueObjectTransformer instead
*/
final class StringToDateTimeValueTransformer impl | n-streamer', '8.1', 'The "%s" class is deprecated. Date times will be transformed thanks to "%s" instead.', StringToDateTimeValueTransformer::class, DateTimeValueObjectTransformer::class);
/**
* Transforms string to DateTimeImm | {
"filepath": "src/Symfony/Component/JsonStreamer/ValueTransformer/StringToDateTimeValueTransformer.php",
"language": "php",
"file_size": 3115,
"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\JsonStreamer\ValueTransformer;
use Symfony\Component\JsonStreamer\Transformer\PropertyValueTransformerInterface;
trigger_deprecation('symfony/json... | or Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @deprecated since Symfony 8.1, use Symfony\Component\JsonStreamer\Transformer\PropertyValueTransformerInterface instead
*/
interface ValueTransformerInterface extends PropertyValueTransformerInterface
{
} | stream writing and after stream reading.
*
* @auth | {
"filepath": "src/Symfony/Component/JsonStreamer/ValueTransformer/ValueTransformerInterface.php",
"language": "php",
"file_size": 915,
"cut_index": 606,
"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\JsonStreamer\CacheWarmer;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Config\ConfigCac... | ers and stream writers PHP files.
*
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @internal
*/
final class StreamerCacheWarmer implements CacheWarmerInterface
{
private StreamWriterGenerator $streamWriterGenerator;
private StreamRead | ng\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\Read\StreamReaderGenerator;
use Symfony\Component\JsonStreamer\Write\StreamWriterGenerator;
use Symfony\Component\TypeInfo\Type;
/**
* Generates stream read | {
"filepath": "src/Symfony/Component/JsonStreamer/CacheWarmer/StreamerCacheWarmer.php",
"language": "php",
"file_size": 4050,
"cut_index": 614,
"middle_length": 229
} |
onStreamReader;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Mapping\SyntheticPropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateIn... | ponent\JsonStreamer\Tests\Fixtures\Model\DummyWithPhpDoc;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithSyntheticProperties;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithValueObjects;
use Symfony\Component\JsonStreame | treamer\Tests\Fixtures\Model\DummyWithGenerics;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNullableProperties;
use Symfony\Com | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/JsonStreamReaderTest.php",
"language": "php",
"file_size": 13186,
"cut_index": 921,
"middle_length": 229
} |
Fixtures\Model\DummyWithArray;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateIntervals;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateTimes;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateTimeZones;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Mod... | s;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedList;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedListDummies;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNullableProperties;
use Sym | \Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedArray;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedDictDummie | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/JsonStreamWriterTest.php",
"language": "php",
"file_size": 22630,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonStreamer\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\ConfigCacheFactory;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Mapping... | Fixtures\Model\DummyWithOtherDummies;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithRepeatedOtherDummy;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\SelfReferencingDummy;
use Symfony\Component\TypeInfo\Type;
use Symfony\Compon | Tests\Fixtures\Model\ClassicDummy;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithArray;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes;
use Symfony\Component\JsonStreamer\Tests\ | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/StreamerDumperTest.php",
"language": "php",
"file_size": 5570,
"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\JsonStreamer\Tests\Read;
use PHPUnit\Framework\TestCase;
use Symfony\Component... | is->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('JSON is not valid: Syntax error');
Decoder::decodeString('foo"');
}
public function testDecodeThrowOnInvalidJsonStream()
{
$this->exp | ssertDecoded('foo', '"foo"');
}
public function testDecodeSubset()
{
$this->assertDecoded('bar', '["foo","bar","baz"]', 7, 5);
}
public function testDecodeThrowOnInvalidJsonString()
{
$th | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Read/DecoderTest.php",
"language": "php",
"file_size": 1766,
"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\JsonStreamer\Tests\Read;
use PHPUnit\Framework\TestCase;
use Symf... | > 100,
'name' => 'dummy',
];
$this->assertEquals($expected, (new Instantiator())->instantiate(ClassicDummy::class, $properties));
}
public function testThrowOnInvalidProperty()
{
$this->expectException(Unex | s InstantiatorTest extends TestCase
{
public function testInstantiate()
{
$expected = new ClassicDummy();
$expected->id = 100;
$expected->name = 'dummy';
$properties = [
'id' = | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Read/InstantiatorTest.php",
"language": "php",
"file_size": 1287,
"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\JsonStreamer\Tests\Read;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\... | lic function testInstantiateInternalClassEagerly()
{
$object = (new LazyInstantiator())->instantiate(\DateTimeImmutable::class, static function (\DateTimeImmutable $object): void {
});
$this->assertInstanceOf(\DateTimeImmutable | {
$ghost = (new LazyInstantiator())->instantiate(ClassicDummy::class, static function (ClassicDummy $object): void {
$object->id = 123;
});
$this->assertSame(123, $ghost->id);
}
pub | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Read/LazyInstantiatorTest.php",
"language": "php",
"file_size": 3439,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonStreamer\Tests\Read;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidStreamException;
use Symfony\Component\JsonStreamer\Read\Lexer;
class LexerTest extends TestCase
{
... | ['10', 2], [',', 4], ['20', 6], [']', 9]], '[ 10, 20 ]');
$this->assertTokens([['[', 0], ['1', 1], [',', 2], ['[', 4], ['2', 5], [']', 6], [']', 8]], '[1, [2] ]');
$this->assertTokens([['{', 0], ['}', 1]], '{}');
$this->assertToken | alse', 0]], 'false');
$this->assertTokens([['null', 0]], 'null');
$this->assertTokens([['"string"', 0]], '"string"');
$this->assertTokens([['[', 0], [']', 1]], '[]');
$this->assertTokens([['[', 0], | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Read/LexerTest.php",
"language": "php",
"file_size": 6309,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonStreamer\Tests\Read;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidStreamException;
use Symfony\Component\JsonStreamer\Read\Splitter;
class SplitterTest extends TestCa... | , '[1,[2,3]]');
$this->assertListBoundaries([[1, 1], [3, 7]], '[1,{"2":3}]');
}
public function testSplitDict()
{
$this->assertDictBoundaries([], '{}');
$this->assertDictBoundaries(['k' => [5, 2]], '{"k":10}');
| {
$this->assertListBoundaries([], '[]');
$this->assertListBoundaries([[1, 3]], '[100]');
$this->assertListBoundaries([[1, 3], [5, 3]], '[100,200]');
$this->assertListBoundaries([[1, 1], [3, 5]] | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Read/SplitterTest.php",
"language": "php",
"file_size": 5271,
"cut_index": 716,
"middle_length": 229
} |
eption\LogicException;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Exception\UnsupportedException;
use Symfony\Component\JsonStreamer\Mapping\GenericTypePropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadata;
use Symfony\Component\JsonSt... | onStreamer\Tests\Fixtures\Mapping\SyntheticPropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateTimes;
use Symfony\Component\JsonStreamer\Tests\Fi | er;
use Symfony\Component\JsonStreamer\Read\StreamReaderGenerator;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyEnum;
use Symfony\Component\Js | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Read/StreamReaderGeneratorTest.php",
"language": "php",
"file_size": 12699,
"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\JsonStreamer\Tests\Attribute;
use PHPUnit\Framework\T... | nnotCreateWithoutAnything()
{
$this->expectException(LogicException::class);
$this->expectExceptionMessage('#[ValueTransformer] attribute must declare either $streamToNative or $nativeToStream.');
new ValueTransformer();
}
| unction testCa | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Attribute/ValueTransformerTest.php",
"language": "php",
"file_size": 784,
"cut_index": 512,
"middle_length": 14
} |
buted with this source code.
*/
namespace Symfony\Component\JsonStreamer\Tests\Transformer;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Transformer\DateIntervalValueObjectTrans... | rval('P2Y6M1DT12H30M5S')),
);
$this->assertSame(
'2 years',
$transformer->transform(new \DateInterval('P2Y'), [DateIntervalValueObjectTransformer::FORMAT_KEY => '%y years']),
);
}
public function te | is->assertSame(
'P0Y0M0DT0H0M0S',
$transformer->transform(new \DateInterval('P0Y')),
);
$this->assertSame(
'P2Y6M1DT12H30M5S',
$transformer->transform(new \DateInte | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Transformer/DateIntervalValueObjectTransformerTest.php",
"language": "php",
"file_size": 6233,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonStreamer\Tests\Transformer;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Transformer\DateTimeValueObjectTransformer;
class DateTimeValueObjectTransformerTest e... | mutable('2023-07-26', new \DateTimeZone('UTC')))->setTime(0, 0), [DateTimeValueObjectTransformer::FORMAT_KEY => 'd/m/Y H:i:s']),
);
}
public function testTransformWithTimezone()
{
$transformer = new DateTimeValueObjectTransform | $transformer->transform(new \DateTimeImmutable('2023-07-26', new \DateTimeZone('UTC')), []),
);
$this->assertSame(
'26/07/2023 00:00:00',
$transformer->transform((new \DateTimeIm | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Transformer/DateTimeValueObjectTransformerTest.php",
"language": "php",
"file_size": 5565,
"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\JsonStreamer\Tests\Transformer;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Excep... | mer->transform(new \DateTimeZone('Asia/Tokyo')));
$this->assertSame('Europe/Paris', $transformer->transform(new \DateTimeZone('Europe/Paris')));
}
public function testTransformThrowWhenInvalidNativeValue()
{
$this->expectExcept | nction testTransform()
{
$transformer = new DateTimeZoneValueObjectTransformer();
$this->assertSame('UTC', $transformer->transform(new \DateTimeZone('UTC')));
$this->assertSame('Asia/Tokyo', $transfor | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Transformer/DateTimeZoneValueObjectTransformerTest.php",
"language": "php",
"file_size": 2259,
"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\JsonStreamer\Tests\Fixtures\Transformer;
use Symfony\Compon... | $options = []): int|float|string|bool|null
{
return $object->value.' '.$object->unit;
}
public function reverseTransform(int|float|string|bool|null $scalar, array $options = []): object
{
return new Height(...explode(' ', | ypeInfo\Type\BuiltinType;
/**
* @implements ValueObjectTransformerInterface<Height, string>
*/
class HeightValueObjectTransformer implements ValueObjectTransformerInterface
{
public function transform(object $object, array | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Fixtures/Transformer/HeightValueObjectTransformer.php",
"language": "php",
"file_size": 1231,
"cut_index": 518,
"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\JsonStreamer\Tests\Fixtures\Transformer;
use Symfony\Component\Js... | er implements ValueObjectTransformerInterface
{
public function transform(object $object, array $options = []): int|float|string|bool|null
{
throw new \BadMethodCallException('Not implemented.');
}
public function reverseTransform( | omponent\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\TypeIdentifier;
/**
* @implements ValueObjectTransformerInterface<DummyWithValueObjectAndUnion, mixed>
*/
final class UnsupportedStreamValueTypeObjectTransform | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Fixtures/Transformer/UnsupportedStreamValueTypeObjectTransformer.php",
"language": "php",
"file_size": 1447,
"cut_index": 524,
"middle_length": 229
} |
ic function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
$providers['array{\'id\': int, \'name\': string}'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$p... | h ($data as $k => $v) {
yield $k => \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]);
}
};
return \iterator_to_array($iterable($stream, $data));
};
return $providers['arra | rs, $instantiator, &$providers) {
foreac | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Fixtures/stream_reader/array_shape.stream.php",
"language": "php",
"file_size": 947,
"cut_index": 582,
"middle_length": 52
} |
mixed>
*/
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
$providers['array<string, mixed>'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiat... | foreach ($data as $k => $v) {
yield $k => \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]);
}
};
return \iterator_to_array($iterable($stream, $data));
};
return $provider | nsformers, $instantiator, &$providers) {
| {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Fixtures/stream_reader/dict.stream.php",
"language": "php",
"file_size": 903,
"cut_index": 547,
"middle_length": 52
} |
terable
*/
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
$providers['iterable'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$provid... | ata as $k => $v) {
yield $k => \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]);
}
};
return $iterable($stream, $data);
};
return $providers['iterable']($stream, 0, null); | instantiator, &$providers) {
foreach ($d | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Fixtures/stream_reader/iterable.stream.php",
"language": "php",
"file_size": 847,
"cut_index": 535,
"middle_length": 52
} |
atic function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
$providers['list<mixed>'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
$da... |
yield $k => \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]);
}
};
return \iterator_to_array($iterable($stream, $data));
};
return $providers['list<mixed>']($stream, 0, n | oviders) {
foreach ($data as $k => $v) { | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Fixtures/stream_reader/list.stream.php",
"language": "php",
"file_size": 876,
"cut_index": 559,
"middle_length": 52
} |
* @return Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum|null
*/
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
$providers['Symfony\\Component\\JsonStr... | ['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum']($data);
}
if (null === $data) {
return null;
}
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('U | rs['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum|null'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
if (\is_int($data)) {
return $providers | {
"filepath": "src/Symfony/Component/JsonStreamer/Tests/Fixtures/stream_reader/nullable_backed_enum.php",
"language": "php",
"file_size": 1341,
"cut_index": 524,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.