Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
31 | public function __construct(string $content, \stdClass $data, int $httpStatusCode) |
||
32 | { |
||
33 | $this->message = "Returned $httpStatusCode"; |
||
34 | if ($data) { |
||
35 | $this->message = $data->message; |
||
36 | if (isset($data->logref)) { |
||
37 | $this->message = "$data->message [logref $data->logref]"; |
||
38 | } |
||
39 | if (isset($data->errors)) { |
||
40 | $this->message .= "\n"; |
||
41 | foreach ($data->errors as $attribute => $error) { |
||
42 | $this->message .= "[$attribute]: $error\n"; |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 | |||
47 | $this->code = $httpStatusCode; |
||
48 | $this->data = $data; |
||
49 | $this->content = $content; |
||
50 | } |
||
51 | |||
68 |