| Total Complexity | 6 |
| Total Lines | 72 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class JsonExceptionResponse extends AbstractJsonResponse |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * RESULT_DESCRIPTION |
||
| 13 | */ |
||
| 14 | const RESULT = 'Order not confirmed'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * STATUS_CODE |
||
| 18 | */ |
||
| 19 | const STATUS_CODE = 500; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string $result |
||
| 23 | */ |
||
| 24 | protected $result; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var int $status |
||
| 28 | */ |
||
| 29 | protected $statusCode; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * JsonExceptionResponse constructor. |
||
| 33 | */ |
||
| 34 | public function __construct() |
||
| 35 | { |
||
| 36 | $this->result = self::RESULT; |
||
| 37 | $this->statusCode = self::STATUS_CODE; |
||
| 38 | |||
| 39 | parent::__construct(); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param \Exception $exception |
||
| 44 | */ |
||
| 45 | public function setException(\Exception $exception) |
||
| 46 | { |
||
| 47 | $this->result = $exception->getMessage(); |
||
| 48 | $this->statusCode = $exception->getCode(); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | public function getResult() |
||
| 55 | { |
||
| 56 | return $this->result; |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param string $result |
||
| 61 | */ |
||
| 62 | public function setResult($result) |
||
| 63 | { |
||
| 64 | $this->result = $result; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return int |
||
| 69 | */ |
||
| 70 | public function getStatusCode() |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param int $statusCode |
||
| 77 | */ |
||
| 78 | public function setStatusCode($statusCode) |
||
| 81 | } |
||
| 82 | } |
||
| 83 |