Chris@14: Chris@14: * Chris@14: * For the full copyright and license information, please view the LICENSE Chris@14: * file that was distributed with this source code. Chris@14: */ Chris@14: Chris@14: namespace Symfony\Component\DependencyInjection\Config; Chris@14: Chris@14: use Symfony\Component\Config\Resource\ResourceInterface; Chris@14: use Symfony\Component\Config\ResourceCheckerInterface; Chris@14: use Symfony\Component\DependencyInjection\ContainerInterface; Chris@14: Chris@14: /** Chris@14: * @author Maxime Steinhausser Chris@14: */ Chris@14: class ContainerParametersResourceChecker implements ResourceCheckerInterface Chris@14: { Chris@14: /** @var ContainerInterface */ Chris@14: private $container; Chris@14: Chris@14: public function __construct(ContainerInterface $container) Chris@14: { Chris@14: $this->container = $container; Chris@14: } Chris@14: Chris@14: /** Chris@14: * {@inheritdoc} Chris@14: */ Chris@14: public function supports(ResourceInterface $metadata) Chris@14: { Chris@14: return $metadata instanceof ContainerParametersResource; Chris@14: } Chris@14: Chris@14: /** Chris@14: * {@inheritdoc} Chris@14: */ Chris@14: public function isFresh(ResourceInterface $resource, $timestamp) Chris@14: { Chris@14: foreach ($resource->getParameters() as $key => $value) { Chris@14: if (!$this->container->hasParameter($key) || $this->container->getParameter($key) !== $value) { Chris@14: return false; Chris@14: } Chris@14: } Chris@14: Chris@14: return true; Chris@14: } Chris@14: }