1: <?php
2: namespace Worldline\Connect\Sdk\Communication;
3:
4: use RuntimeException;
5:
6: /**
7: * Class InvalidResponseException
8: *
9: * @package Worldline\Connect\Sdk\Communication
10: */
11: class InvalidResponseException extends RuntimeException
12: {
13: /**
14: * @var ConnectionResponse
15: */
16: private $response;
17:
18: /**
19: * @param ConnectionResponse $response
20: * @param string $message
21: */
22: public function __construct(ConnectionResponse $response, $message = null)
23: {
24: if (is_null($message)) {
25: $message = 'The server returned an invalid response.';
26: }
27: parent::__construct($message);
28: $this->response = $response;
29: }
30:
31: /**
32: * @return ConnectionResponse
33: */
34: public function getResponse()
35: {
36: return $this->response;
37: }
38: }
39: