Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
49 | 9 | public function find(array $conditions): ?ArrayAccess |
|
50 | { |
||
51 | 9 | foreach ($conditions as $key => $value) { |
|
52 | 9 | unset($conditions[$key]); |
|
53 | 9 | $conditions[':' . $key] = $value; |
|
54 | } |
||
55 | |||
56 | 9 | $this->statement->execute($conditions); |
|
57 | 9 | $result = $this->statement->fetchAll(); |
|
58 | |||
59 | 9 | if (empty($result)) { |
|
60 | 3 | return null; |
|
61 | } |
||
62 | |||
63 | 6 | return new ArrayObject($result[0]); |
|
64 | } |
||
66 |