| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class RequestHelper |
||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @param RequestInterface $request |
||
| 16 | * @return array |
||
| 17 | */ |
||
| 18 | 11 | public static function getHostAndPath(RequestInterface $request) : array |
|
| 25 | ]; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param RequestInterface $request |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | 12 | public static function getStorageKey(RequestInterface $request) : string |
|
| 33 | { |
||
| 34 | 12 | $uri = $request->getUri(); |
|
| 35 | 12 | $method = $request->getMethod(); |
|
| 36 | |||
| 37 | 12 | if ($method !== 'GET') |
|
| 38 | { |
||
| 39 | 2 | return self::_getMethodAndParams($method, $request->getBody()->getContents()); |
|
| 40 | } |
||
| 41 | |||
| 42 | 10 | return self::_getMethodAndParams($method, $uri->getQuery()); |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param string $method |
||
| 47 | * @param string $params |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | 12 | private static function _getMethodAndParams(string $method, string $params) : string |
|
| 53 | } |
||
| 54 | } |