Version 1
[yaffs-website] / web / modules / contrib / devel / webprofiler / src / Profiler / ProfilerStorageManager.php
1 <?php
2
3 namespace Drupal\webprofiler\Profiler;
4
5 use Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface;
6
7 /**
8  * Class ProfilerStorageManager
9  */
10 class ProfilerStorageManager {
11
12   /**
13    * @var array
14    */
15   private $storages;
16
17   /**
18    * @return array
19    */
20   public function getStorages() {
21     $output = [];
22
23     /** @var \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface $storage */
24     foreach ($this->storages as $id => $storage) {
25       $output[$id] = $storage['title'];
26     }
27
28     return $output;
29   }
30
31   /**
32    * @param $id
33    *
34    * @return array
35    */
36   public function getStorage($id) {
37     return $this->storages[$id];
38   }
39
40   /**
41    * @param $id
42    * @param $title
43    * @param \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface $storage
44    */
45   public function addStorage($id, $title, ProfilerStorageInterface $storage) {
46     $this->storages[$id] = [
47       'title' => $title,
48       'class' => $storage,
49     ];
50   }
51
52 }