| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function __construct($message, $code = 500, $data = null) |
||
| 26 | { |
||
| 27 | $body = json_encode( |
||
| 28 | array_filter( |
||
| 29 | [ |
||
| 30 | 'status' => 'error', |
||
| 31 | 'code' => $code, |
||
| 32 | 'message' => (string) $message, |
||
| 33 | 'data' => '', |
||
| 34 | ] |
||
| 35 | ) |
||
| 36 | ); |
||
| 37 | |||
| 38 | if ($data) { |
||
| 39 | $body = str_replace('"data": ""', substr(substr($data, 1), 0, -1), $body); |
||
| 40 | } |
||
| 41 | |||
| 42 | $this->response = parent::instance($body, 500, $this->headers); |
||
|
|
|||
| 43 | } |
||
| 44 | } |
||
| 45 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.