1 | <?php |
||
12 | class RuntimeCacheRepository implements IRepository |
||
13 | { |
||
14 | private $data = []; |
||
15 | |||
16 | private function getHash(string $id, string $class): string |
||
17 | { |
||
18 | return $class . '@' . $id; |
||
19 | } |
||
20 | |||
21 | private function getHashByModel(Storable $model): string |
||
22 | { |
||
23 | return $this->getHash($model->getPrimaryKey(), get_class($model)); |
||
24 | } |
||
25 | |||
26 | public function instantiate(string $class): Storable |
||
34 | |||
35 | public function find(string $id, string $class, array $columns = []): ?Storable |
||
36 | { |
||
50 | |||
51 | public function all(IQueryBuilder $query, string $class, callable $callback = null): ICollection |
||
55 | |||
56 | public function insert(Storable $model): void |
||
61 | |||
62 | public function update(Storable $model): void |
||
67 | |||
68 | public function delete(Storable $model): void |
||
73 | } |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.