Total Complexity | 9 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
12 | trait CustomControllerHelperTrait |
||
13 | { |
||
14 | use BaseControllerHelperTrait; |
||
15 | |||
16 | 97 | public function __construct() |
|
17 | { |
||
18 | 97 | if (array_key_exists('REQUEST_METHOD', $_SERVER)) { |
|
19 | 96 | $request = $_SERVER['REQUEST_METHOD'] === 'GET' ? $_GET : $_POST; |
|
20 | 96 | $this->initRequestParser($request, new Config()); |
|
21 | } |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * @param array<mixed> $request |
||
26 | * @param callable|Config $config |
||
27 | */ |
||
28 | 192 | final protected function createRequestParserFactory($request, $config): CustomRequestParserFactory |
|
31 | } |
||
32 | |||
33 | 22 | protected function tidyString(string $string): string |
|
34 | { |
||
35 | 22 | return trim( |
|
36 | 22 | strip_tags($string) |
|
37 | 22 | ); |
|
38 | } |
||
39 | |||
40 | 190 | protected function parameter(string $name): TypeParser |
|
47 | } |
||
48 | |||
49 | 2 | protected function bodyParameter(string $name): TypeParser |
|
58 |