prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony... | ->useAttributeAsKey('class')
->prototype('array')
->beforeNormalization()->ifString()->then(static fn ($v) => ['algorithm' => $v])->end()
->children()
| $tb = new TreeBuilder('root_name', 'array');
$tree = $tb
->getRootNode()
->fixXmlConfig('encoder')
->children()
->node('encoders', 'array')
| {
"filepath": "src/Symfony/Component/Config/Tests/Definition/NormalizationTest.php",
"language": "php",
"file_size": 6825,
"cut_index": 716,
"middle_length": 229
} |
n\ArrayNode;
use Symfony\Component\Config\Definition\PrototypedArrayNode;
use Symfony\Component\Config\Definition\ScalarNode;
use Symfony\Component\Config\Definition\VariableNode;
class PrototypedArrayNodeTest extends TestCase
{
public function testGetDefaultValueReturnsAnEmptyArrayForPrototypes()
{
$n... | node->setDefaultValue(['test']);
$this->assertEquals(['test'], $node->getDefaultValue());
}
// a remapped key (e.g. "mapping" -> "mappings") should be unset after being used
public function testRemappedKeysAreUnset()
{
$nod |
public function testGetDefaultValueReturnsDefaultValueForPrototypes()
{
$node = new PrototypedArrayNode('root');
$prototype = new ArrayNode(null, $node);
$node->setPrototype($prototype);
$ | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php",
"language": "php",
"file_size": 13102,
"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\BrowserKit\Tests;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\BrowserKit\History;
... | null)
{
$client = new MockHttpClient(function (string $method, string $url, array $options) {
if (null === $this->nextResponse) {
return new MockResponse();
}
return new MockResponse($this->n | ;
class TestHttpClient extends HttpBrowser
{
protected ?Response $nextResponse = null;
protected string $nextScript;
public function __construct(array $server = [], ?History $history = null, ?CookieJar $cookieJar = | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php",
"language": "php",
"file_size": 2239,
"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\BrowserKit\Tests\Test\Constraint;
use PHPUnit\Framework\ExpectationFailedExcep... | ValueSame('foo', 'bar', false, '/path');
$this->assertTrue($constraint->evaluate($browser, '', true));
$constraint = new BrowserCookieValueSame('foo', 'bar', true, '/path');
$this->assertTrue($constraint->evaluate($browser, '', true | nt\BrowserKit\Test\Constraint\BrowserCookieValueSame;
class BrowserCookieValueSameTest extends TestCase
{
public function testConstraint()
{
$browser = $this->getBrowser();
$constraint = new BrowserCookie | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/Test/Constraint/BrowserCookieValueSameTest.php",
"language": "php",
"file_size": 1747,
"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\BrowserKit\Tests\Test\Constraint;
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framewor... | sertTrue($constraint->evaluate($browser, '', true));
$constraint = new BrowserHasCookie('foo', '/path', 'example.com');
$this->assertTrue($constraint->evaluate($browser, '', true));
$constraint = new BrowserHasCookie('bar');
| int\BrowserHasCookie;
class BrowserHasCookieTest extends TestCase
{
public function testConstraint()
{
$browser = $this->getBrowser();
$constraint = new BrowserHasCookie('foo', '/path');
$this->as | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/Test/Constraint/BrowserHasCookieTest.php",
"language": "php",
"file_size": 2457,
"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\BrowserKit\Test\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use S... | );
if ('/' !== $this->path) {
$str .= \sprintf(' with path "%s"', $this->path);
}
if ($this->domain) {
$str .= \sprintf(' for domain "%s"', $this->domain);
}
$str .= \sprintf(' with %svalue "% | ue,
private bool $raw = false,
private string $path = '/',
private ?string $domain = null,
) {
}
public function toString(): string
{
$str = \sprintf('has cookie "%s"', $this->name | {
"filepath": "src/Symfony/Component/BrowserKit/Test/Constraint/BrowserCookieValueSame.php",
"language": "php",
"file_size": 1634,
"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\BrowserKit\Test\Constraint;
use PHPUnit\Framework\Constraint\Cons... | sprintf(' with path "%s"', $this->path);
}
if ($this->domain) {
$str .= \sprintf(' for domain "%s"', $this->domain);
}
return $str;
}
/**
* @param AbstractBrowser $browser
*/
protected fun | ng $path = '/',
private ?string $domain = null,
) {
}
public function toString(): string
{
$str = \sprintf('has cookie "%s"', $this->name);
if ('/' !== $this->path) {
$str .= \ | {
"filepath": "src/Symfony/Component/BrowserKit/Test/Constraint/BrowserHasCookie.php",
"language": "php",
"file_size": 1326,
"cut_index": 524,
"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\BrowserKit\Test\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\BrowserKit\AbstractBrowser;
final class BrowserHist... | row new \LogicException('Can only test on an AbstractBrowser instance.');
}
return $other->getHistory()->isFirstPage();
}
protected function failureDescription($other): string
{
return 'the Browser history '.$this->toS | !$other instanceof AbstractBrowser) {
th | {
"filepath": "src/Symfony/Component/BrowserKit/Test/Constraint/BrowserHistoryIsOnFirstPage.php",
"language": "php",
"file_size": 931,
"cut_index": 606,
"middle_length": 52
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\BrowserKit\Test\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\BrowserKit\AbstractBrowser;
final class BrowserHist... | w new \LogicException('Can only test on an AbstractBrowser instance.');
}
return $other->getHistory()->isLastPage();
}
protected function failureDescription($other): string
{
return 'the Browser history '.$this->toStri | other instanceof AbstractBrowser) {
thro | {
"filepath": "src/Symfony/Component/BrowserKit/Test/Constraint/BrowserHistoryIsOnLastPage.php",
"language": "php",
"file_size": 928,
"cut_index": 606,
"middle_length": 52
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\JsonPath;
/**
* Declares the return type of a custom Json... | Value = 'value';
/**
* A boolean result usable as a filter expression (e.g. existence tests).
*/
case Logical = 'logical';
/**
* A nodelist (array of matched nodes), not directly comparable.
*/
case Nodes = 'nodes';
}
| e that can be used in comparisons.
*/
case | {
"filepath": "src/Symfony/Component/JsonPath/FunctionReturnType.php",
"language": "php",
"file_size": 825,
"cut_index": 517,
"middle_length": 52
} |
nterface<callable(mixed ...$arguments): mixed>|null $functionsProvider
* @param array<string, array{arity?: int|null, return_type?: FunctionReturnType|null}> $functionsMetadata
*/
public function __construct(
private readonly mixed $raw,
private readonly ?ContainerInterface $funct... | ry);
}
private function evaluate(JsonPath $query): array
{
try {
if ($this->isComplexBracketExpression($query)) {
preg_match('/^\$\[([^\[\]]+)]$/', $query, $matches);
if (\is_resource($json | intf('Expected string or resource, got "%s".', get_debug_type($raw)));
}
}
public function find(string|JsonPath $query): array
{
return $this->evaluate(\is_string($query) ? new JsonPath($query) : $que | {
"filepath": "src/Symfony/Component/JsonPath/JsonCrawler.php",
"language": "php",
"file_size": 42303,
"cut_index": 2151,
"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\JsonPath;
use Symfony\Component\JsonPath\Exception\InvalidArg... | * @throws InvalidArgumentException When the JSON string provided to the crawler cannot be decoded
* @throws JsonCrawlerException When a syntax error occurs in the provided JSON path
*/
public function find(string|JsonPath $query): ar | eturn list<array|string|float|int|bool|null>
*
| {
"filepath": "src/Symfony/Component/JsonPath/JsonCrawlerInterface.php",
"language": "php",
"file_size": 835,
"cut_index": 520,
"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\JsonPath;
/**
* @author Alexandre Daubois <alex.daubois@gmail.com>
*
* @immutable
*/
final class Jso... | }
public function deepScan(): static
{
return new self($this->path.'..');
}
public function all(): static
{
return new self($this->path.'[*]');
}
public function first(): static
{
return new self( | static
{
$escaped = $this->escapeKey($key);
return new self($this->path.'["'.$escaped.'"]');
}
public function index(int $index): static
{
return new self($this->path.'['.$index.']');
| {
"filepath": "src/Symfony/Component/JsonPath/JsonPath.php",
"language": "php",
"file_size": 2206,
"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\JsonPath;
use Psr\Container\ContainerInterface;
use Symf... | eadonly ?ContainerInterface $functionsProvider = null,
private readonly array $functionsMetadata = [],
) {
}
/**
* @param resource|string $raw
*/
public function crawl(mixed $raw): JsonCrawlerInterface
{
retur | xed ...$arguments): mixed>|null $functionsProvider
* @param array<string, array{arity?: int|null, return_type?: FunctionReturnType|null}> $functionsMetadata
*/
public function __construct(
private r | {
"filepath": "src/Symfony/Component/JsonPath/JsonPathCrawler.php",
"language": "php",
"file_size": 1085,
"cut_index": 515,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonPath;
use Symfony\Component\JsonPath\Exception\InvalidArgumentException;
use Symfony\Component\JsonPath\Exception\JsonCrawlerException;
use Symfony\Component\JsonPath\Tokenizer\JsonPathToken;
use Symfony\Component\JsonPath\Tokenizer\TokenType;
use Symfo... | blic static function findSmallestDeserializableStringAndPath(array $tokens, mixed $json): array
{
if (!\is_resource($json)) {
throw new InvalidArgumentException('The JSON parameter must be a resource.');
}
$currentO | is@gmail.com>
*
* @internal
*/
final class JsonPathUtils
{
/**
* @param JsonPathToken[] $tokens
* @param resource $json
*
* @return array{json: string, tokens: list<JsonPathToken>}
*/
pu | {
"filepath": "src/Symfony/Component/JsonPath/JsonPathUtils.php",
"language": "php",
"file_size": 8313,
"cut_index": 716,
"middle_length": 229
} |
TERAL_REGEX = '(true|false|null|\d+(\.\d+)?([eE][+-]?\d+)?|\'[^\']*\'|"[^"]*")';
/**
* @return JsonPathToken[]
*/
public static function tokenize(JsonPath $query): array
{
$tokens = [];
$current = '';
$inBracket = false;
$bracketDepth = 0;
$inFilter = false... | if ($i >= $length || '$' !== $chars[$i]) {
throw new InvalidJsonPathException('expression must start with $.');
}
$rootIndex = $i;
if ($rootIndex + 1 < $length) {
$hasContentAfterRoot = true;
}
| (string) $query);
$length = \count($chars);
if (0 === $length) {
throw new InvalidJsonPathException('empty JSONPath expression.');
}
$i = self::skipWhitespace($chars, 0, $length);
| {
"filepath": "src/Symfony/Component/JsonPath/Tokenizer/JsonPathTokenizer.php",
"language": "php",
"file_size": 22591,
"cut_index": 1331,
"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\JsonPath\Tests;
use Psr\Container\ContainerInterface;
... | throw new \RuntimeException(\sprintf('Unknown custom JSONPath function "%s".', $id));
}
return $this->functions[$id];
}
public function has(string $id): bool
{
return iss | public function __construct(private array $functions)
{
}
public function get(string $id): mixed
{
if (!isset($this->functions[$id])) {
| {
"filepath": "src/Symfony/Component/JsonPath/Tests/FunctionsLocatorTrait.php",
"language": "php",
"file_size": 1058,
"cut_index": 513,
"middle_length": 229
} |
nCrawlerTest extends TestCase
{
use FunctionsLocatorTrait;
public function testNotStringOrResourceThrows()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Expected string or resource, got "int".');
new JsonCrawler(42);
}
public fun... | mixed $value): ?string => \is_string($value) ? strtoupper($value) : null,
]));
$this->assertInstanceOf(JsonPathCrawlerInterface::class, $jsonPathCrawler);
$crawler = $jsonPathCrawler->crawl('{"items": [{"title": "hello"}, {"title" | new JsonCrawler('invalid'))->find('$..*');
}
public function testJsonPathCrawlerCreatesJsonCrawler()
{
$jsonPathCrawler = new JsonPathCrawler($this->createFunctionsLocator([
'upper' => static fn ( | {
"filepath": "src/Symfony/Component/JsonPath/Tests/JsonCrawlerTest.php",
"language": "php",
"file_size": 28049,
"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\JsonPath\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonPath\Exception\JsonCrawlerExceptio... | === $selector) {
$this->markTestSkipped('The JsonPath compliance test suite is not available. Did you run "composer update"?');
}
$jsonCrawler = new JsonCrawler(json_encode($document));
if ($invalidSelector) {
| -compliance-test-suite/cts.json';
#[DataProvider('complianceCaseProvider')]
public function testComplianceTestCase(?string $selector, mixed $document, array $expectedResults, bool $invalidSelector)
{
if (null | {
"filepath": "src/Symfony/Component/JsonPath/Tests/JsonPathComplianceTestSuiteTest.php",
"language": "php",
"file_size": 4678,
"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\JsonPath\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonPath\JsonPath;
class JsonPathTest... | $path = new JsonPath();
$path = $path->key('users')
->filter('@.age > 18');
$this->assertSame('$["users"][?(@.age > 18)]', (string) $path);
}
public function testAll()
{
$path = new JsonPath();
$ | $this->assertSame('$["users"][0]["address"]', (string) $path);
$this->assertSame('$["users"][0]["address"]..["city"]', (string) $path->deepScan()->key('city'));
}
public function testBuildWithFilter()
{
| {
"filepath": "src/Symfony/Component/JsonPath/Tests/JsonPathTest.php",
"language": "php",
"file_size": 3358,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonPath\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonPath\JsonPath;
use Symfony\Component\JsonPath\JsonPathUtils;
use Symfony\Component\JsonPath\Tokenizer\JsonPathToken;
use Symfony\Component\JsonPath\Tokenizer\JsonPathTokenizer;
use Sy... | $resource);
$this->assertSame('{"category": "reference", "author": "Nigel Rees", "title": "Sayings", "price": 8.95}', $reduced['json']);
$this->assertEquals([new JsonPathToken(TokenType::Name, 'title')], $reduced['tokens']);
}
pub | tle');
$resource = self::provideJsonResource();
$reduced = JsonPathUtils::findSmallestDeserializableStringAndPath(
JsonPathTokenizer::tokenize($path),
$resource
);
fclose( | {
"filepath": "src/Symfony/Component/JsonPath/Tests/JsonPathUtilsTest.php",
"language": "php",
"file_size": 6319,
"cut_index": 716,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\JsonPath\Tests\Attribute;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonPath... | me);
}
public function testAttributeTargetsClassesOnly()
{
$reflection = new \ReflectionClass(AsJsonPathFunction::class);
$attribute = $reflection->getAttributes(\Attribute::class)[0]->newInstance();
$this->assertSame( | ;
$this->assertSame('upper', $attribute->na | {
"filepath": "src/Symfony/Component/JsonPath/Tests/Attribute/AsJsonPathFunctionTest.php",
"language": "php",
"file_size": 909,
"cut_index": 547,
"middle_length": 52
} |
ion\InvalidJsonPathException;
use Symfony\Component\JsonPath\JsonPath;
use Symfony\Component\JsonPath\Tokenizer\JsonPathTokenizer;
use Symfony\Component\JsonPath\Tokenizer\TokenType;
class JsonPathTokenizerTest extends TestCase
{
#[DataProvider('simplePathProvider')]
public function testSimplePath(string $path... | implePathProvider(): array
{
return [
'root only' => [
'$',
[],
],
'simple property' => [
'$.store',
[[TokenType::Name, 'store']],
] |
foreach ($tokens as $i => $token) {
$this->assertSame($expectedTokens[$i][0], $token->type);
$this->assertSame($expectedTokens[$i][1], $token->value);
}
}
public static function s | {
"filepath": "src/Symfony/Component/JsonPath/Tests/Tokenizer/JsonPathTokenizerTest.php",
"language": "php",
"file_size": 13886,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonPath\Tests\Functions;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonPath\Exception\JsonCrawlerException;
use Symfony\Component\JsonPath\FunctionReturnType;
use Symfony\Component\JsonPath\JsonCrawler;
use Symfony\Component\JsonPath\Tests\Func... | s->createFunctionsLocator(['upper' => $upperFunction]));
$result = $crawler->find('$.items[?upper(@.title) == "HELLO"]');
$this->assertCount(1, $result);
$this->assertEquals('hello', $result[0]['title']);
}
public function | fn (mixed $value): ?string => \is_string($value) ? strtoupper($value) : null;
$crawler = new JsonCrawler(<<<JSON
{"name": "test", "items": [{"title": "hello"}, {"title": "world"}]}
JSON, $thi | {
"filepath": "src/Symfony/Component/JsonPath/Tests/Functions/CustomFunctionTest.php",
"language": "php",
"file_size": 8096,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\JsonPath\Tests\Test;
use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonPath\Test\JsonPathAssertionsTrait;
class JsonPathAssertionsTraitTest extends TestCase
{
use JsonPathAssertionsTrait;
public ... | lf::assertJsonPathEquals([2], '$.a[2]', self::getSimpleCollectionCrawlerData());
} catch (AssertionFailedError $exception) {
self::assertMatchesRegularExpression('/Failed asserting that .+ equals JSON path "\$\.a\[2]" result./s', $excep | TypeCoercion()
{
self::assertJsonPathEquals(['1'], '$.a[2]', self::getSimpleCollectionCrawlerData());
}
public function testAssertJsonPathEqualsKo()
{
$thrown = false;
try {
se | {
"filepath": "src/Symfony/Component/JsonPath/Tests/Test/JsonPathAssertionsTraitTest.php",
"language": "php",
"file_size": 6245,
"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\JsonPath\Test;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\ExpectationFailedException;
use Symfo... | sage);
}
/**
* @throws ExpectationFailedException
*/
final public static function assertJsonPathNotEquals(mixed $expectedValue, JsonPath|string $jsonPath, string $json, string $message = ''): void
{
Assert::assertThat($ex | al public static function assertJsonPathEquals(mixed $expectedValue, JsonPath|string $jsonPath, string $json, string $message = ''): void
{
Assert::assertThat($expectedValue, new JsonPathEquals($jsonPath, $json), $mes | {
"filepath": "src/Symfony/Component/JsonPath/Test/JsonPathAssertionsTrait.php",
"language": "php",
"file_size": 2729,
"cut_index": 563,
"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\JsonPath\Test;
use PHPUnit\Framework\Constraint\Const... | intf('is found in elements at JSON path "%s"', $this->jsonPath);
}
protected function matches(mixed $other): bool
{
$result = (new JsonCrawler($this->json))->find($this->jsonPath);
return \in_array($other, $result, $this->stri | aint
{
public function __construct(
private JsonPath|string $jsonPath,
private string $json,
private bool $strict = true,
) {
}
public function toString(): string
{
return \spr | {
"filepath": "src/Symfony/Component/JsonPath/Test/JsonPathContains.php",
"language": "php",
"file_size": 1010,
"cut_index": 512,
"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\JsonPath\Test;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\JsonPath\JsonCrawler;
use Symfony\Component\JsonPath\JsonPath;
/... | oString(): string
{
return \sprintf('matches expected count of JSON path "%s"', $this->jsonPath);
}
protected function matches(mixed $other): bool
{
return $other === \count((new JsonCrawler($this->json))->find($this->jsonP | e string $json,
) {
}
public function t | {
"filepath": "src/Symfony/Component/JsonPath/Test/JsonPathCount.php",
"language": "php",
"file_size": 929,
"cut_index": 606,
"middle_length": 52
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\JsonPath\Test;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\JsonPa... | private string $json,
) {
}
public function toString(): string
{
return \sprintf('equals JSON path "%s" result', $this->jsonPath);
}
protected function matches(mixed $other): bool
{
return (new JsonCrawler($t | t(
private JsonPath|string $jsonPath,
| {
"filepath": "src/Symfony/Component/JsonPath/Test/JsonPathEquals.php",
"language": "php",
"file_size": 909,
"cut_index": 547,
"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\JsonPath\Test;
use PHPUnit\Framework\Constraint\Const... | sprintf('is not found in elements at JSON path "%s"', $this->jsonPath);
}
protected function matches(mixed $other): bool
{
$result = (new JsonCrawler($this->json))->find($this->jsonPath);
return !\in_array($other, $result, $th | straint
{
public function __construct(
private JsonPath|string $jsonPath,
private string $json,
private bool $strict = true,
) {
}
public function toString(): string
{
return \ | {
"filepath": "src/Symfony/Component/JsonPath/Test/JsonPathNotContains.php",
"language": "php",
"file_size": 1018,
"cut_index": 512,
"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\JsonPath\Test;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\JsonPath\JsonCrawler;
use Symfony\Component\JsonPath\JsonPath;
/... | on toString(): string
{
return \sprintf('does not equal JSON path "%s" result', $this->jsonPath);
}
protected function matches(mixed $other): bool
{
return (new JsonCrawler($this->json))->find($this->jsonPath) != $other;
| ivate string $json,
) {
}
public functi | {
"filepath": "src/Symfony/Component/JsonPath/Test/JsonPathNotEquals.php",
"language": "php",
"file_size": 920,
"cut_index": 606,
"middle_length": 52
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\JsonPath\Test;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\JsonPath\JsonCrawler;
use Symfony\Component\JsonPath\JsonPath;
/... | toString(): string
{
return \sprintf('is not identical to JSON path "%s" result', $this->jsonPath);
}
protected function matches(mixed $other): bool
{
return (new JsonCrawler($this->json))->find($this->jsonPath) !== $other | ate string $json,
) {
}
public function | {
"filepath": "src/Symfony/Component/JsonPath/Test/JsonPathNotSame.php",
"language": "php",
"file_size": 924,
"cut_index": 606,
"middle_length": 52
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\JsonPath\Test;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\JsonPath\JsonCrawler;
use Symfony\Component\JsonPath\JsonPath;
/... | String(): string
{
return \sprintf('is identical to JSON path "%s" result', $this->jsonPath);
}
protected function matches(mixed $other): bool
{
return (new JsonCrawler($this->json))->find($this->jsonPath) === $other;
} | string $json,
) {
}
public function to | {
"filepath": "src/Symfony/Component/JsonPath/Test/JsonPathSame.php",
"language": "php",
"file_size": 917,
"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\Messenger;
use Symfony\Component\Messenger\Stamp\StampInterface;
/**
* A message wrapped in an envelop... | array $stamps = [],
) {
foreach ($stamps as $stamp) {
$this->stamps[$stamp::class][] = $stamp;
}
}
/**
* Makes sure the message is in an Envelope and adds the given stamps.
*
* @param StampInter | >, list<StampInterface>>
*/
private array $stamps = [];
/**
* @param object|Envelope $message
* @param StampInterface[] $stamps
*/
public function __construct(
private object $message,
| {
"filepath": "src/Symfony/Component/Messenger/Envelope.php",
"language": "php",
"file_size": 3025,
"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\Config\Tests\Definition;
use PHPUnit\Framework\Attributes\T... | }
#[TestWith([null])]
#[TestWith([false])]
#[TestWith([true])]
#[TestWith([0])]
#[TestWith([1])]
#[TestWith([0.0])]
#[TestWith([0.1])]
#[TestWith([[]])]
#[TestWith([['foo' => 'bar']])]
public function testNormalize | ds TestCase
{
#[TestWith([''])]
#[TestWith(['valid string'])]
public function testNormalize(string $value)
{
$node = new StringNode('test');
$this->assertSame($value, $node->normalize($value));
| {
"filepath": "src/Symfony/Component/Config/Tests/Definition/StringNodeTest.php",
"language": "php",
"file_size": 1193,
"cut_index": 518,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition... | nNodeDefinition('foo');
$def->cannotBeEmpty();
}
public function testBooleanNodeWithDefaultNull()
{
$def = new BooleanNodeDefinition('foo');
$def->defaultNull();
$node = $def->getNode();
$this->assertTr | BeEmptyThrowsAnException()
{
$this->expectException(InvalidDefinitionException::class);
$this->expectExceptionMessage('->cannotBeEmpty() is not applicable to BooleanNodeDefinition.');
$def = new Boolea | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Builder/BooleanNodeDefinitionTest.php",
"language": "php",
"file_size": 2230,
"cut_index": 563,
"middle_length": 229
} |
efinition\Builder\ExprBuilder;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
class ExprBuilderTest extends TestCase
{
public function testAlwaysExpression(... | $test, ['key' => true]);
$test = $this->getTestBuilder()
->ifTrue(static fn () => true)
->then($this->returnClosure('new_value'))
->end();
$this->assertFinalizedValueIs('new_value', $test);
$test = | public function testIfTrueExpression()
{
$test = $this->getTestBuilder()
->ifTrue()
->then($this->returnClosure('new_value'))
->end();
$this->assertFinalizedValueIs('new_value', | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php",
"language": "php",
"file_size": 9411,
"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\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition;
use Symfony\Component... | Type()
{
$this->expectException(\RuntimeException::class);
$builder = new BaseNodeBuilder();
$builder->node('', 'foobar');
}
public function testThrowsAnExceptionWhenTheNodeClassIsNotFound()
{
$this->expectE | nition;
use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition;
class NodeBuilderTest extends TestCase
{
public function testThrowsAnExceptionWhenTryingToCreateANonRegisteredNode | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php",
"language": "php",
"file_size": 3057,
"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\Config\Tests\Definition;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
... | #[DataProvider('getValidValues')]
public function testValidNonEmptyValues(int $value)
{
$node = new IntegerNode('test');
$node->setAllowEmptyValue(false);
$this->assertSame($value, $node->finalize($value));
}
pub | NodeTest extends TestCase
{
#[DataProvider('getValidValues')]
public function testNormalize(int $value)
{
$node = new IntegerNode('test');
$this->assertSame($value, $node->normalize($value));
}
| {
"filepath": "src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php",
"language": "php",
"file_size": 2124,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\BaseNode;
use Symfony\Component\Config\Definition\BooleanNode;
use Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition;
use Symfony\Compon... | {
$builder = new TreeBuilder('custom', 'array', new CustomNodeBuilder());
$nodeBuilder = $builder->getRootNode()->children();
$this->assertInstanceOf(CustomNodeBuilder::class, $nodeBuilder);
$nodeBuilder = $nodeBuilde | fig\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
use Symfony\Component\Config\Tests\Fixtures\Builder\VariableNodeDefinition;
class TreeBuilderTest extends TestCase
{
public function testUsingACustomNodeBuilder()
| {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php",
"language": "php",
"file_size": 6686,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException;
use Symfony\Component\Config\Definition\Exception\InvalidCon... | )
;
$a = [
'foo' => 'bar',
];
$b = [
'foo' => 'moo',
];
$this->expectException(ForbiddenOverwriteException::class);
$tree->merge($a, $b);
}
public function testUns | tRootNode()
->children()
->node('foo', 'scalar')
->cannotBeOverwritten()
->end()
->end()
->end()
->buildTree( | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/MergeTest.php",
"language": "php",
"file_size": 5159,
"cut_index": 716,
"middle_length": 229
} |
t the doRequest() method.
*
* If you want to be able to run requests in their own process (insulated flag),
* you need to also implement the getScript() method.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @template TRequest of object
* @template TResponse of object
*/
abstract class AbstractBrowser
{... | sulated = false;
protected ?string $redirect;
protected bool $followRedirects = true;
protected bool $followMetaRefresh = false;
private int $maxRedirects = -1;
private int $redirectCount = 0;
private array $redirects = [];
pri | ct $request;
protected Response $internalResponse;
/** @psalm-var TResponse */
protected object $response;
protected Crawler $crawler;
protected string|false $wrapContentPattern = false;
protected bool $in | {
"filepath": "src/Symfony/Component/BrowserKit/AbstractBrowser.php",
"language": "php",
"file_size": 22949,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\BrowserKit;
use Symfony\Component\BrowserKit\Exception\InvalidArgumentException;
use Symfony\Component\BrowserKit\Exception\UnexpectedValueException;
/**
* Cookie represents an HTTP cookie.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class Coo... | string $expires = null;
protected string $path;
protected string $rawValue;
/**
* Sets a cookie.
*
* @param string $name The cookie name
* @param string|null $value The value of the cookie
* | Y H:i:s T',
'D, d-M-y H:i:s T',
'D, d-M-Y H:i:s T',
'D, d-m-y H:i:s T',
'D, d-m-Y H:i:s T',
'D M j G:i:s Y',
'D M d H:i:s Y T',
];
protected string $value;
protected ? | {
"filepath": "src/Symfony/Component/BrowserKit/Cookie.php",
"language": "php",
"file_size": 8488,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\BrowserKit;
use Symfony\Component\BrowserKit\Exception\LogicException;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\Mime\Part\AbstractPart;
use Symfony\Component\Mime\Part\DataPart;
use Symfony\Component\Mime\Part\Multipart\FormDataPar... | __construct(?HttpClientInterface $client = null, ?History $history = null, ?CookieJar $cookieJar = null)
{
if (!$client && !class_exists(HttpClient::class)) {
throw new LogicException(\sprintf('You cannot use "%s" as the HttpClient | quests.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @template-extends AbstractBrowser<Request, Response>
*/
class HttpBrowser extends AbstractBrowser
{
private HttpClientInterface $client;
public function | {
"filepath": "src/Symfony/Component/BrowserKit/HttpBrowser.php",
"language": "php",
"file_size": 5464,
"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\BrowserKit;
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
class Request
{
/**
* @par... | public function __construct(
protected string $uri,
protected string $method,
protected array $parameters = [],
protected array $files = [],
protected array $cookies = [],
protected array $server = [],
| $files An array of uploaded files
* @param array $cookies An array of cookies
* @param array $server An array of server parameters
* @param string|null $content The raw body data
*/
| {
"filepath": "src/Symfony/Component/BrowserKit/Request.php",
"language": "php",
"file_size": 2216,
"cut_index": 563,
"middle_length": 229
} |
Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\BrowserKit\Response;
class CookieJarTest extends TestCase
{
public function testSetGet()
{
$cookieJar = new CookieJar();
$cookieJar->set($cookie = new Cookie('foo', 'bar'));
$this->assertEquals($cookie, $cookieJar->get('foo'... | t($cookie = new Cookie('foo', 'bar'));
$cookieJar->expire('foo');
$this->assertNull($cookieJar->get('foo'), '->get() returns null if the cookie is expired');
}
public function testAll()
{
$cookieJar = new CookieJar();
| ar', time() - 86400));
$this->assertNull($cookieJar->get('foo'), '->get() returns null if the cookie is expired');
}
public function testExpire()
{
$cookieJar = new CookieJar();
$cookieJar->se | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php",
"language": "php",
"file_size": 10795,
"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\BrowserKit\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\BrowserKit\History;
use Symfony\Component\BrowserKit\Request;
class HistoryTest ex... | current()->getUri(), '->add() adds a request to the history');
$history->add(new Request('http://www.example3.com/', 'get'));
$history->back();
$history->add(new Request('http://www.example4.com/', 'get'));
$this->assertSam | www.example1.com/', $history->current()->getUri(), '->add() adds a request to the history');
$history->add(new Request('http://www.example2.com/', 'get'));
$this->assertSame('http://www.example2.com/', $history-> | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/HistoryTest.php",
"language": "php",
"file_size": 4807,
"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\BrowserKit\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\BrowserKit\Request;
class Reque... | (), '->getMethod() returns the method of the request');
}
public function testGetParameters()
{
$request = new Request('http://www.example.com/', 'get', ['foo' => 'bar']);
$this->assertEquals(['foo' => 'bar'], $request->getPara | st->getUri(), '->getUri() returns the URI of the request');
}
public function testGetMethod()
{
$request = new Request('http://www.example.com/', 'get');
$this->assertEquals('get', $request->getMethod | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/RequestTest.php",
"language": "php",
"file_size": 2408,
"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\BrowserKit\Tests;
use Symfony\Component\BrowserKit\AbstractBrowse... | $request): Response
{
if (null === $this->nextResponse) {
return new Response();
}
$response = $this->nextResponse;
$this->nextResponse = null;
return $response;
}
protected function getScr | etNextResponse(Response $response)
{
$this->nextResponse = $response;
}
public function setNextScript(string $script)
{
$this->nextScript = $script;
}
protected function doRequest(object | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/TestClient.php",
"language": "php",
"file_size": 1281,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component... | etValidValues(): array
{
return [
[false],
[true],
[null],
[''],
['foo'],
[0],
[1],
[0.0],
[0.1],
];
}
public function | Case
{
#[DataProvider('getValidValues')]
public function testNormalize($value)
{
$node = new ScalarNode('test');
$this->assertSame($value, $node->normalize($value));
}
public static function g | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php",
"language": "php",
"file_size": 5332,
"cut_index": 716,
"middle_length": 229
} |
fony\Component\Config\Definition\Processor;
use Symfony\Component\Config\Definition\PrototypedArrayNode;
class ArrayNodeDefinitionTest extends TestCase
{
public function testAppendingSomeNode()
{
$parent = new ArrayNodeDefinition('root');
$child = new ScalarNodeDefinition('child');
$pa... | cOption(string $method, array $args)
{
$this->expectException(InvalidDefinitionException::class);
$node = new ArrayNodeDefinition('root');
$node->{$method}(...$args);
$node->getNode();
}
public static function | t(3, $this->getField($parent, 'children'));
$this->assertContains($child, $this->getField($parent, 'children'));
}
#[DataProvider('providePrototypeNodeSpecificCalls')]
public function testPrototypeNodeSpecifi | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php",
"language": "php",
"file_size": 19021,
"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\Config\Tests\Definition\Builder;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Bui... | n\InvalidDefinitionException;
class NodeDefinitionTest extends TestCase
{
public function testSetPathSeparatorChangesChildren()
{
$parentNode = new ArrayNodeDefinition('name');
$childNode = $this->createMock(NodeDefinition::class); | finition\Builder\ScalarNodeDefinition;
use Symfony\Component\Config\Definition\Builder\StringNodeDefinition;
use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition;
use Symfony\Component\Config\Definition\Exceptio | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Builder/NodeDefinitionTest.php",
"language": "php",
"file_size": 4014,
"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\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition;
use Symfony\Component... | on::class);
$this->expectExceptionMessage('You cannot define a min(4) as you already have a max(3)');
$node->max(3)->min(4);
}
public function testIncoherentMaxAssertion()
{
$node = new IntegerNodeDefinition('foo');
| nitionException;
class NumericNodeDefinitionTest extends TestCase
{
public function testIncoherentMinAssertion()
{
$node = new IntegerNodeDefinition('foo');
$this->expectException(\InvalidArgumentExcepti | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php",
"language": "php",
"file_size": 3459,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition\Dumper;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper;
use Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration... | L
scalar_true: true
EOL
],
'Array node' => ['array', <<<EOL
# some info
array:
child1: ~
child2: | $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration));
}
public static function provideDumpAtPath(): array
{
return [
'Regular node' => ['scalar_true', <<<EO | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php",
"language": "php",
"file_size": 5369,
"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\BrowserKit;
use Symfony\Component\BrowserKit\Exception\LogicException;
/**
* History.
*
* @author Fa... | >stack, 0, $this->position + 1);
$this->stack[] = clone $request;
$this->position = \count($this->stack) - 1;
}
/**
* Returns true if the history is empty.
*/
public function isEmpty(): bool
{
return 0 === | (): void
{
$this->stack = [];
$this->position = -1;
}
/**
* Adds a Request to the history.
*/
public function add(Request $request): void
{
$this->stack = \array_slice($this- | {
"filepath": "src/Symfony/Component/BrowserKit/History.php",
"language": "php",
"file_size": 2478,
"cut_index": 563,
"middle_length": 229
} |
xample.com/', $client->getRequest()->getUri(), '->getCrawler() returns the Request of the last request');
}
public function testGetRequestNull()
{
$client = $this->getBrowser();
$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage('The "request()" me... | $this->assertFalse($client->getServerParameter('HTTP_X_REQUESTED_WITH', false));
}
public function testJsonRequest()
{
$client = $this->getBrowser();
$client->jsonRequest('GET', 'http://example.com/', ['param' => 1, 'float' => | ient = $this->getBrowser();
$client->xmlHttpRequest('GET', 'http://example.com/', [], [], [], null, true);
$this->assertSame('XMLHttpRequest', $client->getRequest()->getServer()['HTTP_X_REQUESTED_WITH']);
| {
"filepath": "src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php",
"language": "php",
"file_size": 44034,
"cut_index": 2151,
"middle_length": 229
} |
History;
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\MockResponse;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
class HttpBrowserTest extends AbstractBrowserTest
{
... | cts($this->once())
->method('request')
->with(...$expectedArguments)
->willReturn($this->createStub(ResponseInterface::class));
$browser = new HttpBrowser($client);
$browser->request(...$requestArguments | ataProvider('validContentTypes')]
public function testRequestHeaders(array $requestArguments, array $expectedArguments)
{
$client = $this->createMock(HttpClientInterface::class);
$client
->expe | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php",
"language": "php",
"file_size": 12626,
"cut_index": 921,
"middle_length": 229
} |
Symfony\Component\BrowserKit\Exception\InvalidArgumentException;
use Symfony\Component\BrowserKit\Exception\UnexpectedValueException;
class CookieTest extends TestCase
{
public function testToString()
{
$cookie = new Cookie('foo', 'bar', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.co... | expires=Fri, 20 May 2011 15:25:52 GMT; domain=.myfoodomain.com; path=/; secure; httponly', (string) $cookie, '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20)');
$cookie = new Cookie('foo', null, 1, '/admin/ | resentation of the cookie');
$cookie = new Cookie('foo', 'bar with white spaces', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
$this->assertEquals('foo=bar%20with%20white%20spaces; | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/CookieTest.php",
"language": "php",
"file_size": 9673,
"cut_index": 921,
"middle_length": 229
} |
n;
use Symfony\Component\Messenger\Exception\MessageDecodingFailedException;
use Symfony\Component\Messenger\Stamp\MessageDecodingFailedStamp;
use Symfony\Component\Messenger\Stamp\NonSendableStampInterface;
/**
* @author Ryan Weaver<ryan@symfonycasts.com>
*/
class PhpSerializer implements SerializerInterface, Messa... | dEnvelope): Envelope
{
if (empty($encodedEnvelope['body'])) {
return MessageDecodingFailedException::wrap($encodedEnvelope, 'Encoded envelope should have at least a "body", or maybe you should implement your own serializer.');
| >acceptPhpIncompleteClass = true;
}
/**
* @internal
*/
public function rejectPhpIncompleteClass(): void
{
$this->acceptPhpIncompleteClass = false;
}
public function decode(array $encode | {
"filepath": "src/Symfony/Component/Messenger/Transport/Serialization/PhpSerializer.php",
"language": "php",
"file_size": 13066,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Messenger\Transport\Serialization;
use Symfony\Component\Lock\Serializer\LockKeyNormalizer;
use Symfony\Component\Messenger\Attribute\AsMessage;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\LogicException;
use Symfony\... | Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Compo | Symfony\Component\Messenger\Stamp\SerializerStamp;
use Symfony\Component\Messenger\Stamp\StampInterface;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use | {
"filepath": "src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php",
"language": "php",
"file_size": 8314,
"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\Messenger\Transport\Serialization;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messe... | - `body` (string) - the message body
* - `headers` (string<string>) - a key/value pair of headers
*
* On failure, implementations SHOULD return an Envelope wrapping a
* MessageDecodingFailedException instead of throwing, so that the wo | n encoded-form.
*
* The `$encodedEnvelope` parameter is a key-value array that
* describes the envelope and its content, that will be used by the different transports.
*
* The most common keys are:
* | {
"filepath": "src/Symfony/Component/Messenger/Transport/Serialization/SerializerInterface.php",
"language": "php",
"file_size": 2068,
"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\Messenger\Transport\Serialization;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\InvalidMessageSignatureException;
us... | ray $signedMessageTypes,
private string $algorithm = 'sha256',
) {
}
public function encode(Envelope $envelope): array
{
$encoded = $this->inner->encode($envelope);
$type = $envelope->getMessage()::class;
i | *
* @param list<class-string> $signedMessageTypes
*/
public function __construct(
private SerializerInterface $inner,
#[\SensitiveParameter] private string|\Stringable $signingKey,
private ar | {
"filepath": "src/Symfony/Component/Messenger/Transport/Serialization/SigningSerializer.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\Messenger\Transport\Serialization\Normalizer;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Symfony\Component\Messenger\Transport\Seri... | rmalizerInterface
{
use NormalizerAwareTrait;
public function normalize(mixed $data, ?string $format = null, array $context = []): array
{
return [
'message' => $data->getMessage(),
'code' => $data->getCode(),
| alizer\NormalizerInterface;
/**
* This normalizer is only used in Debug/Dev/Messenger contexts.
*
* @author Pascal Luna <skalpa@zetareticuli.org>
*/
final class FlattenExceptionNormalizer implements DenormalizerInterface, No | {
"filepath": "src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php",
"language": "php",
"file_size": 3539,
"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\Messenger\Transport\InMemory;
use Psr\Clock\ClockInterface;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\LogicExcept... | */
class InMemoryTransport implements TransportInterface, ResetInterface
{
/**
* @var Envelope[]
*/
private array $sent = [];
/**
* @var Envelope[]
*/
private array $acknowledged = [];
/**
* @var Envelope[]
| e;
use Symfony\Component\Messenger\Transport\TransportInterface;
use Symfony\Contracts\Service\ResetInterface;
/**
* Transport that stays in memory. Useful for testing purpose.
*
* @author Gary PEGEOT <garypegeot@gmail.com>
| {
"filepath": "src/Symfony/Component/Messenger/Transport/InMemory/InMemoryTransport.php",
"language": "php",
"file_size": 4688,
"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\Messenger\Transport\InMemory;
use Psr\Clock\ClockInterface;
use Symfony\Compon... | , ResetInterface
{
/**
* @var InMemoryTransport[]
*/
private array $createdTransports = [];
public function __construct(
private readonly ?ClockInterface $clock = null,
) {
}
public function createTransport(strin | e Symfony\Contracts\Service\ResetInterface;
/**
* @author Gary PEGEOT <garypegeot@gmail.com>
*
* @implements TransportFactoryInterface<InMemoryTransport>
*/
class InMemoryTransportFactory implements TransportFactoryInterface | {
"filepath": "src/Symfony/Component/Messenger/Transport/InMemory/InMemoryTransportFactory.php",
"language": "php",
"file_size": 1893,
"cut_index": 537,
"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\Messenger\Transport\Receiver;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messen... | int|null $seconds The minimum duration the message should be kept alive
*
* @throws TransportException If there is an issue communicating with the transport
*/
public function keepalive(Envelope $envelope, ?int $seconds = null): void;
}
| meout on the transport's side.
*
* @param | {
"filepath": "src/Symfony/Component/Messenger/Transport/Receiver/KeepaliveReceiverInterface.php",
"language": "php",
"file_size": 867,
"cut_index": 559,
"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\Messenger\Transport\Receiver;
use Symfony\Component\Messeng... | Messages should be given the same stamps as when using ReceiverInterface::get().
*
* @return iterable<Envelope>
*/
public function all(?int $limit = null): iterable;
/**
* Returns the Envelope by id or none.
*
* Mess | opes that it returns.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
interface ListableReceiverInterface extends ReceiverInterface
{
/**
* Returns all the messages (up to the limit) in this receiver.
*
* | {
"filepath": "src/Symfony/Component/Messenger/Transport/Receiver/ListableReceiverInterface.php",
"language": "php",
"file_size": 1137,
"cut_index": 518,
"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\Messenger\Transport\Receiver;
use Symfony\Component\Messenger\Envelope;
/**
* Some transports may have multiple queues. This interface is used to... |
* @param string[] $queueNames
* @param int $fetchSize Best-effort hint about how many messages can be received in one call
*
* @return Envelope[]
*/
public function getFromQueues(array $queueNames/* , int $fetchSize = 1 | e names instead of consuming from all queues.
* | {
"filepath": "src/Symfony/Component/Messenger/Transport/Receiver/QueueReceiverInterface.php",
"language": "php",
"file_size": 931,
"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\Messenger\Transport\Receiver;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\... | * they can finish processing the one (or "small number") of messages
* from this receiver and move on to check other receivers for messages.
* If this method returns too many messages, it could cause a
* blocking effect where handling the | messages.
*
* While this method could return an unlimited number of messages,
* the intention is that it returns only one, or a "small number"
* of messages each time. This gives the user more flexibility:
| {
"filepath": "src/Symfony/Component/Messenger/Transport/Receiver/ReceiverInterface.php",
"language": "php",
"file_size": 2246,
"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\Messenger\Transport\Receiver;
use Symfony\Component\Messeng... | hSize
*/
public function get(/* int $fetchSize = 1 */): iterable
{
if ($this->hasReceived) {
return [];
}
$this->hasReceived = true;
return [$this->envelope];
}
public function ack(Envelop | plements ReceiverInterface
{
private bool $hasReceived = false;
public function __construct(
private ReceiverInterface $receiver,
private Envelope $envelope,
) {
}
/**
* @param int $fetc | {
"filepath": "src/Symfony/Component/Messenger/Transport/Receiver/SingleMessageReceiver.php",
"language": "php",
"file_size": 1187,
"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\Messenger\Stamp;
use Symfony\Component\Lock\Key;
use Symfony\Component\Messeng... | , release the legitimate message's lock (see
* {@see \Symfony\Component\Messenger\EventListener\ReleaseDeduplicationLockOnFailureListener}).
*
* Treat deduplication keys as a best-effort idempotency primitive. They are not
* a correctness primitive aga | through the transport, so any actor able to write into the
* queue can craft an envelope whose DeduplicateStamp references the
* deduplication key of another in-flight message and, by failing that crafted
* message terminally | {
"filepath": "src/Symfony/Component/Messenger/Stamp/DeduplicateStamp.php",
"language": "php",
"file_size": 1850,
"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\Messenger\Stamp;
use Symfony\Component\Clock\Clock;
/**
*... | $now = Clock::get()->withTimeZone(new \DateTimeZone('UTC'))->now();
$end = $now->add($interval);
return new self(($end->getTimestamp() - $now->getTimestamp()) * 1000);
}
public static function delayUntil(\DateTimeInterface $da | public function __construct(
private int $delay,
) {
}
public function getDelay(): int
{
return $this->delay;
}
public static function delayFor(\DateInterval $interval): self
{
| {
"filepath": "src/Symfony/Component/Messenger/Stamp/DelayStamp.php",
"language": "php",
"file_size": 1130,
"cut_index": 518,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Messenger\Stamp;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Symfony\Component\Me... | private ?FlattenException $flattenException = null,
) {
}
public static function create(\Throwable $throwable): self
{
if ($throwable instanceof HandlerFailedException) {
$throwable = $throwable->getPrevious();
| r.
*/
final class ErrorDetailsStamp implements StampInterface
{
public function __construct(
private string $exceptionClass,
private int|string $exceptionCode,
private string $exceptionMessage,
| {
"filepath": "src/Symfony/Component/Messenger/Stamp/ErrorDetailsStamp.php",
"language": "php",
"file_size": 2688,
"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\Messenger\Stamp;
use Symfony\Component\Messenger\Handler\HandlerD... | Middleware
* @see HandleTrait
*
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
*/
final class HandledStamp implements StampInterface
{
public function __construct(
private mixed $result,
private string $handlerName,
| dleware` middleware
* and storing the handler returned value.
*
* This is used by synchronous command buses expecting a return value and the retry logic
* to only execute handlers that didn't succeed.
*
* @see HandleMessage | {
"filepath": "src/Symfony/Component/Messenger/Stamp/HandledStamp.php",
"language": "php",
"file_size": 1358,
"cut_index": 524,
"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\Messenger\Stamp;
use Symfony\Component\Messenger\Middleware\SendMessageMiddleware;
/**
* Marker st... | om>
*/
final class ReceivedStamp implements NonSendableStampInterface
{
public function __construct(
private string $transportName,
) {
}
public function getTransportName(): string
{
return $this->transportName;
}
| eware
*
* @author Samuel Roze <samuel.roze@gmail.c | {
"filepath": "src/Symfony/Component/Messenger/Stamp/ReceivedStamp.php",
"language": "php",
"file_size": 869,
"cut_index": 559,
"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\Messenger\Stamp;
use Symfony\Component\Clock\Clock;
use Sym... | atic function getRetryCountFromEnvelope(Envelope $envelope): int
{
/** @var self|null $retryMessageStamp */
$retryMessageStamp = $envelope->last(self::class);
return $retryMessageStamp ? $retryMessageStamp->getRetryCount() : 0; | deliveredAt;
public function __construct(
private int $retryCount,
?\DateTimeInterface $redeliveredAt = null,
) {
$this->redeliveredAt = $redeliveredAt ?? Clock::get()->now();
}
public st | {
"filepath": "src/Symfony/Component/Messenger/Stamp/RedeliveryStamp.php",
"language": "php",
"file_size": 1209,
"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\Messenger\Stamp;
/**
* @author Jérémy Derussé <jeremy@derusse.co... | return $this->baseUrl;
}
public function getMethod(): string
{
return $this->method;
}
public function getHost(): string
{
return $this->host;
}
public function getScheme(): string
{
return | private string $scheme,
private int $httpPort,
private int $httpsPort,
private string $pathInfo,
private string $queryString,
) {
}
public function getBaseUrl(): string
{
| {
"filepath": "src/Symfony/Component/Messenger/Stamp/RouterContextStamp.php",
"language": "php",
"file_size": 1385,
"cut_index": 524,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Messenger\Stamp;
use Symfony\Component\Messenger\Middleware\SendMessageMiddleware;
/**
... | ublic function __construct(
private string $senderClass,
private ?string $senderAlias = null,
) {
}
public function getSenderClass(): string
{
return $this->senderClass;
}
public function getSenderAlias(): | ntStamp implements NonSendableStampInterface
{
p | {
"filepath": "src/Symfony/Component/Messenger/Stamp/SentStamp.php",
"language": "php",
"file_size": 912,
"cut_index": 547,
"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\Messenger\Stamp;
/**
* Stamp used to override the transpo... | for the message
*/
public function __construct(array|string $transportNames)
{
$this->transportNames = (array) $transportNames;
}
public function getTransportNames(): array
{
return $this->transportNames;
}
}
| []|string $transportNames Transport names to be used | {
"filepath": "src/Symfony/Component/Messenger/Stamp/TransportNamesStamp.php",
"language": "php",
"file_size": 825,
"cut_index": 517,
"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\Messenger\Middleware;
use Symfony\Component\Messenger\En... | activated : $activated(...);
}
public function handle(Envelope $envelope, StackInterface $stack): Envelope
{
if (\is_callable($this->activated) ? ($this->activated)($envelope) : $this->activated) {
return $this->inner->hand | ddlewareInterface
{
private \Closure|bool $activated;
public function __construct(
private MiddlewareInterface $inner,
bool|callable $activated,
) {
$this->activated = \is_bool($activated) ? $ | {
"filepath": "src/Symfony/Component/Messenger/Middleware/ActivationMiddleware.php",
"language": "php",
"file_size": 1100,
"cut_index": 515,
"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\Messenger\Middleware;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Stamp\BusNameStamp;
/**
* Adds the BusNameStamp t... | pe $envelope, StackInterface $stack): Envelope
{
if (null === $envelope->last(BusNameStamp::class)) {
$envelope = $envelope->with(new BusNameStamp($this->busName));
}
return $stack->next()->handle($envelope, $stack) | me,
) {
}
public function handle(Envelo | {
"filepath": "src/Symfony/Component/Messenger/Middleware/AddBusNameStampMiddleware.php",
"language": "php",
"file_size": 924,
"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\Messenger\Middleware;
use Symfony\Component\Messenger\... |
foreach ($message->getDefaultStamps() as $stamp) {
if (null === $envelope->last($stamp::class)) {
$envelope = $envelope->with($stamp);
}
}
}
return $stack->next() | implements MiddlewareInterface
{
public function handle(Envelope $envelope, StackInterface $stack): Envelope
{
$message = $envelope->getMessage();
if ($message instanceof DefaultStampsProviderInterface) { | {
"filepath": "src/Symfony/Component/Messenger/Middleware/AddDefaultStampsMiddleware.php",
"language": "php",
"file_size": 1035,
"cut_index": 513,
"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\Messenger\Transport;
use Symfony\Component\Messenger\Tran... | * @return TTransport
*/
public function createTransport(#[\SensitiveParameter] string $dsn, array $options, SerializerInterface $serializer): TransportInterface;
public function supports(#[\SensitiveParameter] string $dsn, array $options): bo |
interface TransportFactoryInterface
{
/**
| {
"filepath": "src/Symfony/Component/Messenger/Transport/TransportFactoryInterface.php",
"language": "php",
"file_size": 830,
"cut_index": 516,
"middle_length": 52
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Messenger\Transport\Sync;
use Symfony\Component\Messenger\Envelope;
use Symfon... | lass SyncTransport implements TransportInterface
{
public function __construct(
private MessageBusInterface $messageBus,
) {
}
/**
* @param int $fetchSize
*/
public function get(/* int $fetchSize = 1 */): iterable
| ger\Stamp\SentStamp;
use Symfony\Component\Messenger\Transport\TransportInterface;
/**
* Transport that immediately marks messages as received and dispatches for handling.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
c | {
"filepath": "src/Symfony/Component/Messenger/Transport/Sync/SyncTransport.php",
"language": "php",
"file_size": 1879,
"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\Messenger\Transport\Serialization;
/**
* Implemented by serializ... | wise instantiate the payload, and MUST
* be side-effect free.
*
* Returning null signals that the envelope is not recognizable under these
* constraints; consumers may treat such an envelope as untrusted (e.g. refuse
* to decode it | erializerInterface
{
/**
* Returns the FQCN of the message carried by the encoded envelope.
*
* Implementations MUST determine the class from the encoded metadata only:
* they MUST NOT unserialize or other | {
"filepath": "src/Symfony/Component/Messenger/Transport/Serialization/MessageTypeAwareSerializerInterface.php",
"language": "php",
"file_size": 1430,
"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\BrowserKit;
use Symfony\Component\BrowserKit\Exception\JsonException;
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
final class Response
{
... | private string $content = '',
private int $status = 200,
private array $headers = [],
) {
}
/**
* Converts the response object to string containing all headers and the response content.
*/
public function __toSt | @param string $content The content of the response
* @param int $status The response status code (302 "Found" by default)
* @param array $headers An array of headers
*/
public function __construct(
| {
"filepath": "src/Symfony/Component/BrowserKit/Response.php",
"language": "php",
"file_size": 3096,
"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\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder\EnumNodeDefinition;
use Symfony\Component\... | $def = new EnumNodeDefinition('foo');
$def->enumFqcn(TestEnum::class);
$node = $def->getNode();
$this->assertEquals(TestEnum::class, $node->getEnumFqcn());
}
public function testNoValuesPassed()
{
$this->ex | $def = new EnumNodeDefinition('foo');
$def->values(['foo']);
$node = $def->getNode();
$this->assertEquals(['foo'], $node->getValues());
}
public function testWithUnitEnumFqcn()
{
| {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php",
"language": "php",
"file_size": 3198,
"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\Config\Tests\Definition\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Co... | r->supports('foo.php'), '->supports() returns true if the resource is loadable');
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable');
$this->assertTrue($loader->supports('with_wron | ig\FileLocator;
class DefinitionFileLoaderTest extends TestCase
{
public function testSupports()
{
$loader = new DefinitionFileLoader(new TreeBuilder('test'), new FileLocator());
$this->assertTrue($loade | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/Loader/DefinitionFileLoaderTest.php",
"language": "php",
"file_size": 1635,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\BrowserKit;
use Symfony\Component\BrowserKit\Exception\InvalidArgumentException;
/**
* CookieJar.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class CookieJar
{
protected array $cookieJar = [];
public function set(Cookie $cookie): void... | string $path = '/', ?string $domain = null): ?Cookie
{
$this->flushExpiredCookies();
foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
if ($cookieDomain && $domain) {
$cookieDomain = '.'.ltrim($c | y domain, but if you do so,
* this method returns the first cookie for the given name/path
* (this behavior ensures a BC behavior with previous versions of
* Symfony).
*/
public function get(string $name, | {
"filepath": "src/Symfony/Component/BrowserKit/CookieJar.php",
"language": "php",
"file_size": 6295,
"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\Messenger;
use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messe... | d in an envelope
* @param StampInterface[] $stamps Stamps set on the Envelope which are used to control middleware behavior
*
* @throws ExceptionInterface
*/
public function dispatch(object $message, array $stamps = []): Envelope;
| lope $message The message or the message pre-wrappe | {
"filepath": "src/Symfony/Component/Messenger/MessageBusInterface.php",
"language": "php",
"file_size": 869,
"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\Messenger;
use Symfony\Component\Messenger\Stamp\StampInterface;
/**
* @author Samuel Roze <samuel.roze@gmail.com>
*/
class TraceableMessageBus implemen... | }
$envelope = Envelope::wrap($message, $stamps);
$context = [
'stamps' => array_merge([], ...array_values($envelope->all())),
'message' => $envelope->getMessage(),
'caller' => $this->getCaller(),
| disabled = null,
) {
}
public function dispatch(object $message, array $stamps = []): Envelope
{
if ($this->disabled?->__invoke()) {
return $this->decoratedBus->dispatch($message, $stamps);
| {
"filepath": "src/Symfony/Component/Messenger/TraceableMessageBus.php",
"language": "php",
"file_size": 3768,
"cut_index": 614,
"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\Messenger;
/**
* @author Oleg Krasavin <okwinza@gmail... | (): ?array
{
return $this->metadata['queueNames'] ?? null;
}
/**
* Returns an array of unique identifiers for transport receivers the worker consumes from.
*/
public function getTransportNames(): array
{
retur | etadata = array_merge($this->metadata, $newMetadata);
}
/**
* Returns the queue names the worker consumes from, if "--queues" option was used.
* Returns null otherwise.
*/
public function getQueueNames | {
"filepath": "src/Symfony/Component/Messenger/WorkerMetadata.php",
"language": "php",
"file_size": 1049,
"cut_index": 513,
"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\Messenger\Exception;
use Symfony\Component\Messenger\Envelope;
c... | message = \sprintf('Handling "%s" failed: ', $envelope->getMessage()::class);
parent::__construct(
$message.(1 === \count($exceptions)
? $firstFailure->getMessage()
: \sprintf('%d handlers failed. First | ] $exceptions The name of the handler should be given as key
*/
public function __construct(
private Envelope $envelope,
array $exceptions,
) {
$firstFailure = current($exceptions);
$ | {
"filepath": "src/Symfony/Component/Messenger/Exception/HandlerFailedException.php",
"language": "php",
"file_size": 1311,
"cut_index": 524,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Messenger\Exception;
/**
* Marker interface for exceptions to indicate that handling a ... | *
* @method bool forceRetry() Whether the worker should retry even when the max retry count has been reached
*/
interface RecoverableExceptionInterface extends \Throwable
{
/**
* Returns the time to wait before potentially retrying, in milliseco |
*
* @author Jérémy Derussé <jeremy@derusse.com>
| {
"filepath": "src/Symfony/Component/Messenger/Exception/RecoverableExceptionInterface.php",
"language": "php",
"file_size": 915,
"cut_index": 547,
"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\Messenger\Exception;
use Symfony\Component\Messenger\Envelo... | ope $envelope = null,
) {
$this->envelope = $envelope;
parent::__construct(\sprintf('Message of type "%s" failed validation.', $this->violatingMessage::class));
}
public function getViolatingMessage(): object
{
ret | ments EnvelopeAwareExceptionInterface
{
use EnvelopeAwareExceptionTrait;
public function __construct(
private object $violatingMessage,
private ConstraintViolationListInterface $violations,
?Envel | {
"filepath": "src/Symfony/Component/Messenger/Exception/ValidationFailedException.php",
"language": "php",
"file_size": 1157,
"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\Messenger\Exception;
/**
* @author Jeroen <https://github.com/Jeroeny>
*
* ... | this->getWrappedExceptionsRecursively($class, $recursive, $this->exceptions);
}
/**
* @param class-string<\Throwable>|null $class
* @param iterable<\Throwable> $exceptions
*
* @return \Throwable[]
*/
private f | * @return \Throwable[]
*
* @psalm-return ($class is null ? \Throwable[] : TException[])
*/
public function getWrappedExceptions(?string $class = null, bool $recursive = false): array
{
return $ | {
"filepath": "src/Symfony/Component/Messenger/Exception/WrappedExceptionsTrait.php",
"language": "php",
"file_size": 1667,
"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\Messenger\Attribute;
/**
* Service tag to autoconfigure message handlers.
*
... | om which this handler can receive messages, by default all transports.
*/
public ?string $fromTransport = null,
/**
* Type of messages (FQCN) that can be processed by the handler, only needed if can't be guessed by type-h | lic function __construct(
/**
* Name of the bus from which this handler can receive messages, by default all buses.
*/
public ?string $bus = null,
/**
* Name of the transport fr | {
"filepath": "src/Symfony/Component/Messenger/Attribute/AsMessageHandler.php",
"language": "php",
"file_size": 1530,
"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\Messenger\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Data... | on registerBus(string $name, TraceableMessageBus $bus): void
{
$this->traceableBuses[$name] = $bus;
}
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
// Noop. Everything | ClassStub;
/**
* @author Samuel Roze <samuel.roze@gmail.com>
*
* @final
*/
class MessengerDataCollector extends DataCollector implements LateDataCollectorInterface
{
private array $traceableBuses = [];
public functi | {
"filepath": "src/Symfony/Component/Messenger/DataCollector/MessengerDataCollector.php",
"language": "php",
"file_size": 3795,
"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\Messenger\Transport\Sender;
use Psr\Container\ContainerInterface;
use Symfony\Component\Messenger\Attribute\AsMessage;
use Symfony\Component\Messenger\Enve... | d by "type", set to an array of sender aliases
* @param ContainerInterface $sendersLocator Locator of senders, keyed by sender alias
*/
public function __construct(
private array $sendersMap,
private ContainerInterfac | ps a message to a list of senders.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SendersLocator implements SendersLocatorInterface
{
/**
* @param array<string, list<string>> $sendersMap An array, keye | {
"filepath": "src/Symfony/Component/Messenger/Transport/Sender/SendersLocator.php",
"language": "php",
"file_size": 3625,
"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\BrowserKit\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\BrowserKit\Exception\JsonException;
... | >getStatusCode(), '->getStatusCode() returns the status of the response');
}
public function testGetHeaders()
{
$response = new Response('foo', 200, ['foo' => 'bar']);
$this->assertEquals(['foo' => 'bar'], $response->getHeaders | oo', $response->getContent(), '->getContent() returns the content of the response');
}
public function testGetStatusCode()
{
$response = new Response('foo', 304);
$this->assertEquals('304', $response- | {
"filepath": "src/Symfony/Component/BrowserKit/Tests/ResponseTest.php",
"language": "php",
"file_size": 4451,
"cut_index": 614,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.