| Total Complexity | 13 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Statement implements StatementInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The query result |
||
| 14 | * |
||
| 15 | * @var mysqli_result |
||
| 16 | */ |
||
| 17 | protected $result = null; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The constructor |
||
| 21 | * |
||
| 22 | * @param mysqli_result|bool $result |
||
| 23 | */ |
||
| 24 | public function __construct($result) |
||
| 25 | { |
||
| 26 | if (is_a($result, mysqli_result::class)) { |
||
| 27 | $this->result = $result; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @inheritDoc |
||
| 33 | */ |
||
| 34 | public function rowCount() |
||
| 35 | { |
||
| 36 | return $this->result ? $this->result->num_rows : 0; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritDoc |
||
| 41 | */ |
||
| 42 | public function fetchAssoc() |
||
| 43 | { |
||
| 44 | return ($this->result) ? $this->result->fetch_assoc() : null; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @inheritDoc |
||
| 49 | */ |
||
| 50 | public function fetchRow() |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @inheritDoc |
||
| 57 | */ |
||
| 58 | public function fetchField() |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * The destructor |
||
| 69 | */ |
||
| 70 | public function __destruct() |
||
| 74 | } |
||
| 75 | } |
||
| 76 | } |
||
| 77 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: