| Total Complexity | 8 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 91.67% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Request |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * |
||
| 11 | */ |
||
| 12 | 24 | public static function var(ServerRequestInterface $request, $param) |
|
| 13 | { |
||
| 14 | 24 | $request = static::getArgs($request); |
|
| 15 | |||
| 16 | 24 | return $request[$param] ?? null; |
|
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * |
||
| 21 | */ |
||
| 22 | 18 | public static function has(ServerRequestInterface $request, $param): bool |
|
| 23 | { |
||
| 24 | 18 | $request = static::getArgs($request); |
|
| 25 | |||
| 26 | 18 | return isset($request[$param]); |
|
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * |
||
| 31 | */ |
||
| 32 | 3 | public static function attr(ServerRequestInterface $request, $attribute) |
|
| 33 | { |
||
| 34 | 3 | return $request->getAttribute($attribute); |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * |
||
| 39 | */ |
||
| 40 | 3 | public static function hasAttr(ServerRequestInterface $request, $attribute): bool |
|
| 41 | { |
||
| 42 | 3 | $attributes = $request->getAttributes(); |
|
| 43 | |||
| 44 | 3 | return isset($attributes[$attribute]); |
|
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * |
||
| 49 | */ |
||
| 50 | 27 | public static function getArgs(ServerRequestInterface $request): array |
|
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * |
||
| 71 | */ |
||
| 72 | public static function getParams(ServerRequestInterface $request): array |
||
| 75 | } |
||
| 76 | } |
||
| 77 |