Total Complexity | 4 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
21 | abstract class AbstractDisableDrupalCacheAction implements EventSubscriberActionInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | const NULL_BACKEND_FACTORY_SERVICE_ID = 'ekino.drupal.debug.action.abstract_disable_cache.null_backend_factory'; |
||
27 | |||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | */ |
||
31 | 1 | public static function getSubscribedEvents(): array |
|
32 | { |
||
33 | return array( |
||
34 | 1 | DebugKernelEvents::AFTER_SETTINGS_INITIALIZATION => 'overrideSettings', |
|
35 | 1 | DebugKernelEvents::AFTER_CONTAINER_INITIALIZATION => 'setNullBackend', |
|
36 | ); |
||
37 | } |
||
38 | |||
39 | 1 | public function overrideSettings(): void |
|
40 | { |
||
41 | 1 | (new SettingsHelper())->override(\sprintf('[cache][bins][%s]', $this->getBin()), self::NULL_BACKEND_FACTORY_SERVICE_ID); |
|
42 | 1 | } |
|
43 | |||
44 | /** |
||
45 | * @param AfterContainerInitializationEvent $event |
||
46 | */ |
||
47 | 2 | public function setNullBackend(AfterContainerInitializationEvent $event): void |
|
55 | 1 | } |
|
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | abstract protected function getBin(): string; |
||
61 | } |
||
62 |