@@ -67,6 +67,9 @@ |
||
67 | 67 | return md5(json_encode((string)$uri) . json_encode($headers) . strtolower($method)); |
68 | 68 | } |
69 | 69 | |
70 | + /** |
|
71 | + * @param string $key |
|
72 | + */ |
|
70 | 73 | private function cacheResponse($key, Response $response) |
71 | 74 | { |
72 | 75 | $serializedResponse = $this->serializeResponse($response); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | private function serializeResponse(Response $response) |
43 | 43 | { |
44 | - $array = ['object' => serialize($response), 'body' => (string)$response->getBody()]; |
|
44 | + $array = ['object' => serialize($response), 'body' => (string) $response->getBody()]; |
|
45 | 45 | return serialize($array); |
46 | 46 | } |
47 | 47 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | private function getHash($uri, $headers, $method = "") |
66 | 66 | { |
67 | - return md5(json_encode((string)$uri) . json_encode($headers) . strtolower($method)); |
|
67 | + return md5(json_encode((string) $uri).json_encode($headers).strtolower($method)); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | private function cacheResponse($key, Response $response) |
@@ -24,13 +24,13 @@ |
||
24 | 24 | |
25 | 25 | foreach ($this->checkedHeaders as $headerConfig) { |
26 | 26 | if (!$response->hasHeader($headerConfig['key'])) { |
27 | - throw new ValidationFailedException('Header not found (' . $headerConfig['key'] . ')'); |
|
27 | + throw new ValidationFailedException('Header not found ('.$headerConfig['key'].')'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $currentValue = $response->getHeader($headerConfig['key'])[0]; |
31 | 31 | |
32 | - if (!preg_match('%' . $headerConfig['value'] . '%', $currentValue, $matches)) { |
|
33 | - throw new ValidationFailedException('Header "' . $headerConfig['key'] . '" does not match "' . $headerConfig['value'] . '". Current value is "' . $currentValue . '"'); |
|
32 | + if (!preg_match('%'.$headerConfig['value'].'%', $currentValue, $matches)) { |
|
33 | + throw new ValidationFailedException('Header "'.$headerConfig['key'].'" does not match "'.$headerConfig['value'].'". Current value is "'.$currentValue.'"'); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | } |