login consent app sql
This commit is contained in:
129
vendor/symfony/twig-bundle/DependencyInjection/Compiler/ExtensionPass.php
vendored
Normal file
129
vendor/symfony/twig-bundle/DependencyInjection/Compiler/ExtensionPass.php
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
<?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\Bundle\TwigBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\Asset\Packages;
|
||||
use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Workflow\Workflow;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
*/
|
||||
class ExtensionPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!class_exists(Packages::class)) {
|
||||
$container->removeDefinition('twig.extension.assets');
|
||||
}
|
||||
|
||||
if (!class_exists(Expression::class)) {
|
||||
$container->removeDefinition('twig.extension.expression');
|
||||
}
|
||||
|
||||
if (!interface_exists(UrlGeneratorInterface::class)) {
|
||||
$container->removeDefinition('twig.extension.routing');
|
||||
}
|
||||
|
||||
if (!class_exists(Yaml::class)) {
|
||||
$container->removeDefinition('twig.extension.yaml');
|
||||
}
|
||||
|
||||
$viewDir = \dirname((new \ReflectionClass(\Symfony\Bridge\Twig\Extension\FormExtension::class))->getFileName(), 2).'/Resources/views';
|
||||
$templateIterator = $container->getDefinition('twig.template_iterator');
|
||||
$templatePaths = $templateIterator->getArgument(1);
|
||||
$loader = $container->getDefinition('twig.loader.native_filesystem');
|
||||
|
||||
if ($container->has('mailer')) {
|
||||
$emailPath = $viewDir.'/Email';
|
||||
$loader->addMethodCall('addPath', [$emailPath, 'email']);
|
||||
$loader->addMethodCall('addPath', [$emailPath, '!email']);
|
||||
$templatePaths[$emailPath] = 'email';
|
||||
}
|
||||
|
||||
if ($container->has('form.extension')) {
|
||||
$container->getDefinition('twig.extension.form')->addTag('twig.extension');
|
||||
|
||||
$coreThemePath = $viewDir.'/Form';
|
||||
$loader->addMethodCall('addPath', [$coreThemePath]);
|
||||
$templatePaths[$coreThemePath] = null;
|
||||
}
|
||||
|
||||
$templateIterator->replaceArgument(1, $templatePaths);
|
||||
|
||||
if ($container->has('router')) {
|
||||
$container->getDefinition('twig.extension.routing')->addTag('twig.extension');
|
||||
}
|
||||
|
||||
if ($container->has('fragment.handler')) {
|
||||
$container->getDefinition('twig.extension.httpkernel')->addTag('twig.extension');
|
||||
$container->getDefinition('twig.runtime.httpkernel')->addTag('twig.runtime');
|
||||
|
||||
if ($container->hasDefinition('fragment.renderer.hinclude')) {
|
||||
$container->getDefinition('fragment.renderer.hinclude')
|
||||
->addTag('kernel.fragment_renderer', ['alias' => 'hinclude'])
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if ($container->has('request_stack')) {
|
||||
$container->getDefinition('twig.extension.httpfoundation')->addTag('twig.extension');
|
||||
}
|
||||
|
||||
if ($container->getParameter('kernel.debug')) {
|
||||
$container->getDefinition('twig.extension.profiler')->addTag('twig.extension');
|
||||
|
||||
// only register if the improved version from DebugBundle is *not* present
|
||||
if (!$container->has('twig.extension.dump')) {
|
||||
$container->getDefinition('twig.extension.debug')->addTag('twig.extension');
|
||||
}
|
||||
}
|
||||
|
||||
if ($container->has('web_link.add_link_header_listener')) {
|
||||
$container->getDefinition('twig.extension.weblink')->addTag('twig.extension');
|
||||
}
|
||||
|
||||
$container->setAlias('twig.loader.filesystem', new Alias('twig.loader.native_filesystem', false));
|
||||
|
||||
if ($container->has('assets.packages')) {
|
||||
$container->getDefinition('twig.extension.assets')->addTag('twig.extension');
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('twig.extension.yaml')) {
|
||||
$container->getDefinition('twig.extension.yaml')->addTag('twig.extension');
|
||||
}
|
||||
|
||||
if (class_exists(\Symfony\Component\Stopwatch\Stopwatch::class)) {
|
||||
$container->getDefinition('twig.extension.debug.stopwatch')->addTag('twig.extension');
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('twig.extension.expression')) {
|
||||
$container->getDefinition('twig.extension.expression')->addTag('twig.extension');
|
||||
}
|
||||
|
||||
if (!class_exists(Workflow::class) || !$container->has('workflow.registry')) {
|
||||
$container->removeDefinition('workflow.twig_extension');
|
||||
} else {
|
||||
$container->getDefinition('workflow.twig_extension')->addTag('twig.extension');
|
||||
}
|
||||
|
||||
if ($container->has('serializer')) {
|
||||
$container->getDefinition('twig.runtime.serializer')->addTag('twig.runtime');
|
||||
$container->getDefinition('twig.extension.serializer')->addTag('twig.extension');
|
||||
}
|
||||
}
|
||||
}
|
39
vendor/symfony/twig-bundle/DependencyInjection/Compiler/RuntimeLoaderPass.php
vendored
Normal file
39
vendor/symfony/twig-bundle/DependencyInjection/Compiler/RuntimeLoaderPass.php
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
<?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\Bundle\TwigBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Registers Twig runtime services.
|
||||
*/
|
||||
class RuntimeLoaderPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('twig.runtime_loader')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('twig.runtime_loader');
|
||||
$mapping = [];
|
||||
foreach ($container->findTaggedServiceIds('twig.runtime', true) as $id => $attributes) {
|
||||
$def = $container->getDefinition($id);
|
||||
$mapping[$def->getClass()] = new Reference($id);
|
||||
}
|
||||
|
||||
$definition->replaceArgument(0, ServiceLocatorTagPass::register($container, $mapping));
|
||||
}
|
||||
}
|
57
vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigEnvironmentPass.php
vendored
Normal file
57
vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigEnvironmentPass.php
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
<?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\Bundle\TwigBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Adds tagged twig.extension services to twig service.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class TwigEnvironmentPass implements CompilerPassInterface
|
||||
{
|
||||
use PriorityTaggedServiceTrait;
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (false === $container->hasDefinition('twig')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('twig');
|
||||
|
||||
// Extensions must always be registered before everything else.
|
||||
// For instance, global variable definitions must be registered
|
||||
// afterward. If not, the globals from the extensions will never
|
||||
// be registered.
|
||||
$currentMethodCalls = $definition->getMethodCalls();
|
||||
$twigBridgeExtensionsMethodCalls = [];
|
||||
$othersExtensionsMethodCalls = [];
|
||||
foreach ($this->findAndSortTaggedServices('twig.extension', $container) as $extension) {
|
||||
$methodCall = ['addExtension', [$extension]];
|
||||
$extensionClass = $container->getDefinition((string) $extension)->getClass();
|
||||
|
||||
if (\is_string($extensionClass) && str_starts_with($extensionClass, 'Symfony\Bridge\Twig\Extension')) {
|
||||
$twigBridgeExtensionsMethodCalls[] = $methodCall;
|
||||
} else {
|
||||
$othersExtensionsMethodCalls[] = $methodCall;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($twigBridgeExtensionsMethodCalls) || !empty($othersExtensionsMethodCalls)) {
|
||||
$definition->setMethodCalls(array_merge($twigBridgeExtensionsMethodCalls, $othersExtensionsMethodCalls, $currentMethodCalls));
|
||||
}
|
||||
}
|
||||
}
|
60
vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigLoaderPass.php
vendored
Normal file
60
vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigLoaderPass.php
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
<?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\Bundle\TwigBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\LogicException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Adds services tagged twig.loader as Twig loaders.
|
||||
*
|
||||
* @author Daniel Leech <daniel@dantleech.com>
|
||||
*/
|
||||
class TwigLoaderPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (false === $container->hasDefinition('twig')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$prioritizedLoaders = [];
|
||||
$found = 0;
|
||||
|
||||
foreach ($container->findTaggedServiceIds('twig.loader', true) as $id => $attributes) {
|
||||
$priority = $attributes[0]['priority'] ?? 0;
|
||||
$prioritizedLoaders[$priority][] = $id;
|
||||
++$found;
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader".');
|
||||
}
|
||||
|
||||
if (1 === $found) {
|
||||
$container->setAlias('twig.loader', $id);
|
||||
} else {
|
||||
$chainLoader = $container->getDefinition('twig.loader.chain');
|
||||
krsort($prioritizedLoaders);
|
||||
|
||||
foreach ($prioritizedLoaders as $loaders) {
|
||||
foreach ($loaders as $loader) {
|
||||
$chainLoader->addMethodCall('addLoader', [new Reference($loader)]);
|
||||
}
|
||||
}
|
||||
|
||||
$container->setAlias('twig.loader', 'twig.loader.chain');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user