| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function queryWithParam(string $query, array $param) : \PDOStatement |
||
| 32 | { |
||
| 33 | $statment = parent::prepare($query); |
||
|
|
|||
| 34 | |||
| 35 | foreach ($param as $value) { |
||
| 36 | |||
| 37 | if (strpos($value[0], ':') !== 0){ |
||
| 38 | throw new InvalidArgumentException(__METHOD__.': Parameter name will be in the form :name'); |
||
| 39 | } |
||
| 40 | |||
| 41 | //reassign as reference |
||
| 42 | //because bindParam need it as reference |
||
| 43 | $ref = $value; |
||
| 44 | $ref[1] = &$value[1]; |
||
| 45 | |||
| 46 | call_user_func_array([$statment, "bindParam"], $ref); |
||
| 47 | } |
||
| 48 | |||
| 49 | $statment->execute(); |
||
| 50 | |||
| 51 | return $statment; |
||
| 52 | } |
||
| 53 | } |
||
| 55 |
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.