Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Cache / ListCacheBinsPass.php
1 <?php
2
3 namespace Drupal\Core\Cache;
4
5 use Symfony\Component\DependencyInjection\ContainerBuilder;
6 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
8 /**
9  * Adds cache_bins parameter to the container.
10  */
11 class ListCacheBinsPass implements CompilerPassInterface {
12
13   /**
14    * Implements CompilerPassInterface::process().
15    *
16    * Collects the cache bins into the cache_bins parameter.
17    */
18   public function process(ContainerBuilder $container) {
19     $cache_bins = [];
20     $cache_default_bin_backends = [];
21     foreach ($container->findTaggedServiceIds('cache.bin') as $id => $attributes) {
22       $bin = substr($id, strpos($id, '.') + 1);
23       $cache_bins[$id] = $bin;
24       if (isset($attributes[0]['default_backend'])) {
25         $cache_default_bin_backends[$bin] = $attributes[0]['default_backend'];
26       }
27     }
28     $container->setParameter('cache_bins', $cache_bins);
29     $container->setParameter('cache_default_bin_backends', $cache_default_bin_backends);
30   }
31
32 }