Bit-Wasp /
stratum-php
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace BitWasp\Stratum\Exceptions; |
||
| 4 | |||
| 5 | class ApiError extends \Exception |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var string |
||
| 9 | */ |
||
| 10 | private $id; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @param string $id |
||
| 14 | * @param int $error |
||
| 15 | */ |
||
| 16 | 1 | public function __construct($id, $error) |
|
| 17 | { |
||
| 18 | 1 | $this->id = $id; |
|
| 19 | 1 | parent::__construct($error); |
|
| 20 | 1 | } |
|
| 21 | |||
| 22 | /** |
||
| 23 | * @return string |
||
| 24 | */ |
||
| 25 | 1 | public function getId() |
|
| 26 | { |
||
| 27 | 1 | return $this->id; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | 1 | public function write() |
|
| 34 | { |
||
| 35 | 1 | return json_encode([ |
|
| 36 | 1 | 'id' => $this->id, |
|
| 37 | 1 | 'error' => parent::getMessage() |
|
|
0 ignored issues
–
show
|
|||
| 38 | 1 | ]) . "\n"; |
|
| 39 | } |
||
| 40 | } |
||
| 41 |
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.