prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
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\Bundle\TwigBundle\Tests\Functional;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBun... | ot();
$container = $kernel->getContainer();
$content = $container->get('twig.alias')->render('index.html.twig');
$this->assertStringContainsString('{ a: b }', $content);
}
protected function setUp(): void
{
$th | nent\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;
class NoTemplatingEntryTest extends TestCase
{
public function test()
{
$kernel = new NoTemplatingEntryKernel('dev', true);
$kernel->bo | {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php",
"language": "php",
"file_size": 2406,
"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\Bundle\TwigBundle\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony... | ut]);
$this->assertEquals(['form_div_layout.html.twig'], $config['form_themes']);
}
public function testGlobalsAreNotNormalized()
{
$input = [
'globals' => ['some-global' => true],
];
$processor = | tFormResources()
{
$input = [
'form_themes' => ['form_div_layout.html.twig'],
];
$processor = new Processor();
$config = $processor->processConfiguration(new Configuration(), [$inp | {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php",
"language": "php",
"file_size": 1918,
"cut_index": 537,
"middle_length": 229
} |
ependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ErrorHandl... | $container->registerExtension(new TwigExtension());
$container->loadFromExtension('twig');
$this->compileContainer($container);
$this->assertEquals(Environment::class, $container->getDefinition('twig')->getClass(), '->load() | idator\ValidatorInterface;
use Twig\Environment;
use Twig\Runtime\EscaperRuntime;
class TwigExtensionTest extends TestCase
{
public function testLoadEmptyConfiguration()
{
$container = $this->createContainer();
| {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php",
"language": "php",
"file_size": 18050,
"cut_index": 1331,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
us... | )
{
$container = new ContainerBuilder();
$container->setParameter('kernel.debug', false);
$container->register('twig.app_variable', AppVariable::class);
$container->register('twig.extension.yaml');
$container->r | ection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Twig\Loader\FilesystemLoader;
class ExtensionPassTest extends TestCase
{
public function testProcessDoesNotDropExistingFileLoaderMethodCalls( | {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php",
"language": "php",
"file_size": 1677,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\SafeClassPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Excep... | function testSafeClassWithStringStrategy()
{
$this->container->register('my_class')->setClass(\stdClass::class)
->addResourceTag('twig.safe_class', ['strategy' => 'html']);
$this->pass->process($this->container);
$ | cted function setUp(): void
{
$this->container = new ContainerBuilder();
$this->container->register('twig.runtime.escaper', EscaperRuntime::class);
$this->pass = new SafeClassPass();
}
public | {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/SafeClassPassTest.php",
"language": "php",
"file_size": 6133,
"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\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\Exte... | ion('twig');
$twigDefinition->setPublic(true);
$builder = new ContainerBuilder();
$builder->setDefinition('twig', $twigDefinition);
$pass = new TwigEnvironmentPass();
$definition = new Definition('test_extension_1') | yInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
class TwigEnvironmentPassTest extends TestCase
{
public function testPassWithTwoExtensionsWithPriority()
{
$twigDefinition = new Definit | {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigEnvironmentPassTest.php",
"language": "php",
"file_size": 2842,
"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\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass;
use ... | r();
$this->builder->register('twig');
$this->chainLoader = new Definition('loader');
$this->pass = new TwigLoaderPass();
}
public function testMapperPassWithOneTaggedLoader()
{
$this->builder->register('test_lo | derPassTest extends TestCase
{
private ContainerBuilder $builder;
private Definition $chainLoader;
private TwigLoaderPass $pass;
protected function setUp(): void
{
$this->builder = new ContainerBuilde | {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php",
"language": "php",
"file_size": 3161,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\TwigBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Mime\HtmlToT... |
$rootNode
->docUrl('https://symfony.com/doc/{version:major}.{version:minor}/reference/configuration/twig.html', 'symfony/twig-bundle')
;
$this->addFormThemesSection($rootNode);
$this->addGlobalsSection($rootNo | ace
{
/**
* Generates the configuration tree builder.
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('twig');
$rootNode = $treeBuilder->getRootNode(); | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php",
"language": "php",
"file_size": 8542,
"cut_index": 716,
"middle_length": 229
} |
per\AssetMapper;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\FileExistenceResource;
use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyIn... | nterface;
use Twig\Extension\RuntimeExtensionInterface;
use Twig\Loader\LoaderInterface;
/**
* TwigExtension.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jeremy Mikola <jmikola@gmail.com>
*/
class TwigExtension extends Extension
{
| eSwitcher;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Validator\Constraint;
use Twig\Attribute\AsTwigFilter;
use Twig\Attribute\AsTwigFunction;
use Twig\Attribute\AsTwigTest;
use Twig\Extension\ExtensionI | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php",
"language": "php",
"file_size": 10579,
"cut_index": 921,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\TwigBundle\DependencyInjection\Configurator;
use Symfony\Bridge\Twig\UndefinedCal... | t,
private string $thousandsSeparator,
) {
}
public function configure(Environment $environment): void
{
$environment->getExtension(CoreExtension::class)->setDateFormat($this->dateFormat, $this->intervalFormat);
if | mentConfigurator
{
public function __construct(
private string $dateFormat,
private string $intervalFormat,
private ?string $timezone,
private int $decimals,
private string $decimalPoin | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/Configurator/EnvironmentConfigurator.php",
"language": "php",
"file_size": 1638,
"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\Bundle\TwigBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Sym... | ister an instance of AttributeExtension for each service using the
* PHP attributes to declare Twig callables.
*
* @author Jérôme Tamarelle <jerome@tamarelle.net>
*
* @internal
*/
final class AttributeExtensionPass implements CompilerPassInterface
{
| n;
use Twig\Attribute\AsTwigFilter;
use Twig\Attribute\AsTwigFunction;
use Twig\Attribute\AsTwigTest;
use Twig\Extension\AbstractExtension;
use Twig\Extension\AttributeExtension;
use Twig\Extension\ExtensionInterface;
/**
* Reg | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/AttributeExtensionPass.php",
"language": "php",
"file_size": 2570,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Component\Asset\Packages;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfo... | ionPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!class_exists(Packages::class)) {
$container->removeDefinition('twig.extension.assets');
}
if (!class_e | \UrlGeneratorInterface;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\Workflow\Workflow;
use Symfony\Component\Yaml\Yaml;
/**
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*/
class Extens | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php",
"language": "php",
"file_size": 6001,
"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\Bundle\TwigBundle\DependencyInjection\Compiler;
use Symfony\Component\Depen... | container->hasDefinition('twig.runtime_loader')) {
return;
}
$definition = $container->getDefinition('twig.runtime_loader');
$mapping = [];
foreach ($container->findTaggedServiceIds('twig.runtime', true) as $id | \Component\DependencyInjection\Reference;
/**
* Registers Twig runtime services.
*/
class RuntimeLoaderPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$ | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/RuntimeLoaderPass.php",
"language": "php",
"file_size": 1254,
"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\Bundle\TwigBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInt... | ntainer): void
{
if (!$container->hasDefinition('twig.runtime.escaper')) {
return;
}
$definition = $container->getDefinition('twig.runtime.escaper');
foreach ($container->findTaggedResourceIds('twig.safe_cl | per.
*/
final class SafeClassPass implements CompilerPassInterface
{
private const BUILTIN_STRATEGIES = ['html', 'js', 'css', 'url', 'html_attr', 'html_attr_relaxed', 'all'];
public function process(ContainerBuilder $co | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/SafeClassPass.php",
"language": "php",
"file_size": 2609,
"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\Bundle\TwigBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInt... | oid
{
if (false === $container->hasDefinition('twig')) {
return;
}
$definition = $container->getDefinition('twig');
// Extensions must always be registered before everything else.
// For instance, g | o twig service.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class TwigEnvironmentPass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;
public function process(ContainerBuilder $container): v | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php",
"language": "php",
"file_size": 2117,
"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\Bundle\TwigBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjectio... | uilder $container): void
{
if (false === $container->hasDefinition('twig')) {
return;
}
$prioritizedLoaders = [];
$found = 0;
foreach ($container->findTaggedServiceIds('twig.loader', true) as $id => | cyInjection\Reference;
/**
* Adds services tagged twig.loader as Twig loaders.
*
* @author Daniel Leech <daniel@dantleech.com>
*/
class TwigLoaderPass implements CompilerPassInterface
{
public function process(ContainerB | {
"filepath": "src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php",
"language": "php",
"file_size": 1863,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\Csp;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Handles Content-Security-Policy HTTP header for the WebProfiler Bundle.
*
* @author Romain Neutron <imprec@gmail.com>
*
* @internal
... | e the same nonce as origin
* - The response - A call to getNonces() has already been done previously. Same nonce are returned
* - They are otherwise randomly generated
*/
public function getNonces(Request $request, Response $response) | Returns an array of nonces to be used in Twig templates and Content-Security-Policy headers.
*
* Nonce can be provided by;
* - The request - In case HTML content is fetched via AJAX and inserted in DOM, it must us | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php",
"language": "php",
"file_size": 8957,
"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\DependencyInjection\Loader\Configurator;
use Symfony\Bundle\WebProfilerBundle\Controller\ExceptionPanelController;
use Symfony\Bundle\WebProfilerBundle\Con... | mfony\Component\VarDumper\Dumper\HtmlDumper;
return static function (ContainerConfigurator $container) {
$container->services()
->set('web_profiler.controller.profiler', ProfilerController::class)
->public()
->args([
| lerBundle\Csp\NonceGenerator;
use Symfony\Bundle\WebProfilerBundle\Profiler\CodeExtension;
use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension;
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
use Sy | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.php",
"language": "php",
"file_size": 3461,
"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\DependencyInjection\Loader\Configurator;
use Symfony\Bundle... | service('router')->ignoreOnInvalid(),
abstract_arg('paths that should be excluded from the AJAX requests shown in the toolbar'),
service('web_profiler.csp.handler'),
service('data_collector.dump')->ignoreO | ebDebugToolbarListener::class)
->args([
service('twig'),
param('web_profiler.debug_toolbar.intercept_redirects'),
param('web_profiler.debug_toolbar.mode'),
| {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.php",
"language": "php",
"file_size": 1168,
"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.
*/
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConf... | profiler_phpinfo', '/phpinfo')
->controller('web_profiler.controller.profiler::phpinfoAction')
;
$routes->add('_profiler_xdebug', '/xdebug')
->controller('web_profiler.controller.profiler::xdebugAction')
;
$routes->add('_pro | ->controller('web_profiler.controller.profiler::searchAction')
;
$routes->add('_profiler_search_bar', '/search_bar')
->controller('web_profiler.controller.profiler::searchBarAction')
;
$routes->add('_ | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/profiler.php",
"language": "php",
"file_size": 1957,
"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\Bundle\WebProfilerBundle\Controller;
use Symfony\Component\ErrorHandler\ErrorRenderer\Ht... | ?Profiler $profiler = null,
) {
}
/**
* Renders the exception panel stacktrace for the given token.
*/
public function body(string $token): Response
{
if (null === $this->profiler) {
throw new NotFoundHtt | nders the exception panel.
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*
* @internal
*/
class ExceptionPanelController
{
public function __construct(
private HtmlErrorRenderer $errorRenderer,
private | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionPanelController.php",
"language": "php",
"file_size": 1558,
"cut_index": 537,
"middle_length": 229
} |
ndle\WebProfilerBundle\Profiler\TemplateManager;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlash... | ass ProfilerController
{
private TemplateManager $templateManager;
public function __construct(
private UrlGeneratorInterface $generator,
private ?Profiler $profiler,
private Environment $twig,
private array $templa | dHttpException;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Twig\Environment;
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @internal
*/
cl | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php",
"language": "php",
"file_size": 15460,
"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\Bundle\WebProfilerBundle\Controller;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use ... | ing\RouterInterface;
use Twig\Environment;
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @internal
*/
class RouterController
{
/**
* @param ExpressionFunctionProviderInterface[] $expressionLanguageProviders
*/
public functi | mponent\HttpKernel\Profiler\Profiler;
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Rout | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php",
"language": "php",
"file_size": 3363,
"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\Bundle\WebProfilerBundle\Twig;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Twig\Environment;
use Twig\Extensi... | construct(?HtmlDumper $dumper = null)
{
$this->dumper = $dumper ?? new HtmlDumper();
$this->dumper->setOutput($this->output = fopen('php://memory', 'r+'));
}
public function enter(Profile $profile): void
{
++$this-> | .com>
*
* @internal
*/
class WebProfilerExtension extends ProfilerExtension
{
private HtmlDumper $dumper;
/**
* @var resource
*/
private $output;
private int $stackLevel = 0;
public function __ | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php",
"language": "php",
"file_size": 3193,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\EventListener;
use Symfony\Bundle\FullStack;
use Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\EventStreamResponse;
use ... | nelEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Twig\Environment;
/**
* WebDebugToolbarListener injects the Web Debug Toolbar.
*
* The onKernelResponse method must be connected to the kernel.response event.
*
* The WDT i | toExpireFlashBag;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\Ker | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php",
"language": "php",
"file_size": 8613,
"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\Bundle\WebProfilerBundle\Tests\Functional;
use Psr\Log\NullLogger;
use Symfony\Bundle\FrameworkBundle\FrameworkBun... | \Kernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class WebProfilerBundleKernel extends Kernel
{
use MicroKernelTrait;
public function __construct()
{
parent::__construct('test', false);
}
public | Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
use Symfony\Component\HttpKernel | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php",
"language": "php",
"file_size": 2853,
"cut_index": 563,
"middle_length": 229
} |
Csp\ContentSecurityPolicyHandler;
use Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ContentSecurityPolicyHandlerTest extends TestCase
{
#[DataProvider('provideRequestAndResponses')]
public function testGet... | e $response, array $expectedCsp)
{
$cspHandler = new ContentSecurityPolicyHandler($this->mockNonceGenerator($nonce));
$this->assertSame($expectedNonce, $cspHandler->updateResponseHeaders($request, $response));
$this->assertFal | ($expectedNonce, $cspHandler->getNonces($request, $response));
}
#[DataProvider('provideRequestAndResponsesForOnKernelResponse')]
public function testOnKernelResponse($nonce, $expectedNonce, Request $request, Respons | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php",
"language": "php",
"file_size": 12359,
"cut_index": 921,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\Tests\Resources;
use PHPUnit\Framework\Attributes\DataProvider;... | icon must use "http://www.w3.org/2000/svg" as its "xmlns" value.', $iconFilePath));
$this->assertMatchesRegularExpression('~<svg .* width="\d+".+>.*</svg>~s', file_get_contents($iconFilePath), \sprintf('The SVG file of the "%s" icon must include | ath = realpath($iconFilePath);
$svgFileContents = file_get_contents($iconFilePath);
$this->assertStringContainsString('xmlns="http://www.w3.org/2000/svg"', $svgFileContents, \sprintf('The SVG metadata of the "%s" | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Resources/IconTest.php",
"language": "php",
"file_size": 1697,
"cut_index": 537,
"middle_length": 229
} |
n Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\Tests\Resources;
use PHPUnit\Framework\TestCase;
/**
* Make sure we can minify content in toolbar.
*
* @... | twig') as $jsFile) {
$fileContents = file_get_contents($dir.'/base_js.html.twig');
$fileContents = str_replace('\'//\'', '', $fileContents);
$this->assertEquals(0, substr_count($fileContents, '//'), 'There cannot be any | s/Profiler';
foreach (glob($dir.'/*js.html. | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Resources/MinifyTest.php",
"language": "php",
"file_size": 989,
"cut_index": 582,
"middle_length": 52
} |
Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector;
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use ... | ace::class);
$controller = new ProfilerController($urlGenerator, null, new Environment(new ArrayLoader()), []);
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('The profiler must be enabled.');
| \Loader\ArrayLoader;
use Twig\Loader\LoaderInterface;
class ProfilerControllerTest extends WebTestCase
{
public function testHomeActionWithProfilerDisabled()
{
$urlGenerator = $this->createStub(UrlGeneratorInterf | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php",
"language": "php",
"file_size": 20318,
"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\Bundle\WebProfilerBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBund... | $kernel = new WebProfilerBundleKernel();
$client = new KernelBrowser($kernel);
$client->disableReboot();
$client->getKernel()->boot();
/** @var Router $router */
$router = $client->getContainer()->get('router') | eKernel;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Routing\Route;
class RouterControllerTest extends WebTestCase
{
public function testFalseNegativeTrace()
{
$path = '/foo/bar:123/baz';
| {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/RouterControllerTest.php",
"language": "php",
"file_size": 1455,
"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\Bundle\SecurityBundle\DependencyInjection\Security\AccessToken;
use Symfony\Component\Config\Definition\Builder\No... |
$container->setDefinition($id, new ChildDefinition('security.access_token_handler.cas'));
$container
->register('security.access_token_handler.cas', Cas2Handler::class)
->setArguments([
new Referenc | ny\Component\Security\Http\AccessToken\Cas\Cas2Handler;
class CasTokenHandlerFactory implements TokenHandlerFactoryInterface
{
public function create(ContainerBuilder $container, string $id, array|string $config): void
{ | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/CasTokenHandlerFactory.php",
"language": "php",
"file_size": 2043,
"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\Bundle\SecurityBundle\DependencyInjection\Security\AccessToken;
us... | ray|string $config): void
{
$container->setDefinition($id, new ChildDefinition('security.access_token_handler.oauth2'));
}
public function getKey(): string
{
return 'oauth2';
}
public function addConfiguration(Node | ures a token handler for an OAuth2 Token Introspection endpoint.
*
* @internal
*/
class OAuth2TokenHandlerFactory implements TokenHandlerFactoryInterface
{
public function create(ContainerBuilder $container, string $id, ar | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OAuth2TokenHandlerFactory.php",
"language": "php",
"file_size": 1086,
"cut_index": 515,
"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\Bundle\SecurityBundle\DependencyInjection\Security\AccessToken;
us... | public function create(ContainerBuilder $container, string $id, array|string $config): void
{
$container->setDefinition($id, new ChildDefinition($config));
}
public function getKey(): string
{
return 'id';
}
publ | ures a token handler from a service id.
*
* @see \Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Security\Factory\AccessTokenFactoryTest
*/
class ServiceTokenHandlerFactory implements TokenHandlerFactoryInterface
{
| {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/ServiceTokenHandlerFactory.php",
"language": "php",
"file_size": 1119,
"cut_index": 515,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DebugBundle;
use Symfony\Bundle\DebugBundle\DependencyInjection\Compiler\DumpData... | is here to lazy load the dump stack. This default
// configuration is overridden in CLI mode on 'console.command' event.
// The dump data collector is used by default, so dump output is sent to
// the WDT. In a CLI cont | ekas <p@tchwork.com>
*/
class DebugBundle extends Bundle
{
public function boot(): void
{
if ($this->container->getParameter('kernel.debug')) {
$container = $this->container;
// This code | {
"filepath": "src/Symfony/Bundle/DebugBundle/DebugBundle.php",
"language": "php",
"file_size": 2019,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Monolog\Formatter\FormatterInterface;
use Symfony\Bridge\Monolog\Command\ServerLogCommand;
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
use Symfony\Bridge\Twig\Extension\DumpExtension;
use Symfony\Compo... | nt\VarDumper\Dumper\ContextProvider\CliContextProvider;
use Symfony\Component\VarDumper\Dumper\ContextProvider\RequestContextProvider;
use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
use Symfony\Component\VarDumper\Dumper\Cont | Command\Descriptor\CliDescriptor;
use Symfony\Component\VarDumper\Command\Descriptor\HtmlDescriptor;
use Symfony\Component\VarDumper\Command\ServerDumpCommand;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Compone | {
"filepath": "src/Symfony/Bundle/DebugBundle/Resources/config/services.php",
"language": "php",
"file_size": 5811,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Com... | miter\RateLimiterFactoryInterface;
use Symfony\Component\RateLimiter\Storage\CacheStorage;
use Symfony\Component\Security\Http\RateLimiter\DefaultLoginRateLimiter;
/**
* @author Wouter de Jong <wouter@wouterj.nl>
*
* @internal
*/
class LoginThrottling | ndencyInjection\Reference;
use Symfony\Component\HttpFoundation\RateLimiter\RequestRateLimiterInterface;
use Symfony\Component\Lock\LockInterface;
use Symfony\Component\RateLimiter\RateLimiterFactory;
use Symfony\Component\RateLi | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/LoginThrottlingFactory.php",
"language": "php",
"file_size": 5552,
"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\Bundle\SecurityBundle\DependencyInjection\Security\Factory;
use Symfony\Component\Config... | RemoteUserFactory implements AuthenticatorFactoryInterface
{
public const PRIORITY = -10;
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string
{
$authent | tion\Reference;
/**
* RemoteUserFactory creates services for REMOTE_USER based authentication.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Maxime Douailin <maxime.douailin@gmail.com>
*
* @internal
*/
class | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RemoteUserFactory.php",
"language": "php",
"file_size": 1856,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\DebugBundle\Tests\DependencyInjection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\DebugBundle\DebugBundle;
use Symfony\Bundle\DebugBundle\DependencyInjection\Compiler\DumpDataCollectorPass;
use Symfony\Bun... | er\Caster\ReflectionCaster;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Server\Connection;
use Symfony\Component\VarDumper\Server\DumpServer;
class DebugExtensionTest extends TestCase
{
public function testLoadWit | dencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\VarDump | {
"filepath": "src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/DebugExtensionTest.php",
"language": "php",
"file_size": 6138,
"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\Bundle\DebugBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\C... | com/doc/{version:major}.{version:minor}/reference/configuration/debug.html', 'symfony/debug-bundle')
->children()
->integerNode('max_items')
->info('Max number of displayed items past the first level, -1 mean | Interface
{
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('debug');
$rootNode = $treeBuilder->getRootNode();
$rootNode
->docUrl('https://symfony. | {
"filepath": "src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php",
"language": "php",
"file_size": 2285,
"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\Bundle\DebugBundle\DependencyInjection\Compiler;
use Symfony\Bundle\WebProfilerBundle\Ev... | pDataCollectorPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('data_collector.dump')) {
return;
}
$definition = $container->get | \DependencyInjection\Reference;
/**
* Registers the file link format for the {@link \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector}.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
class Dum | {
"filepath": "src/Symfony/Bundle/DebugBundle/DependencyInjection/Compiler/DumpDataCollectorPass.php",
"language": "php",
"file_size": 1580,
"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\Bundle\TwigBundle;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\AttributeE... | ndencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Bundle.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class TwigBundle extends Bundle
{
p | dle\DependencyInjection\Compiler\SafeClassPass;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass;
use Symfony\Component\Depe | {
"filepath": "src/Symfony/Bundle/TwigBundle/TwigBundle.php",
"language": "php",
"file_size": 1716,
"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\DependencyInjection\Loader\Configurator;
use Symfony\B... |
service('debug.file_link_formatter')->nullOnInvalid(),
])
->tag('console.command')
->set('twig.command.lint', LintCommand::class)
->args([service('twig'), abstract_arg('File name pattern')])
| command.debug', DebugCommand::class)
->args([
service('twig'),
param('kernel.project_dir'),
param('kernel.bundles_metadata'),
param('twig.default_path'), | {
"filepath": "src/Symfony/Bundle/TwigBundle/Resources/config/console.php",
"language": "php",
"file_size": 1041,
"cut_index": 513,
"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\DependencyInjection\Loader\Configurator;
use Symfony\Bridge\Twig\Mime\BodyRenderer;
use ... | ageListener::class)
->args([null, service('twig.mime_body_renderer')])
->tag('kernel.event_subscriber')
->set('twig.mime_body_renderer', BodyRenderer::class)
->args([service('twig')])
->alias(BodyRendere | )
->set('twig.mailer.message_listener', Mess | {
"filepath": "src/Symfony/Bundle/TwigBundle/Resources/config/mailer.php",
"language": "php",
"file_size": 910,
"cut_index": 547,
"middle_length": 52
} |
taCollector\TwigDataCollector;
use Symfony\Bridge\Twig\ErrorRenderer\TwigErrorRenderer;
use Symfony\Bridge\Twig\EventListener\TemplateAttributeListener;
use Symfony\Bridge\Twig\Extension\AssetExtension;
use Symfony\Bridge\Twig\Extension\EmojiExtension;
use Symfony\Bridge\Twig\Extension\ExpressionExtension;
use Symfony\... | ime;
use Symfony\Bridge\Twig\Extension\StopwatchExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Extension\WebLinkExtension;
use Symfony\Bridge\Twig\Extension\WorkflowExtension;
use Symfony\Bridge\Twig\Extension\Ya | n\HttpKernelRuntime;
use Symfony\Bridge\Twig\Extension\ProfilerExtension;
use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Bridge\Twig\Extension\SerializerExtension;
use Symfony\Bridge\Twig\Extension\SerializerRunt | {
"filepath": "src/Symfony/Bundle/TwigBundle/Resources/config/twig.php",
"language": "php",
"file_size": 9215,
"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\Bundle\TwigBundle\Tests;
use Symfony\Bundle\TwigBundle\TemplateIterator;
use Symfony\Component\HttpKernel\Bundle\B... | [
'@!Bar/index.html.twig',
'@Bar/index.html.twig',
'@Bar/layout.html.twig',
'@Foo/index.html.twig',
'@Foo/not-twig.js',
'layout.html.twig',
], | is->createKernelMock(), [__DIR__.'/Fixtures/templates/Foo' => 'Foo'], __DIR__.'/DependencyInjection/Fixtures/templates');
$sorted = iterator_to_array($iterator);
sort($sorted);
$this->assertEquals(
| {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php",
"language": "php",
"file_size": 2129,
"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\Bundle\TwigBundle\Tests\Functional;
use PHPUnit\Framework\Attributes\After;
use PHPUnit\Framework\Attributes\Before;
use Symfony\Bundle\FrameworkBundle\FrameworkBund... | tion;
use Twig\Attribute\AsTwigTest;
use Twig\Environment;
use Twig\Error\RuntimeError;
use Twig\Extension\AbstractExtension;
use Twig\Extension\AttributeExtension;
class AttributeExtensionTest extends TestCase
{
public function testExtensionWithAttri | inerBuilder;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;
use Twig\Attribute\AsTwigFilter;
use Twig\Attribute\AsTwigFunc | {
"filepath": "src/Symfony/Bundle/TwigBundle/Tests/Functional/AttributeExtensionTest.php",
"language": "php",
"file_size": 4941,
"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\Bundle\SecurityBundle\DependencyInjection\Security\AccessToken;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\DependencyInjectio... | toryInterface
{
public function create(ContainerBuilder $container, string $id, array|string $config): void
{
$clientDefinition = (new ChildDefinition('security.access_token_handler.oidc_user_info.http_client'))
->replaceArgumen | erence;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* Configures a token handler for an OIDC server.
*/
class OidcUserInfoTokenHandlerFactory implements TokenHandlerFac | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OidcUserInfoTokenHandlerFactory.php",
"language": "php",
"file_size": 4433,
"cut_index": 614,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\AccessToken;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\Dependency... | , string $id, array|string $config): void;
/**
* Gets a generic token handler configuration key.
*/
public function getKey(): string;
/**
* Adds a generic token handler configuration.
*/
public function addConfiguratio | public function create(ContainerBuilder $container | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/TokenHandlerFactoryInterface.php",
"language": "php",
"file_size": 944,
"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\Bundle\SecurityBundle\DependencyInjection\Security\Factory;
use Symfony\Component\Config\Definition\Exception\Inva... | @wouterj.nl>
*
* @internal
*/
trait LdapFactoryTrait
{
public function getKey(): string
{
return parent::getKey().'-ldap';
}
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, s | ;
use Symfony\Component\Ldap\Security\CheckLdapCredentialsListener;
use Symfony\Component\Ldap\Security\LdapAuthenticator;
/**
* A trait decorating the authenticator with LDAP functionality.
*
* @author Wouter de Jong <wouter | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/LdapFactoryTrait.php",
"language": "php",
"file_size": 2440,
"cut_index": 563,
"middle_length": 229
} |
curityBundle\RememberMe\DecoratedRememberMeHandler;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\... | ;
/**
* @internal
*/
class RememberMeFactory implements AuthenticatorFactoryInterface, PrependExtensionInterface
{
public const PRIORITY = -50;
protected array $options = [
'name' => 'REMEMBERME',
'lifetime' => 31536000,
| omponent\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\Security\Core\Authentication\RememberMe\CacheTokenVerifier | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php",
"language": "php",
"file_size": 11499,
"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\Bundle\DebugBundle\DependencyInjection;
use Symfony\Bridge\Monolog\Command\ServerLogCommand;
use Symfony\Bundle\DebugBundle\Command\ServerDumpPlaceholderCommand;
use... | ork.com>
*/
class DebugExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
| nsion\Extension;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\VarDumper\Caster\ReflectionCaster;
/**
* @author Nicolas Grekas <p@tchw | {
"filepath": "src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php",
"language": "php",
"file_size": 3579,
"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\DependencyInjection\Loader\Configurator;
use Symfony\B... | ('twig.form.resources'), service('twig')])
->tag('kernel.reset', ['method' => '?reset'])
->set('twig.form.renderer', FormRenderer::class)
->args([service('twig.form.engine'), service('security.csrf.token_manager')->nullOnIn | container->services()
->set('twig.extension.form', FormExtension::class)
->args([service('translator')->nullOnInvalid()])
->set('twig.form.engine', TwigRendererEngine::class)
->args([param | {
"filepath": "src/Symfony/Bundle/TwigBundle/Resources/config/form.php",
"language": "php",
"file_size": 1051,
"cut_index": 513,
"middle_length": 229
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\... | time.importmap', ImportMapRuntime::class)
->args([service('asset_mapper.importmap.renderer')])
->tag('twig.runtime')
->set('twig.extension.importmap', ImportMapExtension::class)
->tag('twig.extension')
;
};
| >set('twig.run | {
"filepath": "src/Symfony/Bundle/TwigBundle/Resources/config/importmap.php",
"language": "php",
"file_size": 782,
"cut_index": 512,
"middle_length": 14
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\TwigBundle\Command;
use Symfony\Bridge\Twig\Command\LintCommand as B... | protected function configure(): void
{
parent::configure();
$this
->setHelp(
$this->getHelp().<<<'EOF'
Or all template files in a bundle:
<info>php %command.ful | stroff@sensiolabs.com>
* @author Jérôme Tamarelle <jerome@tamarelle.net>
*/
#[AsCommand(name: 'lint:twig', description: 'Lint a Twig template and outputs encountered errors')]
final class LintCommand extends BaseLintCommand
{
| {
"filepath": "src/Symfony/Bundle/TwigBundle/Command/LintCommand.php",
"language": "php",
"file_size": 1365,
"cut_index": 524,
"middle_length": 229
} |
uilder;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Security\Http\Command\OidcTokenGenerateCommand;
us... | ler.oidc'))
->replaceArgument(2, $config['audience'])
->replaceArgument(3, $config['issuers'])
->replaceArgument(4, $config['claim'])
->addTag('container.reversible')
);
if (!ContainerBuilder | ryInterface
{
public function create(ContainerBuilder $container, string $id, array|string $config): void
{
$tokenHandlerDefinition = $container->setDefinition($id, (new ChildDefinition('security.access_token_hand | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/AccessToken/OidcTokenHandlerFactory.php",
"language": "php",
"file_size": 9326,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjectio... | extends AbstractFactory
{
public const PRIORITY = -20;
public function addConfiguration(NodeDefinition $node): void
{
/** @var NodeBuilder $builder */
$builder = $node->children();
$builder
->scalarNode('ch | ce;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
/**
* @internal
*/
class LoginLinkFactory | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/LoginLinkFactory.php",
"language": "php",
"file_size": 6864,
"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\Bundle\DebugBundle\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfo... | er@gmail.com>
*
* @internal
*/
#[AsCommand(name: 'server:dump', description: 'Start a dump server that collects and displays dumps in a single place')]
class ServerDumpPlaceholderCommand extends Command
{
private ServerDumpCommand $replacedCommand;
| ;
use Symfony\Component\VarDumper\Command\ServerDumpCommand;
use Symfony\Component\VarDumper\Server\DumpServer;
/**
* A placeholder command easing VarDumper server discovery.
*
* @author Maxime Steinhausser <maxime.steinhauss | {
"filepath": "src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php",
"language": "php",
"file_size": 1868,
"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\Bundle\TwigBundle\CacheWarmer;
use Psr\Container\ContainerInterface;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
use Symfony\Contracts\Service... | cies should be lazy-loaded, that's why a container should be injected.
*/
public function __construct(
private ContainerInterface $container,
private iterable $iterator,
private ?CacheInterface $cache = null,
) {
}
| hor Fabien Potencier <fabien@symfony.com>
*/
final class TemplateCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
{
private Environment $twig;
/**
* As this cache warmer is optional, dependen | {
"filepath": "src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php",
"language": "php",
"file_size": 3126,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\DebugBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\DebugBundle\DependencyInjection\Compiler\DumpDataCollectorPass;
use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener;
use Symfony\Component... | ilder();
$container->addCompilerPass(new DumpDataCollectorPass());
$definition = new Definition(DumpDataCollector::class, [null, null, '%kernel.charset%', new Reference('.virtual_request_stack'), null, '%kernel.runtime_mode.web%']);
| ack;
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
class DumpDataCollectorPassTest extends TestCase
{
public function testProcessWithoutFileLinkFormatParameter()
{
$container = new ContainerBu | {
"filepath": "src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/Compiler/DumpDataCollectorPassTest.php",
"language": "php",
"file_size": 5395,
"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\Bundle\SecurityBundle\DependencyInjection\Security\Factory;
use Symfony\Component\Config\Definition\Builder\NodeDe... |
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string
{
$authenticatorId = 'security.authenticator.x509.'.$firewallName;
$container
->setD | 09Factory creates services for X509 certificate authentication.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @internal
*/
class X509Factory implements AuthenticatorFactoryInterface
{
public const PRIORITY = -10; | {
"filepath": "src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/X509Factory.php",
"language": "php",
"file_size": 2064,
"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\Bundle\TwigBundle;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\KernelInterface;
/**
* Iterator for all templates in bundles and in the ap... | @param string[] $namePatterns Pattern of file names
*/
public function __construct(
private KernelInterface $kernel,
private array $paths = [],
private ?string $defaultPath = null,
private array $namePatterns = | atorAggregate
{
private \Traversable $templates;
/**
* @param array $paths Additional Twig paths to warm
* @param string|null $defaultPath The directory where global templates can be stored
* | {
"filepath": "src/Symfony/Bundle/TwigBundle/TemplateIterator.php",
"language": "php",
"file_size": 3219,
"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\Bundle\WebProfilerBundle\Tests\DependencyInjection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\WebProfilerBund... | $this->assertEquals($expectedResult, $config);
}
public static function getDebugModes()
{
return [
[
'options' => [],
'expectedResult' => [
'intercept_redirects' => fals | stConfigTree(array $options, array $expectedResult)
{
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, [$options]);
| {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php",
"language": "php",
"file_size": 4038,
"cut_index": 614,
"middle_length": 229
} |
DumpDataCollector;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Twig\Environment;
class WebDebugToolbarListenerTest extends TestCase
{
... | tylo']);
$this->assertEquals($expected, $response->getContent());
}
public static function getInjectToolbarTests()
{
return [
['<html><head></head><body></body></html>', "<html><head></head><body>\nWDT\n</body></htm | $m = new \ReflectionMethod($listener, 'injectToolbar');
$response = new Response($content);
$m->invoke($listener, $response, Request::create('/'), ['csp_script_nonce' => 'scripto', 'csp_style_nonce' => 's | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php",
"language": "php",
"file_size": 21134,
"cut_index": 1331,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\Tests\Twig;
use PHPUnit\Framework\Attributes\DataProvider;
use ... | twigEnvironment = new Environment(new ArrayLoader());
$varCloner = new VarCloner();
$webProfilerExtension = new WebProfilerExtension();
$needle = 'window.Sfdump';
$dump1 = $webProfilerExtension->dumpLog($twigEnvironment, |
class WebProfilerExtensionTest extends TestCase
{
#[DataProvider('provideMessages')]
public function testDumpHeaderIsDisplayed(string $message, array $context, bool $dump1HasHeader, bool $dump2HasHeader)
{
$ | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Twig/WebProfilerExtensionTest.php",
"language": "php",
"file_size": 1713,
"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\Bundle\WebProfilerBundle\Tests\Profiler;
use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager;
use Symfony\Bundle\WebProfilerBundle\Tests\TestCase;
use Symf... | >
*/
class TemplateManagerTest extends TestCase
{
protected Environment $twigEnvironment;
protected Profiler $profiler;
protected TemplateManager $templateManager;
protected function setUp(): void
{
$this->profiler = $this->cr | tFoundHttpException;
use Symfony\Component\HttpKernel\Profiler\Profile;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Twig\Environment;
use Twig\Loader\LoaderInterface;
/**
* @author Artur Wielogórski <wodor@wodor.net | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php",
"language": "php",
"file_size": 3298,
"cut_index": 614,
"middle_length": 229
} |
igFilter;
/**
* Twig extension related to PHP code and used by the profiler and the default exception templates.
*
* This extension should only be used for debugging tools code
* that is never executed in a production environment.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
final class CodeExtension ex... | e('\\', '/', $projectDir).'/';
}
public function getFilters(): array
{
return [
new TwigFilter('abbr_class', $this->abbrClass(...), ['is_safe' => ['html'], 'pre_escape' => 'html']),
new TwigFilter('abbr_method', | string $projectDir,
private string $charset,
) {
$this->fileLinkFormat = $fileLinkFormat ?: \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
$this->projectDir = str_replac | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Profiler/CodeExtension.php",
"language": "php",
"file_size": 10659,
"cut_index": 921,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Bu... | nfiguration tree builder.
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('web_profiler');
$treeBuilder
->getRootNode()
->docUrl('https://symfony.com/doc/{version | sponsible for how the different configuration
* sections are normalized, and merged.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class Configuration implements ConfigurationInterface
{
/**
* Generates the co | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/Configuration.php",
"language": "php",
"file_size": 1826,
"cut_index": 537,
"middle_length": 229
} |
ndle\Profiler\CodeExtension;
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
use Twig\Environment;
use Twig\Loader\ArrayLoader;
class CodeExtensionTest extends TestCase
{
public function testFormatFile()
{
$expected = \sprintf('<a href="proto://foobar%s#&line=25" title="Click to... | Integration()
{
$data = [
'fqcn' => 'F\Q\N\Foo',
'xss' => '<script>',
];
$template = <<<'TWIG'
{{ 'Bare'|abbr_class }}
{{ fqcn|abbr_class }}
{{ xss|abbr_class }}
| c function testFileRelative()
{
$this->assertEquals('file.txt', $this->getExtension()->getFileRelative(\DIRECTORY_SEPARATOR.'project'.\DIRECTORY_SEPARATOR.'file.txt'));
}
public function testClassAbbreviation | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/CodeExtensionTest.php",
"language": "php",
"file_size": 10991,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\Tests\DependencyInjection;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Bundle\WebProfilerBundle\DependencyInjection\WebProfilerExtension;
use Symfony\Bundle\WebProfilerBundle\Tests\TestCase;
use Symfony\Component\DependencyInje... | DataCollector\DumpDataCollector;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Profiler\Profile;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface;
us | ony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpKernel\ | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php",
"language": "php",
"file_size": 8670,
"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\Bundle\WebProfilerBundle\DependencyInjection;
use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarLi... | bprofiler:config
* toolbar="true"
* intercept-redirects="true"
* />
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class WebProfilerExtension extends Extension
{
/**
* Loads the web profiler configuration.
*
| fony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;
/**
* WebProfilerExtension.
*
* Usage:
*
* <we | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php",
"language": "php",
"file_size": 2343,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\Tests\EventListener;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Componen... | ntent, string $expected)
{
$listener = new WebDebugToolbarListener($this->getTwigStub());
$m = new \ReflectionMethod($listener, 'injectToolbar');
$response = new StreamedResponse($this->createCallbackFromContent($content));
| ony\Component\HttpKernel\KernelEvents;
use Twig\Environment;
class WebDebugToolbarStreamedResponseListenerTest extends TestCase
{
#[DataProvider('provideInjectedToolbarHtml')]
public function testInjectToolbar(string $co | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarStreamedResponseListenerTest.php",
"language": "php",
"file_size": 7910,
"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\Bundle\WebProfilerBundle\Profiler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\C... | **
* Gets the template name for a given panel.
*
* @throws NotFoundHttpException
*/
public function getName(Profile $profile, string $panel): mixed
{
$templates = $this->getNames($profile);
if (!isset($templates | ki <wodor@wodor.net>
*
* @internal
*/
class TemplateManager
{
public function __construct(
protected Profiler $profiler,
protected Environment $twig,
protected array $templates,
) {
}
/ | {
"filepath": "src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php",
"language": "php",
"file_size": 2299,
"cut_index": 563,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.