Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
18 | class HandlersProcessor extends TokenProcessor |
||
19 | { |
||
20 | /** |
||
21 | * Creates list of handlers from a string of handlers definition. |
||
22 | * |
||
23 | * @param string $handlers handlers |
||
24 | * @return string[] handlers |
||
25 | */ |
||
26 | 2 | private function makeHandlersList(string $handlers): array |
|
27 | { |
||
28 | 2 | if ($handlers === '') { |
|
29 | 2 | return []; |
|
30 | } |
||
31 | 2 | $injProcessor = new InjectedStringSuit($handlers); |
|
32 | 2 | $result = $injProcessor->addSlashes(',')->get(); |
|
33 | 2 | $result = preg_split('{(?<!\\\\),\s*}', $result); |
|
34 | 2 | foreach ($result as &$handler) { |
|
35 | 2 | $injProcessor = new InjectedStringSuit(stripcslashes($handler)); |
|
36 | 2 | $handler = $injProcessor->resolveClassNames($this->namespace)->processThis()->wrapWithClosure()->get(); |
|
37 | } |
||
38 | 2 | return $result; |
|
|
|||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Creates list of handlers for input data. |
||
43 | * |
||
44 | * @return string[] handlers |
||
45 | */ |
||
46 | 2 | public function processInputData(): array |
|
47 | { |
||
48 | 2 | return $this->makeHandlersList($this->input); |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * Creates list of handlers for output data. |
||
53 | * |
||
54 | * @return string[] handlers |
||
55 | */ |
||
56 | 2 | public function processOutputData(): array |
|
59 | } |
||
60 | } |