Total Complexity | 6 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | abstract class AbstractRequest implements RequestInterface |
||
18 | { |
||
19 | use RequestContextTrait; |
||
20 | |||
21 | /** |
||
22 | * @param array $params |
||
23 | */ |
||
24 | public function __construct(array $params) |
||
25 | { |
||
26 | $params and $this->params = $params; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Returns request defaults |
||
31 | * |
||
32 | * @param array $overrides |
||
33 | * @return array |
||
34 | */ |
||
35 | abstract public static function defaults(array $overrides): array; |
||
36 | |||
37 | /** |
||
38 | * @return array |
||
39 | */ |
||
40 | protected function createParams(): array |
||
41 | { |
||
42 | return $_SERVER; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Returns HTTP request time |
||
47 | * |
||
48 | * @return float |
||
49 | */ |
||
50 | public function getRequestTime(): float |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Returns executed script filename. |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getScriptFileName(): string |
||
61 | { |
||
62 | return $this[$this::SCRIPT_FILENAME] ?? ''; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * @return iterable |
||
67 | */ |
||
68 | public function getIterator(): iterable |
||
71 | } |
||
72 | } |
||
73 |