prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * This code is partially based on the Rack-Cache library by Ryan Tomayko, * which is released under the MIT license. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace S...
s a cache entry to the store for the given Request and Response. * * Existing entries are read and any that match the response are removed. This * method calls write with the new list of cache entries. * * @return string The key un
author Fabien Potencier <fabien@symfony.com> */ interface StoreInterface { /** * Locates a cached Response for the Request provided. */ public function lookup(Request $request): ?Response; /** * Write
{ "filepath": "src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php", "language": "php", "file_size": 2186, "cut_index": 563, "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\HttpKernel\Exception; class ResolverNotFoundException extends \RuntimeException { /*...
if (1 === \count($alternatives)) { $msg .= ' Did you mean this: "'; } else { $msg .= ' Did you mean one of these: "'; } $msg .= implode('", "', $alternatives).'"?'; }
"%s".', $name); if ($alternatives) {
{ "filepath": "src/Symfony/Component/HttpKernel/Exception/ResolverNotFoundException.php", "language": "php", "file_size": 892, "cut_index": 547, "middle_length": 52 }
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\HttpKernel\Exception; /** * @author Ben Ramsey <ben@benramsey.com> *...
$retryAfter = null, string $message = '', ?\Throwable $previous = null, int $code = 0, array $headers = []) { if ($retryAfter) { $headers['Retry-After'] = $retryAfter; } parent::__construct(503, $message, $previous,
*/ public function __construct(int|string|null
{ "filepath": "src/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php", "language": "php", "file_size": 864, "cut_index": 529, "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\HttpKernel\Fragment; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\UriS...
n __construct( private ?Environment $twig = null, private ?UriSigner $signer = null, private ?string $globalDefaultTemplate = null, private string $charset = 'utf-8', ) { } /** * Checks if a templating engi
.com> */ class HIncludeFragmentRenderer extends RoutableFragmentRenderer { /** * @param string|null $globalDefaultTemplate The global default content (it can be a template name or the content) */ public functio
{ "filepath": "src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php", "language": "php", "file_size": 3134, "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\HttpKernel\Attribute; /** * Validates the request signature for ...
antiago San Martin <sanmartindev@gmail.com> */ #[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION)] final class IsSignatureValid { /** @var string[] */ public readonly array
ied methods (or if no methods are specified), the signature * is checked. * * If the signature is invalid, a {@see \Symfony\Component\HttpFoundation\Exception\SignedUriException} * is thrown during validation. * * @author S
{ "filepath": "src/Symfony/Component/HttpKernel/Attribute/IsSignatureValid.php", "language": "php", "file_size": 1432, "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\HttpKernel\Attribute; use Symfony\Component\HttpKernel\Controller...
ool $disabled Whether this value resolver is disabled; this allows to enable a value resolver globally while disabling it in specific cases * @param class-string<ValueResolverInterface>|string $resolver The name
\Attribute::TARGET_PARAMETER)] class MapDateTime extends ValueResolver { /** * @param string|null $format The DateTime format to use, @see https://php.net/datetime.format * @param b
{ "filepath": "src/Symfony/Component/HttpKernel/Attribute/MapDateTime.php", "language": "php", "file_size": 1277, "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\HttpKernel\Attribute; use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\HttpFou...
antin Myakshin <molodchick@gmail.com> */ #[\Attribute(\Attribute::TARGET_PARAMETER)] class MapRequestPayload extends ValueResolver { public ArgumentMetadata $metadata; /** * @param array<string>|string|null
mponent\Validator\Constraints\GroupSequence; /** * Controller parameter tag to map the request content to typed object and validate it. * * @psalm-import-type GroupResolver from RequestPayloadValueResolver * * @author Konst
{ "filepath": "src/Symfony/Component/HttpKernel/Attribute/MapRequestPayload.php", "language": "php", "file_size": 2498, "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\HttpKernel\Attribute; use Psr\Log\LogLevel; /** * Defines t...
n */ public function __construct(public readonly string $level) { if (!\defined('Psr\Log\LogLevel::'.strtoupper($this->level))) { throw new \InvalidArgumentException(\sprintf('Invalid log level "%s".', $this->level));
Level::* $level The level to use to log the exceptio
{ "filepath": "src/Symfony/Component/HttpKernel/Attribute/WithLogLevel.php", "language": "php", "file_size": 841, "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\HttpKernel\Exception; /** * @author Grégoire Pineau <lyrixx@lyrixx.info> */ class ControllerDoesNotRet...
r = new \ReflectionProperty(\Exception::class, 'trace'); $r->setValue($this, array_merge([ [ 'line' => $line, 'file' => $file, ], ], $this->getTrace())); } private function pa
if (!$controllerDefinition = $this->parseControllerDefinition($controller)) { return; } $this->file = $controllerDefinition['file']; $this->line = $controllerDefinition['line']; $
{ "filepath": "src/Symfony/Component/HttpKernel/Exception/ControllerDoesNotReturnResponseException.php", "language": "php", "file_size": 2291, "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\HttpKernel\Fragment; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\...
estStack $requestStack = null, ) { } public function generate(ControllerReference $controller, ?Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string { if (null === $request && (null === $
@symfony.com> */ final class FragmentUriGenerator implements FragmentUriGeneratorInterface { public function __construct( private string $fragmentPath, private ?UriSigner $signer = null, private ?Requ
{ "filepath": "src/Symfony/Component/HttpKernel/Fragment/FragmentUriGenerator.php", "language": "php", "file_size": 3362, "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\HttpKernel\Attribute; use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\HttpFou...
author Konstantin Myakshin <molodchick@gmail.com> */ #[\Attribute(\Attribute::TARGET_PARAMETER)] class MapQueryString extends ValueResolver { public ArgumentMetadata $metadata; /** * @param array<string, mixed>
mponent\Validator\Constraints\GroupSequence; /** * Controller parameter tag to map the query string of the request to typed object and validate it. * * @psalm-import-type GroupResolver from RequestPayloadValueResolver * * @
{ "filepath": "src/Symfony/Component/HttpKernel/Attribute/MapQueryString.php", "language": "php", "file_size": 2128, "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\HttpKernel\Attribute; use Symfony\Component\ExpressionLanguage\Expression; /*...
$limiter The configured limiter name * @param string|Expression|\Closure|null $key A literal string key, an Expression, or a Closure (defaults to client IP + method + path) * @param int $tokens The number of tok
BLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION)] final class RateLimit { /** @var string[] */ public readonly array $methods; /** * @param string
{ "filepath": "src/Symfony/Component/HttpKernel/Attribute/RateLimit.php", "language": "php", "file_size": 1759, "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\HttpKernel\Fragment; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\UriS...
instance of InlineFragmentRenderer. * * @param FragmentRendererInterface $inlineStrategy The inline strategy to use when the surrogate is not supported */ public function __construct( private ?SurrogateInterface $surrogate,
uthor Fabien Potencier <fabien@symfony.com> */ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRenderer { /** * The "fallback" strategy when surrogate is not available should always be an *
{ "filepath": "src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php", "language": "php", "file_size": 3712, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Fragment; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\H...
enderer { public function __construct( private HttpKernelInterface $kernel, private ?EventDispatcherInterface $dispatcher = null, ) { } /** * Additional available options: * * * alt: an alternative URI to re
rInterface; /** * Implements the inline rendering strategy where the Request is rendered by the current HTTP kernel. * * @author Fabien Potencier <fabien@symfony.com> */ class InlineFragmentRenderer extends RoutableFragmentR
{ "filepath": "src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php", "language": "php", "file_size": 5288, "cut_index": 716, "middle_length": 229 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\Attribute; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; /** * Defines which value resol...
er to use * @param bool $disabled Whether this value resolver is disabled; this allows to enable a value resolver globally while disabling it in specific cases */ public function __construct( pub
rface>|string $resolver The class name of the resolv
{ "filepath": "src/Symfony/Component/HttpKernel/Attribute/ValueResolver.php", "language": "php", "file_size": 967, "cut_index": 582, "middle_length": 52 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\HttpCache; use Symfony\Component\HttpFoundation\IpUtils; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Resp...
et = Request::getTrustedHeaderSet(); // remove untrusted values $remoteAddr = $request->server->get('REMOTE_ADDR'); if (!$remoteAddr || !IpUtils::checkIp($remoteAddr, $trustedProxies)) { $trustedHeaders = [
ernelInterface $kernel, Request $request, int $type, bool $catch): Response { // save global state related to trusted headers and proxies $trustedProxies = Request::getTrustedProxies(); $trustedHeaderS
{ "filepath": "src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php", "language": "php", "file_size": 3924, "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\HttpKernel\EventListener; use Symfony\Component\EventDispat...
dds request formats. */ public function onKernelRequest(RequestEvent $event): void { $request = $event->getRequest(); foreach ($this->formats as $format => $mimeTypes) { $request->setFormat($format, $mimeTypes);
r Gildas Quemener <gildas.quemener@gmail.com> * * @final */ class AddRequestFormatsListener implements EventSubscriberInterface { public function __construct( private array $formats, ) { } /** * A
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php", "language": "php", "file_size": 1155, "cut_index": 518, "middle_length": 229 }
mponent\DependencyInjection\ServicesResetter; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel...
s KernelTest extends TestCase { protected function tearDown(): void { try { (new Filesystem())->remove(__DIR__.'/Fixtures/var'); } catch (IOException $e) { } } public function testConstructor() {
Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles; use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService; clas
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/KernelTest.php", "language": "php", "file_size": 30462, "cut_index": 1331, "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\HttpKernel\Tests; use Psr\Log\AbstractLogger; class Logger extends AbstractLogger { protected array $logs; public...
'emergency' => [], 'alert' => [], 'critical' => [], 'error' => [], 'warning' => [], 'notice' => [], 'info' => [], 'debug' => [], ]; } public function log($
r(): void { $this->logs = [
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Logger.php", "language": "php", "file_size": 990, "cut_index": 582, "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\HttpKernel\Tests; use Symfony\Component\EventDispatcher\EventDisp...
construct() { parent::__construct(new EventDispatcher(), $this, null, $this); } public function getController(Request $request): callable|false { return $this->callController(...); } public function getArguments(Re
t\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\HttpKernel; class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { public function __
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php", "language": "php", "file_size": 1277, "cut_index": 524, "middle_length": 229 }
\Response; use Symfony\Component\HttpKernel\HttpCache\Esi; use Symfony\Component\HttpKernel\HttpCache\HttpCache; class EsiTest extends TestCase { public function testHasSurrogateEsiCapability() { $esi = new Esi(); $request = Request::create('/'); $request->headers->set('Surrogate-Capab...
eEsiCapability() { $esi = new Esi(); $request = Request::create('/'); $esi->addSurrogateCapability($request); $this->assertEquals('symfony="ESI/1.0"', $request->headers->get('Surrogate-Capability')); $esi->addS
oobar'); $this->assertFalse($esi->hasSurrogateCapability($request)); $request = Request::create('/'); $this->assertFalse($esi->hasSurrogateCapability($request)); } public function testAddSurrogat
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php", "language": "php", "file_size": 9920, "cut_index": 921, "middle_length": 229 }
als(2, $this->response->headers->get('Age')); $this->cache->terminate($this->request, $this->response); $this->assertCount(1, $terminateEvents); } #[DataProvider('provideTerminateBackendRequestCases')] public function testTerminateUsesBackendRequestOnCacheMiss(string $method, string $expec...
}); $this->setNextResponse( 200, ['Cache-Control' => 'public, s-maxage=60'], 'Hello World', static function (Request $request): void { $request->attributes->set('terminate_attr
illReturnCallback(static function ($event) use (&$terminateEvents) { if ($event instanceof TerminateEvent) { $terminateEvents[] = $event; } return $event;
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php", "language": "php", "file_size": 92777, "cut_index": 3790, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\HttpCache; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\HttpCache\Esi; use Symfony\Component\HttpKernel\HttpCache\HttpC...
ected function setUp(): void { $this->kernel = null; $this->cache = null; $this->esi = null; $this->caches = []; $this->cacheConfig = []; $this->request = null; $this->response = null; $
otected $cache; protected $caches; protected $cacheConfig; protected $request; protected $response; protected $responses; protected $catch; protected $esi; protected ?Store $store = null; prot
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php", "language": "php", "file_size": 5547, "cut_index": 716, "middle_length": 229 }
response2 = new Response(); $response2->setSharedMaxAge(3600); $cacheStrategy->add($response2); $response = new Response(); $response->setSharedMaxAge(86400); $cacheStrategy->update($response); $this->assertSame('60', $response->headers->getCacheControlDirective('s-maxa...
00); $cacheStrategy->update($response); $this->assertFalse($response->headers->hasCacheControlDirective('s-maxage')); } public function testSharedMaxAgeNotSetIfNotSetInMainRequest() { $cacheStrategy = new ResponseCache
$response1->setSharedMaxAge(60); $cacheStrategy->add($response1); $response2 = new Response(); $cacheStrategy->add($response2); $response = new Response(); $response->setSharedMaxAge(864
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/ResponseCacheStrategyTest.php", "language": "php", "file_size": 21860, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\HttpCache; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\HttpCache\HttpCache; use Symfony\Component\HttpKernel\HttpCache\Ssi; c...
assertFalse($ssi->hasSurrogateCapability($request)); $request = Request::create('/'); $this->assertFalse($ssi->hasSurrogateCapability($request)); } public function testAddSurrogateSsiCapability() { $ssi = new Ssi();
rrogate-Capability', 'abc="SSI/1.0"'); $this->assertTrue($ssi->hasSurrogateCapability($request)); $request = Request::create('/'); $request->headers->set('Surrogate-Capability', 'foobar'); $this->
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php", "language": "php", "file_size": 7518, "cut_index": 716, "middle_length": 229 }
estCase::clearDirectory(sys_get_temp_dir().'/http_cache'); $this->store = new Store(sys_get_temp_dir().'/http_cache'); } protected function tearDown(): void { HttpCacheTestCase::clearDirectory(sys_get_temp_dir().'/http_cache'); } public function testReadsAnEmptyArrayWithReadWhenNo...
>request)); } public function testRemovesEntriesForKeyWithPurge() { $request = Request::create('/foo'); $this->store->write($request, new Response('foo')); $metadata = $this->getStoreMetadata($request); $this->
$this->store->lock($this->request); $this->assertTrue($this->store->unlock($this->request)); } public function testUnlockFileThatDoesNotExist() { $this->assertFalse($this->store->unlock($this-
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php", "language": "php", "file_size": 24321, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\HttpCache; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\HttpCache\SubRequestHandler; use Symfony\Component\HttpKernel\HttpKerne...
roxies(['10.0.0.1'], -1); $globalState = $this->getGlobalState(); $request = Request::create('/'); $request->server->set('REMOTE_ADDR', '10.0.0.1'); $request->headers->set('X-Forwarded-For', '10.0.0.2'); $request->h
e(); } protected function tearDown(): void { Request::setTrustedProxies(self::$globalState[0], self::$globalState[1]); } public function testTrustedHeadersAreKept() { Request::setTrustedP
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php", "language": "php", "file_size": 6220, "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\HttpKernel\Tests\HttpCache; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Http...
d int $status; protected array $headers; protected bool $called = false; protected ?\Closure $customizer; protected bool $catch = false; protected array $backendRequest; public function __construct($body, $status, $headers, ?\Closu
ernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { protected ?string $body = null; protecte
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php", "language": "php", "file_size": 3110, "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\HttpKernel\Tests\HttpCache; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component...
nterface { protected array $bodies = []; protected array $statuses = []; protected array $headers = []; protected bool $called = false; protected Request $backendRequest; public function __construct($responses) { foreac
ollerResolverInterface; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverI
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php", "language": "php", "file_size": 2329, "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\HttpKernel\Tests\Exception; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCas...
blic function testHeadersDefault() { $exception = $this->createException(); $this->assertSame([], $exception->getHeaders()); } #[DataProvider('headerDataProvider')] public function testHeadersConstructor($headers) {
-Test' => 'Test']], [['X-Test' => 1]], [ [ ['X-Test' => 'Test'], ['X-Test-2' => 'Test-2'], ], ], ]; } pu
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Exception/HttpExceptionTest.php", "language": "php", "file_size": 2642, "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\HttpKernel\Tests\Exception; use PHPUnit\Framework\Attributes\DataProvider; use...
testWithHeaderConstruct() { $headers = [ 'Cache-Control' => 'public, s-maxage=1200', ]; $exception = new MethodNotAllowedHttpException(['get'], '', null, 0, $headers); $headers['Allow'] = 'GET'; $
est { public function testHeadersDefault() { $exception = new MethodNotAllowedHttpException(['GET', 'PUT']); $this->assertSame(['Allow' => 'GET, PUT'], $exception->getHeaders()); } public function
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php", "language": "php", "file_size": 1609, "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\HttpKernel\Tests\Exception; use PHPUnit\Framework\Attributes\DataProvider; use...
on testWithHeaderConstruct() { $headers = [ 'Cache-Control' => 'public, s-maxage=1337', ]; $exception = new ServiceUnavailableHttpException(1337, '', null, 0, $headers); $headers['Retry-After'] = 1337;
ionTest { public function testHeadersDefaultRetryAfter() { $exception = new ServiceUnavailableHttpException(10); $this->assertSame(['Retry-After' => 10], $exception->getHeaders()); } public functi
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php", "language": "php", "file_size": 1611, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\EventListener; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Resp...
\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; use
y\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\KernelEvents; use Symfony
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/RouterListener.php", "language": "php", "file_size": 7643, "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\HttpKernel\Tests\Exception; use PHPUnit\Framework\Attributes\DataProvider; use...
thHeaderConstruct() { $headers = [ 'Cache-Control' => 'public, s-maxage=69', ]; $exception = new TooManyRequestsHttpException(69, '', null, 0, $headers); $headers['Retry-After'] = 69; $this->assert
t { public function testHeadersDefaultRertyAfter() { $exception = new TooManyRequestsHttpException(10); $this->assertSame(['Retry-After' => 10], $exception->getHeaders()); } public function testWi
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php", "language": "php", "file_size": 1587, "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\HttpKernel\Tests\Exception; use PHPUnit\Framework\Attributes\DataProvider; use...
stWithHeaderConstruct() { $headers = [ 'Cache-Control' => 'public, s-maxage=1200', ]; $exception = new UnauthorizedHttpException('Challenge', '', null, 0, $headers); $headers['WWW-Authenticate'] = 'Challeng
public function testHeadersDefault() { $exception = new UnauthorizedHttpException('Challenge'); $this->assertSame(['WWW-Authenticate' => 'Challenge'], $exception->getHeaders()); } public function te
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Exception/UnauthorizedHttpExceptionTest.php", "language": "php", "file_size": 1623, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Request; use Symfony\Componen...
rnelBrowser(new TestHttpKernel()); $client->request('GET', '/'); $this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request'); $this->assertInstanceOf(\Symfon
loadFileWithClientSize; use Symfony\Component\HttpKernel\Tests\Fixtures\TestClient; #[Group('time-sensitive')] class HttpKernelBrowserTest extends TestCase { public function testDoRequest() { $client = new HttpKe
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php", "language": "php", "file_size": 8375, "cut_index": 716, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\Htt...
face { public function resolve(Request $request, ArgumentMetadata $argument): array { if ($request->attributes->has($argument->getName())) { return []; } if (Request::class === $argument->getType() || is_subclas
Exception\NearMissValueResolverException; /** * Yields the same instance as the request object passed along. * * @author Iltar van der Berg <kjarli@gmail.com> */ final class RequestValueResolver implements ValueResolverInter
{ "filepath": "src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php", "language": "php", "file_size": 1417, "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\HttpKernel\Controller\ArgumentResolver; use Psr\Container\ContainerInterface; use Symfony\Component\Depe...
l class ServiceValueResolver implements ValueResolverInterface { public function __construct( private ContainerInterface $container, ) { } public function resolve(Request $request, ArgumentMetadata $argument): array { $
ontrollerMetadata\ArgumentMetadata; use Symfony\Component\HttpKernel\Exception\NearMissValueResolverException; /** * Yields a service keyed by _controller and argument name. * * @author Nicolas Grekas <p@tchwork.com> */ fina
{ "filepath": "src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php", "language": "php", "file_size": 2520, "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\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\Htt...
if ($argument->isVariadic() || !\is_string($value = $request->attributes->get($argument->getName())) || null === ($uidClass = $argument->getType()) || !is_subclass_of($uidClass, AbstractUid::class, true) ) {
Exception\NotFoundHttpException; use Symfony\Component\Uid\AbstractUid; final class UidValueResolver implements ValueResolverInterface { public function resolve(Request $request, ArgumentMetadata $argument): array {
{ "filepath": "src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/UidValueResolver.php", "language": "php", "file_size": 1303, "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\HttpKernel\CacheWarmer; /** * Abstract cache warmer that knows how to write a file to t...
, basename($file)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { @chmod($file, 0o666 & ~umask()); return; } throw new \RuntimeException(\sprintf('Failed to write cache
id { $tmpFile = @tempnam(\dirname($file)
{ "filepath": "src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php", "language": "php", "file_size": 886, "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\HttpKernel\CacheWarmer; /** * Interface for classes that ...
ram string|null $buildDir Where read-only artifacts should go; null when called after compile-time * * @return string[] A list of classes or files to preload */ public function warmUp(string $cacheDir, ?string $buildDir = null): array; }
Where warm-up artifacts should be stored * @pa
{ "filepath": "src/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php", "language": "php", "file_size": 826, "cut_index": 517, "middle_length": 52 }
mponent\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionUtils; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\Event\ResponseEvent; use Sy...
that case. * If you have a scenario where caching responses with session information in * them makes sense, you can disable this behaviour by setting the header * AbstractSessionListener::NO_AUTO_CACHE_CONTROL_HEADER on the response. * * @author Johan
the request on the "kernel.request" event and saves * it on the "kernel.response" event. * * In addition, if the session has been started it overrides the Cache-Control * header in such a way that all caching is disabled in
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php", "language": "php", "file_size": 12458, "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\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; use ...
lerAttributeEvent::class); class_exists(ExpressionLanguage::class); /** * Dispatches events for controller attributes. * * @author Nicolas Grekas <p@tchwork.com> */ class ControllerAttributesListener implements EventSubscriberInterface { /**
y\Component\HttpKernel\Event\KernelEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; // Help opcache.preload discover always-needed symbols class_exists(Control
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/ControllerAttributesListener.php", "language": "php", "file_size": 4799, "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\HttpKernel\EventListener; use Symfony\Component\EventDis...
eEvent $event): void { if (!$event->getResponse()->headers->has(static::HEADER_NAME)) { $event->getResponse()->headers->set(static::HEADER_NAME, 'noindex'); } } public static function getSubscribedEvents(): array
arch engines. * * @author Gary PEGEOT <garypegeot@gmail.com> */ class DisallowRobotsIndexingListener implements EventSubscriberInterface { private const HEADER_NAME = 'X-Robots-Tag'; public function onResponse(Respons
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/DisallowRobotsIndexingListener.php", "language": "php", "file_size": 1100, "cut_index": 515, "middle_length": 229 }
onent\ErrorHandler\Exception\FlattenException; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; use Symfony\Component\HttpKernel\Attribute\WithLogLevel; use Symfony\Component\HttpKernel\Event\Controll...
* @author Fabien Potencier <fabien@symfony.com> */ class ErrorListener implements EventSubscriberInterface { /** * @param array<class-string, array{log_level: string|null, status_code: int<100,599>|null, log_channel: string|null}> $exceptionsMapp
fony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Log\DebugLoggerConfigurator; /**
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php", "language": "php", "file_size": 9763, "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\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Co...
ows an AccessDeniedHttpException exception if the request * is not signed or if it is not an internal sub-request. * * @author Fabien Potencier <fabien@symfony.com> * * @final */ class FragmentListener implements EventSubscriberInterface { /**
Exception; use Symfony\Component\HttpKernel\KernelEvents; /** * Handles content fragments represented by special URIs. * * All URL paths starting with /_fragment are handled as * content fragments by this listener. * * Thr
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php", "language": "php", "file_size": 2894, "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\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Co...
@author Fabien Potencier <fabien@symfony.com> * * @final */ class LocaleListener implements EventSubscriberInterface { public function __construct( private RequestStack $requestStack, private string $defaultLocale = 'en', pri
; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Routing\RequestContextAwareInterface; /** * Initializes the locale based on the current request. * *
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php", "language": "php", "file_size": 3000, "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\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Co...
AFW-ALLAH <ayyoub.afwallah@gmail.com> */ final class RateLimitAttributeListener implements EventSubscriberInterface { /** * @param ServiceProviderInterface<RateLimiterFactoryInterface> $limiters */ public function __construct( pr
mponent\HttpKernel\KernelEvents; use Symfony\Component\RateLimiter\RateLimiterFactoryInterface; use Symfony\Contracts\Service\ServiceProviderInterface; /** * Handles the RateLimit attribute on controllers. * * @author Ayyoub
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/RateLimitAttributeListener.php", "language": "php", "file_size": 2716, "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\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscribe...
geHeader = false, ) { } /** * Filters the Response. */ public function onKernelResponse(ResponseEvent $event): void { if (!$event->isMainRequest()) { return; } $response = $event->getRespo
@author Fabien Potencier <fabien@symfony.com> * * @final */ class ResponseListener implements EventSubscriberInterface { public function __construct( private string $charset, private bool $addContentLangua
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php", "language": "php", "file_size": 1752, "cut_index": 537, "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\HttpKernel\EventListener; use Psr\Container\ContainerI...
struct($container, $debug, $sessionOptions); } protected function getSession(): ?SessionInterface { if ($this->container->has('session_factory')) { return $this->container->get('session_factory')->createSession(); }
sionListener extends AbstractSessionListener { public function __construct( private ?ContainerInterface $container = null, bool $debug = false, array $sessionOptions = [], ) { parent::__con
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/SessionListener.php", "language": "php", "file_size": 1029, "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\HttpKernel\EventListener; use Symfony\Component\EventDispat...
(!$event->isMainRequest()) { return; } $request = $event->getRequest(); if ($request::getTrustedProxies()) { $request->getClientIps(); } $request->getHost(); } public static functi
magnus@fervo.se> * * @final */ class ValidateRequestListener implements EventSubscriberInterface { /** * Performs the validation. */ public function onKernelRequest(RequestEvent $event): void { if
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php", "language": "php", "file_size": 1173, "cut_index": 518, "middle_length": 229 }
\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\ControllerDoesNotRetur...
* Catch exceptions: true * Throwable type: RuntimeException * Listener: false. */ public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue() { $this->expectException(\RuntimeException::class); $kernel
\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Tests\Fixtures\Attribute\Bar; class HttpKernelTest extends TestCase { /**
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php", "language": "php", "file_size": 23634, "cut_index": 1331, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Compone...
( private ValueResolverInterface $inner, private Stopwatch $stopwatch, ) { } public function resolve(Request $request, ArgumentMetadata $argument): iterable { $method = $this->inner::class.'::'.__FUNCTION__;
atch\Stopwatch; /** * Provides timing information via the stopwatch. * * @author Iltar van der Berg <kjarli@gmail.com> */ final class TraceableValueResolver implements ValueResolverInterface { public function __construct
{ "filepath": "src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/TraceableValueResolver.php", "language": "php", "file_size": 1190, "cut_index": 518, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\CacheWarmer; use Symfony\Component\Console\Style\SymfonyStyle; /** * Aggregates several cache warmers into a single one. * * @author Fabien ...
tionLogsFilepath = null, ) { } public function enableOptionalWarmers(): void { $this->optionalsEnabled = true; } public function enableOnlyOptionalWarmers(): void { $this->onlyOptionalsEnabled = $this->optional
= false; /** * @param iterable<mixed, CacheWarmerInterface> $warmers */ public function __construct( private iterable $warmers = [], private bool $debug = false, private ?string $depreca
{ "filepath": "src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php", "language": "php", "file_size": 4541, "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\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscribe...
SurrogateListener implements EventSubscriberInterface { public function __construct( private ?SurrogateInterface $surrogate = null, ) { } /** * Filters the Response. */ public function onKernelResponse(ResponseEvent $
ny\Component\HttpKernel\KernelEvents; /** * SurrogateListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for Surrogates. * * @author Fabien Potencier <fabien@symfony.com> * * @final */ class
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php", "language": "php", "file_size": 1751, "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\HttpKernel\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFo...
$response = $this->createStub(ResponseInterface::class); $response->method('getStatusCode')->willReturn(200); $client = $this->createMock(HttpClientInterface::class); $client ->expects($this->once()) ->metho
KernelTest extends TestCase { public function testHandlePassesMaxRedirectsHttpClientOption() { $request = new Request(); $request->attributes->set('http_client_options', ['max_redirects' => 50]);
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/HttpClientKernelTest.php", "language": "php", "file_size": 1558, "cut_index": 537, "middle_length": 229 }
use Symfony\Component\ExpressionLanguage\ExpressionLanguage; use Symfony\Component\HttpFoundation\HeaderBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\Cache; use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent; us...
guage $expressionLanguage = null, ) { } public function onKernelControllerAttribute(ControllerAttributeEvent $event): void { $cache = $event->attribute; $kernelEvent = $event->kernelEvent; $request = $event->kernelE
eaders configured via the Cache attribute. * * @author Fabien Potencier <fabien@symfony.com> */ class CacheAttributeListener implements EventSubscriberInterface { public function __construct( private ?ExpressionLan
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/CacheAttributeListener.php", "language": "php", "file_size": 11044, "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\HttpKernel\EventListener; use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\Console\Eve...
criberInterface { /** * @param ?DataDumperInterface $profilerDumper The dumper to use when CLI profiling is enabled. * If null, the default $dumper will be used instead. */ public function
rInterface; use Symfony\Component\VarDumper\Server\Connection; use Symfony\Component\VarDumper\VarDumper; /** * Configures dump() handler. * * @author Nicolas Grekas <p@tchwork.com> */ class DumpListener implements EventSubs
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/DumpListener.php", "language": "php", "file_size": 2311, "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\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Co...
terface { /** * @param iterable<mixed, LocaleAwareInterface> $localeAwareServices */ public function __construct( private iterable $localeAwareServices, private RequestStack $requestStack, ) { } public functio
ts; use Symfony\Contracts\Translation\LocaleAwareInterface; /** * Pass the current locale to the provided services. * * @author Pierre Bobiet <pierrebobiet@gmail.com> */ class LocaleAwareListener implements EventSubscriberIn
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/LocaleAwareListener.php", "language": "php", "file_size": 2296, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestMatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symf...
t by listening to the kernel events. * * @author Fabien Potencier <fabien@symfony.com> * * @final */ class ProfilerListener implements EventSubscriberInterface { private ?\Throwable $exception = null; /** @var \SplObjectStorage<Request, Profil
t\TerminateEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Profiler\Profile; use Symfony\Component\HttpKernel\Profiler\Profiler; /** * ProfilerListener collects data for the current reques
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php", "language": "php", "file_size": 5175, "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\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack;...
$this->requestStack->push(Request::create('/')); } public function testRenderWhenRendererDoesNotExist() { $this->expectException(\InvalidArgumentException::class); $handler = new FragmentHandler($this->requestStack); $
ernel\Fragment\FragmentRendererInterface; class FragmentHandlerTest extends TestCase { private RequestStack $requestStack; protected function setUp(): void { $this->requestStack = new RequestStack();
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php", "language": "php", "file_size": 3717, "cut_index": 614, "middle_length": 229 }
Dispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKe...
entRendererTest extends TestCase { public function testRender() { $strategy = new InlineFragmentRenderer($this->getKernel(new Response('foo'))); $this->assertEquals('foo', $strategy->render('/', Request::create('/'))->getContent())
Kernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; #[Group('time-sensitive')] class InlineFragm
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php", "language": "php", "file_size": 13573, "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\HttpKernel\Tests\Fragment; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use...
#[DataProvider('getGenerateFragmentUriData')] public function testGenerateAbsoluteFragmentUri($uri, $controller) { $this->assertEquals('http://localhost'.$uri, $this->callGenerateFragmentUriMethod($controller, Request::create('/'), true))
ataProvider('getGenerateFragmentUriData')] public function testGenerateFragmentUri($uri, $controller) { $this->assertEquals($uri, $this->callGenerateFragmentUriMethod($controller, Request::create('/'))); }
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Fragment/RoutableFragmentRendererTest.php", "language": "php", "file_size": 3756, "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\HttpKernel\Tests\Attribute; use PHPUnit\Framework\Test...
his->expectException(\InvalidArgumentException::class); new RateLimit('api', tokens: 0); } public function testMethodsAreNormalized() { $rl = new RateLimit('api', methods: ['get', 'post']); $this->assertSame(['GET', 'PO
>assertSame('api', $rl->limiter); $this->assertNull($rl->key); $this->assertSame(1, $rl->tokens); $this->assertSame([], $rl->methods); } public function testTokensMustBePositive() { $t
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Attribute/RateLimitTest.php", "language": "php", "file_size": 1035, "cut_index": 513, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use Composer\InstalledVersions; use PHPUnit\Framework\TestCase; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Com...
s->assertTrue($c->isDebug()); $this->assertSame('config', $c->getName()); $this->assertMatchesRegularExpression('~^'.preg_quote($c->getPhpVersion(), '~').'~', \PHP_VERSION); $this->assertMatchesRegularExpression('~'.preg_quote((stri
$kernel = new KernelForTest('test', true); $c = new ConfigDataCollector(); $c->setKernel($kernel); $c->collect(new Request(), new Response()); $this->assertSame('test', $c->getEnv()); $thi
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php", "language": "php", "file_size": 5100, "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\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\TestCase; use Symfony\Co...
eption::createWithDataRepresentation($e); $trace = $flattened->getTrace(); $this->assertFalse($c->hasException()); $c->collect(new Request(), new Response(), $e); $this->assertTrue($c->hasException()); $this->asse
eptionDataCollector; class ExceptionDataCollectorTest extends TestCase { public function testCollect() { $e = new \Exception('foo', 500); $c = new ExceptionDataCollector(); $flattened = FlattenExc
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/DataCollector/ExceptionDataCollectorTest.php", "language": "php", "file_size": 1973, "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\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\Attributes\DataProvider;...
collector->getMemory()); $this->assertIsInt($collector->getMemoryLimit()); $this->assertSame('memory', $collector->getName()); } #[DataProvider('getBytesConversionTestData')] public function testBytesConversion($limit, $bytes)
; class MemoryDataCollectorTest extends TestCase { public function testCollect() { $collector = new MemoryDataCollector(); $collector->collect(new Request(), new Response()); $this->assertIsInt($
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php", "language": "php", "file_size": 1802, "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\HttpKernel\Controller\ArgumentResolver; use Symfony\Compone...
uest, ArgumentMetadata $argument): array { if (!$request->hasSession()) { return []; } $type = $argument->getType(); if (SessionInterface::class !== $type && !is_subclass_of($type, SessionInterface::class))
ontrollerMetadata\ArgumentMetadata; /** * Yields the Session. * * @author Iltar van der Berg <kjarli@gmail.com> */ final class SessionValueResolver implements ValueResolverInterface { public function resolve(Request $req
{ "filepath": "src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php", "language": "php", "file_size": 1232, "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\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\Htt...
$argument): array { if (!$argument->isVariadic() || !$request->attributes->has($argument->getName())) { return []; } $values = $request->attributes->get($argument->getName()); if (!\is_array($values)) {
t's values from the request attributes. * * @author Iltar van der Berg <kjarli@gmail.com> */ final class VariadicValueResolver implements ValueResolverInterface { public function resolve(Request $request, ArgumentMetadata
{ "filepath": "src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php", "language": "php", "file_size": 1281, "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\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Co...
portedFormatException; use Symfony\Component\Serializer\SerializerInterface; /** * @author Konstantin Myakshin <molodchick@gmail.com> */ final class SerializeControllerResultAttributeListener implements EventSubscriberInterface { public function __c
vent; use Symfony\Component\HttpKernel\Event\ViewEvent; use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Serializer\Exception\Unsup
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/SerializeControllerResultAttributeListener.php", "language": "php", "file_size": 2974, "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\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\UriSigner; us...
(), $this->getInlineStrategy(true)); $strategy->render('/', Request::create('/')); } public function testRenderFallbackWithScalar() { $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner(
use Symfony\Component\HttpKernel\HttpCache\Esi; class EsiFragmentRendererTest extends TestCase { public function testRenderFallbackToInlineStrategyIfEsiNotSupported() { $strategy = new EsiFragmentRenderer(new Esi
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php", "language": "php", "file_size": 5071, "cut_index": 614, "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\HttpKernel\Tests\Attribute; use PHPUnit\Framework\TestCase; use Psr\Log\LogLevel; use Symfony\Component\HttpKernel\Attribut...
evel($logLevel); $this->assertSame($logLevel, $attribute->level); } public function testWithInvalidLogLevel() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Invalid log level
LogLevel::NOTICE; $attribute = new WithLogL
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Attribute/WithLogLevelTest.php", "language": "php", "file_size": 951, "cut_index": 582, "middle_length": 52 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\TestCase; use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFo...
a->withContext(['label' => 'foo']); $collector = new DumpDataCollector(null, new FileLinkFormatter([])); $this->assertSame('dump', $collector->getName()); $collector->dump($data); $line = __LINE__ - 1; $this->asse
Component\VarDumper\Server\Connection; /** * @author Nicolas Grekas <p@tchwork.com> */ class DumpDataCollectorTest extends TestCase { public function testDump() { $data = new Data([[123]]); $data = $dat
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php", "language": "php", "file_size": 7409, "cut_index": 716, "middle_length": 229 }
Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Sy...
testCollect() { $c = new RequestDataCollector(); $c->collect($request = $this->createRequest(), $this->createResponse()); $c->lateCollect(); $attributes = $c->getRequestAttributes(); $this->assertSame('reques
nt\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Tests\Fixtures\DataCollector\DummyController; class RequestDataCollectorTest extends TestCase { public function
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php", "language": "php", "file_size": 20791, "cut_index": 1331, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Co...
om> */ class IsSignatureValidAttributeListener implements EventSubscriberInterface { public function __construct( private readonly UriSigner $uriSigner, ) { } public function onKernelControllerAttribute(ControllerAttributeEvent $e
gumentsEvent; use Symfony\Component\HttpKernel\Event\ControllerAttributeEvent; use Symfony\Component\HttpKernel\KernelEvents; /** * Handles the IsSignatureValid attribute. * * @author Santiago San Martin <sanmartindev@gmail.c
{ "filepath": "src/Symfony/Component/HttpKernel/EventListener/IsSignatureValidAttributeListener.php", "language": "php", "file_size": 2419, "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\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\UriSigner; us...
(), $this->getInlineStrategy(true)); $strategy->render('/', Request::create('/')); } public function testRender() { $strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy()); $request = Request::create
use Symfony\Component\HttpKernel\HttpCache\Ssi; class SsiFragmentRendererTest extends TestCase { public function testRenderFallbackToInlineStrategyIfSsiNotSupported() { $strategy = new SsiFragmentRenderer(new Ssi
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Fragment/SsiFragmentRendererTest.php", "language": "php", "file_size": 4415, "cut_index": 614, "middle_length": 229 }
ler\Exception\SilencedErrorContext; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; use Symfony\C...
is->exactly(2))->method('getLogs')->willReturn([]); $c = new LoggerDataCollector($logger, __DIR__.'/'); $c->lateCollect(); $compilerLogs = $c->getCompilerLogs()->getValue(true); $this->assertSame([ ['message' =
er(DebugLoggerInterface::class) ->onlyMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->willReturn(123); $logger->expects($th
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php", "language": "php", "file_size": 10623, "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\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\UriSigner; us...
$strategy->render(new ControllerReference('main_controller', [], []), Request::create('/')); } public function testRenderWithControllerAndSigner() { $strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo')); $t
cludeFragmentRendererTest extends TestCase { public function testRenderExceptionWhenControllerAndNoSigner() { $this->expectException(\LogicException::class); $strategy = new HIncludeFragmentRenderer();
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Fragment/HIncludeFragmentRendererTest.php", "language": "php", "file_size": 4003, "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\HttpKernel\Tests\Controller\ArgumentResolver; use PHPUnit\Framework\TestCase; use Symfony\Component\Http...
$request = new Request(); $request->attributes->set('id', '123'); $metadata = new ArgumentMetadata('id', 'int', false, false, null); $result = iterator_to_array($resolver->resolve($request, $metadata)); $this->ass
y\Component\HttpKernel\Exception\NotFoundHttpException; class RequestAttributeValueResolverTest extends TestCase { public function testValidIntWithinRangeWorks() { $resolver = new RequestAttributeValueResolver();
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/RequestAttributeValueResolverTest.php", "language": "php", "file_size": 2372, "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\HttpKernel\Tests\Controller\ArgumentResolver; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoun...
ss UidValueResolverTest extends TestCase { #[DataProvider('provideSupports')] public function testSupports(bool $expected, Request $request, ArgumentMetadata $argument) { $this->assertCount((int) $expected, (new UidValueResolver())->res
ernel\Exception\NotFoundHttpException; use Symfony\Component\Uid\AbstractUid; use Symfony\Component\Uid\Factory\UlidFactory; use Symfony\Component\Uid\Ulid; use Symfony\Component\Uid\UuidV1; use Symfony\Component\Uid\UuidV4; cla
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UidValueResolverTest.php", "language": "php", "file_size": 4993, "cut_index": 614, "middle_length": 229 }
on\HttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Exception\ValidationFailedException; use Symfony\Component\Validator\ValidatorBuilder; class UploadedFileValueResol...
lse, false, null, false, [$attribute::class => $attribute] ); $event = new ControllerArgumentsEvent( $this->createStub(HttpKernelInterface::class), static function () {
testDefaults(RequestPayloadValueResolver $resolver, Request $request) { $attribute = new MapUploadedFile(); $argument = new ArgumentMetadata( 'foo', UploadedFile::class, fa
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UploadedFileValueResolverTest.php", "language": "php", "file_size": 18078, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\CacheWarmer; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; class Cach...
nableOptionalWarmersIsEnabled() { $warmer = $this->createMock(CacheWarmerInterface::class); $warmer ->expects($this->never()) ->method('isOptional'); $warmer ->expects($this->once())
->expects($this->once()) ->method('warmUp'); $aggregate = new CacheWarmerAggregate([$warmer]); $aggregate->warmUp(__DIR__); } public function testWarmupDoesCallWarmupOnOptionalWarmersWhenE
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php", "language": "php", "file_size": 5300, "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\HttpKernel\Tests\CacheWarmer; use PHPUnit\Framework\TestCase; use Symfony\Comp...
le() { $warmer = new TestCacheWarmer(self::$cacheFile); $warmer->warmUp(\dirname(self::$cacheFile)); $this->assertFileExists(self::$cacheFile); } public function testWriteNonWritableCacheFileThrowsARuntimeException()
elf::$cacheFile = tempnam(sys_get_temp_dir(), 'sf_cache_warmer_dir'); } public static function tearDownAfterClass(): void { @unlink(self::$cacheFile); } public function testWriteCacheFileCreatesTheFi
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php", "language": "php", "file_size": 1677, "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\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Co...
st extends TestCase { private AddRequestFormatsListener $listener; protected function setUp(): void { $this->listener = new AddRequestFormatsListener(['csv' => ['text/csv', 'text/plain']]); } public function testIsAnEventSubsc
ner\AddRequestFormatsListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; /** * @author Gildas Quemener <gildas.quemener@gmail.com> */ class AddRequestFormatsListenerTe
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php", "language": "php", "file_size": 1769, "cut_index": 537, "middle_length": 229 }
Kernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\CacheAttributeController; class CacheAttributeListenerTest extends TestCase { private CacheAttributeListener $listener; private Response $response; private Cache $cache; private Request $request; private Response...
$response = $this->event->getResponse(); $this->response->setStatusCode(500); $this->listener->onKernelResponse($this->event); $this->assertSame($response, $this->event->getResponse()); } public function testWontRe
$this->request = $this->createRequest($this->cache); $this->event = $this->createEventMock($this->request, $this->response); } public function testWontReassignResponseWhenResponseIsUnsuccessful() {
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/CacheAttributeListenerTest.php", "language": "php", "file_size": 26148, "cut_index": 1331, "middle_length": 229 }
ttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent; use Symfony\Component\HttpKernel\Event\ControllerArgumentsMetadata; use Symfony\Component\HttpKernel\Event\ControllerAttributeEvent; use Symfony\Component\HttpKernel\Event\ControllerEve...
ControllerAttributesController; class ControllerAttributesListenerTest extends TestCase { public function testOnKernelControllerArgumentsDispatchesEventsForEachAttribute() { $dispatchedEvents = []; $dispatcher = new EventDispatche
Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Tests\Fixtures\Attribute\Buz; use Symfony\Component\HttpKernel\Tests\Fixtures\Attribute\Qux; use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/ControllerAttributesListenerTest.php", "language": "php", "file_size": 11693, "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\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; u...
el\Event\KernelEvent; use Symfony\Component\HttpKernel\EventListener\DebugHandlersListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; /** * @author Nicolas Grekas <p@tchwork.com> */ class DebugH
Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\ErrorHandler\ErrorHandler; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKern
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php", "language": "php", "file_size": 4704, "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\HttpKernel\Tests\EventListener; use PHPUnit\Framework\Attributes\DataProvider;...
{ #[DataProvider('provideResponses')] public function testInvoke(?string $expected, array $responseArgs) { $response = new Response(...$responseArgs); $listener = new DisallowRobotsIndexingListener(); $event = new Resp
Component\HttpKernel\EventListener\DisallowRobotsIndexingListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelInterface; class DisallowRobotsIndexingListenerTest extends TestCase
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/DisallowRobotsIndexingListenerTest.php", "language": "php", "file_size": 1561, "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\HttpKernel\Tests\EventListener; use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\ConsoleEvents; use...
r; /** * DumpListenerTest. * * @author Nicolas Grekas <p@tchwork.com> */ class DumpListenerTest extends TestCase { public function testSubscribedEvents() { $this->assertSame( [ConsoleEvents::COMMAND => ['configure', 1024]],
EventListener\DumpListener; use Symfony\Component\VarDumper\Cloner\ClonerInterface; use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\VarDumper\Dumper\DataDumperInterface; use Symfony\Component\VarDumper\VarDumpe
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php", "language": "php", "file_size": 3691, "cut_index": 614, "middle_length": 229 }
estCase; use Psr\Log\LogLevel; use Psr\Log\NullLogger; use Symfony\Component\ErrorHandler\Exception\FlattenException; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\WithHttpSta...
face; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; use Symfony\Component\HttpKernel\Tests\Logger; /** * @author Robert Schönthal <seroscho@
Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\EventListener\ErrorListener; use Symfony\Component\HttpKernel\Exception\HttpExceptionInter
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/ErrorListenerTest.php", "language": "php", "file_size": 17316, "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\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\UriSigne...
%3Dbar%26_controller%3Dfoo'); $listener = new FragmentListener(new UriSigner('foo')); $event = $this->createRequestEvent($request); $expected = $request->attributes->all(); $listener->onKernelRequest($event); $th
se Symfony\Component\HttpKernel\HttpKernelInterface; class FragmentListenerTest extends TestCase { public function testOnlyTriggeredOnFragmentRoute() { $request = Request::create('http://example.com/foo?_path=foo
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php", "language": "php", "file_size": 4355, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Exception\UnsignedUriException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\UriSigner; use Symfony\Component\HttpKern...
roller; use Symfony\Component\HttpKernel\Tests\Fixtures\IsSignatureValidAttributeMethodsController; class IsSignatureValidAttributeListenerTest extends TestCase { public function testSubscribedEvents() { $events = IsSignatureValidAttribute
l\EventListener\IsSignatureValidAttributeListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Tests\Fixtures\IsSignatureValidAttributeCont
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/IsSignatureValidAttributeListenerTest.php", "language": "php", "file_size": 8205, "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\HttpKernel\Tests\EventListener; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; ...
r $listener; private MockObject&LocaleAwareInterface $localeAwareService; private RequestStack $requestStack; protected function setUp(): void { $this->localeAwareService = $this->createMock(LocaleAwareInterface::class); $t
nel\EventListener\LocaleAwareListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Contracts\Translation\LocaleAwareInterface; class LocaleAwareListenerTest extends TestCase { private LocaleAwareListene
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php", "language": "php", "file_size": 4479, "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\HttpKernel\Tests\Fixtures; use Symfony\Component\HttpKerne...
? __DIR__.'/../../vendor/autoload.php' : __DIR__.'/../../../../../../vendor/autoload.php' ; $script = preg_replace('/(\->register\(\);)/', "$0\nrequire_once '$autoload';\n", $script); return $script; } }
file_exists(__DIR__.'/../../vendor/autoload.php')
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php", "language": "php", "file_size": 825, "cut_index": 517, "middle_length": 52 }
mponent\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpKernel\Event\FinishRequestEvent; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\EventListener\LocaleListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symf...
steredEvent() { $this->assertEquals( [ KernelEvents::REQUEST => [['setDefaultLocale', 100], ['onKernelRequest', 16]], KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]], ],
caleListenerTest extends TestCase { public function testIsAnEventSubscriber() { $this->assertInstanceOf(EventSubscriberInterface::class, new LocaleListener(new RequestStack())); } public function testRegi
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php", "language": "php", "file_size": 10980, "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\HttpKernel\Tests\EventListener; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request...
ttpKernelInterface; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Profiler\Profile; use Symfony\Component\HttpKernel\Profiler\Profiler; class ProfilerListenerTest extends TestCase { /** * Test a main and sub request wi
t\ResponseEvent; use Symfony\Component\HttpKernel\Event\TerminateEvent; use Symfony\Component\HttpKernel\EventListener\ProfilerListener; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\H
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php", "language": "php", "file_size": 3578, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\...
onent\RateLimiter\RateLimit as RateLimitResult; use Symfony\Component\RateLimiter\RateLimiterFactoryInterface; use Symfony\Contracts\Service\ServiceProviderInterface; class RateLimitAttributeListenerTest extends TestCase { private function makeListene
tener\RateLimitAttributeListener; use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\RateLimiter\LimiterInterface; use Symfony\Comp
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/RateLimitAttributeListenerTest.php", "language": "php", "file_size": 5872, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\Respon...
w ResponseListener('UTF-8'); $this->dispatcher->addListener(KernelEvents::RESPONSE, $listener->onKernelResponse(...)); $this->kernel = $this->createStub(HttpKernelInterface::class); } public function testFilterDoesNothingForSubReq
stenerTest extends TestCase { private EventDispatcher $dispatcher; private HttpKernelInterface $kernel; protected function setUp(): void { $this->dispatcher = new EventDispatcher(); $listener = ne
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php", "language": "php", "file_size": 5289, "cut_index": 716, "middle_length": 229 }
e Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Exception\BadRequestException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ArgumentRes...
\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Routing\Exception\MethodNot
mfony\Component\HttpKernel\EventListener\RouterListener; use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php", "language": "php", "file_size": 14051, "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\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Req...
ontrollerResultAttributeListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Serializer\SerializerInterface; class SerializeControllerResultListenerTest extends TestCase { public function testSerializeAttribute() {
use Symfony\Component\HttpKernel\Event\ControllerAttributeEvent; use Symfony\Component\HttpKernel\Event\ControllerEvent; use Symfony\Component\HttpKernel\Event\ViewEvent; use Symfony\Component\HttpKernel\EventListener\SerializeC
{ "filepath": "src/Symfony/Component/HttpKernel/Tests/EventListener/SerializeControllerResultListenerTest.php", "language": "php", "file_size": 2879, "cut_index": 563, "middle_length": 229 }