1 | <?php |
||
17 | class BaseRepository implements RepositoryContract |
||
18 | { |
||
19 | |||
20 | protected $model ; |
||
21 | /** |
||
22 | * @param Model $model |
||
23 | * @return object |
||
24 | */ |
||
25 | public function setModel(Model $model) |
||
30 | |||
31 | /** |
||
32 | * @return Model |
||
33 | */ |
||
34 | public function getModel() |
||
38 | |||
39 | /** |
||
40 | * @return Collection |
||
41 | */ |
||
42 | public function findAll() |
||
46 | |||
47 | /** |
||
48 | * @param array $data |
||
49 | * @return Collection |
||
50 | * @throws RepositoryException |
||
51 | */ |
||
52 | public function createNew(array $data) |
||
60 | |||
61 | /** |
||
62 | * @param $itemId |
||
63 | * @return Collection |
||
64 | * @throws RepositoryException |
||
65 | */ |
||
66 | public function findItemById($itemId) |
||
74 | |||
75 | /** |
||
76 | * @param $itemId |
||
77 | * @param array $data |
||
78 | * @throws RepositoryException |
||
79 | * @return mixed |
||
80 | */ |
||
81 | public function update($itemId, array $data) |
||
93 | |||
94 | /** |
||
95 | * @param $itemId |
||
96 | * @return mixed |
||
97 | */ |
||
98 | public function delete($itemId) |
||
102 | |||
103 | /** |
||
104 | * @param $where |
||
105 | * @param array $attributes |
||
106 | * @return Collection |
||
107 | */ |
||
108 | public function findWhere($where, $attributes = ['*']) |
||
112 | } |
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.