Total Complexity | 9 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class RespostaException extends \Exception { |
||
17 | |||
18 | private $status; |
||
19 | private $titulo; |
||
20 | private $mensagem; |
||
21 | private $error; |
||
22 | private $show; |
||
23 | |||
24 | public function __construct($response, $show = null) { |
||
25 | $body = json_decode($response); |
||
26 | |||
27 | foreach ($body as $key => $value) { |
||
28 | if (property_exists($this, $key)) { |
||
29 | $this->$key = $value; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | if ($show != null) { |
||
34 | $this->show = null; |
||
35 | } |
||
36 | |||
37 | parent::__construct($this->mensagem); |
||
38 | } |
||
39 | |||
40 | public function getStatus() { |
||
41 | return $this->status; |
||
42 | } |
||
43 | |||
44 | public function getTitulo() { |
||
45 | return $this->titulo; |
||
46 | } |
||
47 | |||
48 | public function getMensagem() { |
||
49 | return $this->mensagem; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * |
||
54 | * @return object |
||
55 | */ |
||
56 | public function getError() { |
||
58 | } |
||
59 | |||
60 | public function getShow() { |
||
61 | return $this->show; |
||
62 | } |
||
63 | |||
65 |