update v 1.0.7.5
This commit is contained in:
46
vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php
vendored
Normal file
46
vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
/**
|
||||
* Sets the classes to compile in the cache for the container.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class AddClassesToCachePass implements CompilerPassInterface
|
||||
{
|
||||
private $kernel;
|
||||
|
||||
public function __construct(Kernel $kernel)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$classes = array();
|
||||
foreach ($container->getExtensions() as $extension) {
|
||||
if ($extension instanceof Extension) {
|
||||
$classes = array_merge($classes, $extension->getClassesToCompile());
|
||||
}
|
||||
}
|
||||
|
||||
$this->kernel->setClassCache(array_unique($container->getParameterBag()->resolveValue($classes)));
|
||||
}
|
||||
}
|
45
vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php
vendored
Normal file
45
vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* This extension sub-class provides first-class integration with the
|
||||
* Config/Definition Component.
|
||||
*
|
||||
* You can use this as base class if
|
||||
*
|
||||
* a) you use the Config/Definition component for configuration,
|
||||
* b) your configuration class is named "Configuration", and
|
||||
* c) the configuration class resides in the DependencyInjection sub-folder.
|
||||
*
|
||||
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*/
|
||||
abstract class ConfigurableExtension extends Extension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
final public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$this->loadInternal($this->processConfiguration($this->getConfiguration($configs, $container), $configs), $container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the passed container according to the merged configuration.
|
||||
*
|
||||
* @param array $mergedConfig
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container);
|
||||
}
|
44
vendor/symfony/http-kernel/DependencyInjection/Extension.php
vendored
Normal file
44
vendor/symfony/http-kernel/DependencyInjection/Extension.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Extension\Extension as BaseExtension;
|
||||
|
||||
/**
|
||||
* Allow adding classes to the class cache.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
abstract class Extension extends BaseExtension
|
||||
{
|
||||
private $classes = array();
|
||||
|
||||
/**
|
||||
* Gets the classes to cache.
|
||||
*
|
||||
* @return array An array of classes
|
||||
*/
|
||||
public function getClassesToCompile()
|
||||
{
|
||||
return $this->classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds classes to the class cache.
|
||||
*
|
||||
* @param array $classes An array of classes
|
||||
*/
|
||||
public function addClassesToCompile(array $classes)
|
||||
{
|
||||
$this->classes = array_merge($this->classes, $classes);
|
||||
}
|
||||
}
|
65
vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php
vendored
Normal file
65
vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
|
||||
/**
|
||||
* Adds services tagged kernel.fragment_renderer as HTTP content rendering strategies.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class FragmentRendererPass implements CompilerPassInterface
|
||||
{
|
||||
private $handlerService;
|
||||
private $rendererTag;
|
||||
|
||||
/**
|
||||
* @param string $handlerService Service name of the fragment handler in the container
|
||||
* @param string $rendererTag Tag name used for fragments
|
||||
*/
|
||||
public function __construct($handlerService = 'fragment.handler', $rendererTag = 'kernel.fragment_renderer')
|
||||
{
|
||||
$this->handlerService = $handlerService;
|
||||
$this->rendererTag = $rendererTag;
|
||||
}
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition($this->handlerService)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition($this->handlerService);
|
||||
foreach ($container->findTaggedServiceIds($this->rendererTag) as $id => $tags) {
|
||||
$def = $container->getDefinition($id);
|
||||
if (!$def->isPublic()) {
|
||||
throw new \InvalidArgumentException(sprintf('The service "%s" must be public as fragment renderer are lazy-loaded.', $id));
|
||||
}
|
||||
|
||||
if ($def->isAbstract()) {
|
||||
throw new \InvalidArgumentException(sprintf('The service "%s" must not be abstract as fragment renderer are lazy-loaded.', $id));
|
||||
}
|
||||
|
||||
$class = $container->getParameterBag()->resolveValue($def->getClass());
|
||||
$interface = 'Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface';
|
||||
if (!is_subclass_of($class, $interface)) {
|
||||
throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
|
||||
}
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
$definition->addMethodCall('addRendererService', array($tag['alias'], $id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
65
vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
vendored
Normal file
65
vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
|
||||
|
||||
/**
|
||||
* Lazily loads fragment renderers from the dependency injection container.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class LazyLoadingFragmentHandler extends FragmentHandler
|
||||
{
|
||||
private $container;
|
||||
private $rendererIds = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ContainerInterface $container A container
|
||||
* @param RequestStack $requestStack The Request stack that controls the lifecycle of requests
|
||||
* @param bool $debug Whether the debug mode is enabled or not
|
||||
*/
|
||||
public function __construct(ContainerInterface $container, RequestStack $requestStack, $debug = false)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
parent::__construct($requestStack, array(), $debug);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a service as a fragment renderer.
|
||||
*
|
||||
* @param string $renderer The render service id
|
||||
*/
|
||||
public function addRendererService($name, $renderer)
|
||||
{
|
||||
$this->rendererIds[$name] = $renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render($uri, $renderer = 'inline', array $options = array())
|
||||
{
|
||||
if (isset($this->rendererIds[$renderer])) {
|
||||
$this->addRenderer($this->container->get($this->rendererIds[$renderer]));
|
||||
|
||||
unset($this->rendererIds[$renderer]);
|
||||
}
|
||||
|
||||
return parent::render($uri, $renderer, $options);
|
||||
}
|
||||
}
|
41
vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php
vendored
Normal file
41
vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass as BaseMergeExtensionConfigurationPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Ensures certain extensions are always loaded.
|
||||
*
|
||||
* @author Kris Wallsmith <kris@symfony.com>
|
||||
*/
|
||||
class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPass
|
||||
{
|
||||
private $extensions;
|
||||
|
||||
public function __construct(array $extensions)
|
||||
{
|
||||
$this->extensions = $extensions;
|
||||
}
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
foreach ($this->extensions as $extension) {
|
||||
if (!count($container->getExtensionConfig($extension))) {
|
||||
$container->loadFromExtension($extension, array());
|
||||
}
|
||||
}
|
||||
|
||||
parent::process($container);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user