Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | |
2 | |
3 /* | |
4 * This file is part of the Symfony package. | |
5 * | |
6 * (c) Fabien Potencier <fabien@symfony.com> | |
7 * | |
8 * For the full copyright and license information, please view the LICENSE | |
9 * file that was distributed with this source code. | |
10 */ | |
11 | |
12 namespace Symfony\Component\DependencyInjection\Config; | |
13 | |
14 use Symfony\Component\Config\Resource\ResourceInterface; | |
15 use Symfony\Component\Config\ResourceCheckerInterface; | |
16 use Symfony\Component\DependencyInjection\ContainerInterface; | |
17 | |
18 /** | |
19 * @author Maxime Steinhausser <maxime.steinhausser@gmail.com> | |
20 */ | |
21 class ContainerParametersResourceChecker implements ResourceCheckerInterface | |
22 { | |
23 /** @var ContainerInterface */ | |
24 private $container; | |
25 | |
26 public function __construct(ContainerInterface $container) | |
27 { | |
28 $this->container = $container; | |
29 } | |
30 | |
31 /** | |
32 * {@inheritdoc} | |
33 */ | |
34 public function supports(ResourceInterface $metadata) | |
35 { | |
36 return $metadata instanceof ContainerParametersResource; | |
37 } | |
38 | |
39 /** | |
40 * {@inheritdoc} | |
41 */ | |
42 public function isFresh(ResourceInterface $resource, $timestamp) | |
43 { | |
44 foreach ($resource->getParameters() as $key => $value) { | |
45 if (!$this->container->hasParameter($key) || $this->container->getParameter($key) !== $value) { | |
46 return false; | |
47 } | |
48 } | |
49 | |
50 return true; | |
51 } | |
52 } |