| 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 | 1 | private function makeHandlersList(string $handlers): array |
|
| 27 | { |
||
| 28 | 1 | if ($handlers === '') { |
|
| 29 | 1 | return []; |
|
| 30 | } |
||
| 31 | 1 | $injProcessor = new InjectedStringSuit($handlers); |
|
| 32 | 1 | $result = $injProcessor->addSlashes(','); |
|
| 33 | 1 | $result = preg_split('{(?<!\\\\),\s*}', $result); |
|
| 34 | 1 | foreach ($result as &$handler) { |
|
| 35 | 1 | $injProcessor = new InjectedStringSuit(stripcslashes($handler)); |
|
| 36 | 1 | $handler = $injProcessor->resolveClassNames($this->namespace); |
|
| 37 | } |
||
| 38 | 1 | return $result; |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Creates list of handlers for input data. |
||
| 43 | * |
||
| 44 | * @return string[] handlers |
||
| 45 | */ |
||
| 46 | 1 | public function processInputData(): array |
|
| 47 | { |
||
| 48 | 1 | return $this->makeHandlersList($this->input); |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Creates list of handlers for output data. |
||
| 53 | * |
||
| 54 | * @return string[] handlers |
||
| 55 | */ |
||
| 56 | 1 | public function processOutputData(): array |
|
| 59 | } |
||
| 60 | } |