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