1 | <?php |
||
16 | class ActionRegistry |
||
17 | { |
||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $config; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $actions; |
||
27 | |||
28 | /** |
||
29 | * @var \Psr\Log\LoggerInterface |
||
30 | */ |
||
31 | protected $logger; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | protected $debug = false; |
||
37 | |||
38 | /** |
||
39 | * ActionAggregate constructor. |
||
40 | * |
||
41 | * @param array $config |
||
42 | * @param LoggerInterface $logger |
||
43 | */ |
||
44 | public function __construct(array $config, LoggerInterface $logger) |
||
50 | |||
51 | /** |
||
52 | * Adds action to stack. |
||
53 | * |
||
54 | * @param string $name |
||
55 | * @param ActionInterface $action |
||
56 | * @param int $priority |
||
57 | */ |
||
58 | public function addAction(string $name, ActionInterface $action, int $priority = Priority::DEFAULT_PRIORITY): void |
||
66 | |||
67 | public function act(InformationCollected $event) |
||
91 | |||
92 | /** |
||
93 | * Sets debug variable based on kernel.debug param. |
||
94 | * |
||
95 | * @param bool $debug |
||
96 | */ |
||
97 | public function setDebug($debug) |
||
101 | |||
102 | /** |
||
103 | * Check if given action can act. |
||
104 | * |
||
105 | * @param string $name |
||
106 | * @param array $config |
||
107 | * |
||
108 | * @return bool |
||
109 | */ |
||
110 | protected function canActionAct($name, array $config) |
||
114 | |||
115 | /** |
||
116 | * Returns configuration for given content type identifier if exists |
||
117 | * or default one. |
||
118 | * |
||
119 | * @param string $contentTypeIdentifier |
||
120 | * |
||
121 | * @return array |
||
122 | */ |
||
123 | protected function prepareConfig($contentTypeIdentifier) |
||
135 | |||
136 | /** |
||
137 | * Sorts actions by priority. |
||
138 | */ |
||
139 | protected function prepareActions() |
||
149 | } |
||
150 |