| 1 | <?php |
||
| 21 | class EloquentRepository extends BaseRepository |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * Create a new repository model instance. |
||
| 25 | * |
||
| 26 | * @throws \Rinvex\Repository\Exceptions\RepositoryException |
||
| 27 | * |
||
| 28 | * @return \Illuminate\Database\Eloquent\Model |
||
| 29 | */ |
||
| 30 | public function createModel() |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Find an entity by it's primary key. |
||
| 49 | * |
||
| 50 | * @param int $id |
||
| 51 | * @param array $attributes |
||
| 52 | * |
||
| 53 | * @return \Illuminate\Database\Eloquent\Model |
||
| 54 | */ |
||
| 55 | public function find($id, $attributes = ['*']) |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Find an entity by one of it's attributes. |
||
| 64 | * |
||
| 65 | * @param string $attribute |
||
| 66 | * @param string $value |
||
| 67 | * @param array $attributes |
||
| 68 | * |
||
| 69 | * @return \Illuminate\Database\Eloquent\Model |
||
| 70 | */ |
||
| 71 | public function findBy($attribute, $value, $attributes = ['*']) |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Find all entities. |
||
| 80 | * |
||
| 81 | * @param array $attributes |
||
| 82 | * |
||
| 83 | * @return \Illuminate\Support\Collection |
||
| 84 | */ |
||
| 85 | public function findAll($attributes = ['*']) |
||
| 91 | |||
| 92 | /** |
||
| 93 | * Paginate all entities. |
||
| 94 | * |
||
| 95 | * @param int|null $perPage |
||
| 96 | * @param array $attributes |
||
| 97 | * @param string $pageName |
||
| 98 | * @param int|null $page |
||
| 99 | * |
||
| 100 | * @throws \InvalidArgumentException |
||
| 101 | * |
||
| 102 | * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator |
||
| 103 | */ |
||
| 104 | public function paginate($perPage = null, $attributes = ['*'], $pageName = 'page', $page = null) |
||
| 110 | |||
| 111 | /** |
||
| 112 | * Paginate all entities into a simple paginator. |
||
| 113 | * |
||
| 114 | * @param int $perPage |
||
|
|
|||
| 115 | * @param array $attributes |
||
| 116 | * @param string $pageName |
||
| 117 | * |
||
| 118 | * @return \Illuminate\Contracts\Pagination\Paginator |
||
| 119 | */ |
||
| 120 | public function simplePaginate($perPage = null, $attributes = ['*'], $pageName = 'page') |
||
| 126 | |||
| 127 | /** |
||
| 128 | * Find all entities matching where conditions. |
||
| 129 | * |
||
| 130 | * @param array $where |
||
| 131 | * @param array $attributes |
||
| 132 | * |
||
| 133 | * @return \Illuminate\Support\Collection |
||
| 134 | */ |
||
| 135 | public function findWhere(array $where, $attributes = ['*']) |
||
| 144 | |||
| 145 | /** |
||
| 146 | * Find all entities matching whereIn conditions. |
||
| 147 | * |
||
| 148 | * @param array $where |
||
| 149 | * @param array $attributes |
||
| 150 | * |
||
| 151 | * @return \Illuminate\Support\Collection |
||
| 152 | */ |
||
| 153 | public function findWhereIn(array $where, $attributes = ['*']) |
||
| 162 | |||
| 163 | /** |
||
| 164 | * Find all entities matching whereNotIn conditions. |
||
| 165 | * |
||
| 166 | * @param array $where |
||
| 167 | * @param array $attributes |
||
| 168 | * |
||
| 169 | * @return \Illuminate\Support\Collection |
||
| 170 | */ |
||
| 171 | public function findWhereNotIn(array $where, $attributes = ['*']) |
||
| 180 | |||
| 181 | /** |
||
| 182 | * Create a new entity with the given attributes. |
||
| 183 | * |
||
| 184 | * @param array $attributes |
||
| 185 | * |
||
| 186 | * @return array |
||
|
1 ignored issue
–
show
|
|||
| 187 | */ |
||
| 188 | public function create(array $attributes = []) |
||
| 208 | |||
| 209 | /** |
||
| 210 | * Update an entity with the given attributes. |
||
| 211 | * |
||
| 212 | * @param mixed $id |
||
| 213 | * @param array $attributes |
||
| 214 | * |
||
| 215 | * @return array |
||
|
1 ignored issue
–
show
|
|||
| 216 | */ |
||
| 217 | public function update($id, array $attributes = []) |
||
| 239 | |||
| 240 | /** |
||
| 241 | * Delete an entity with the given id. |
||
| 242 | * |
||
| 243 | * @param mixed $id |
||
| 244 | * |
||
| 245 | * @return array |
||
|
1 ignored issue
–
show
|
|||
| 246 | */ |
||
| 247 | public function delete($id) |
||
| 266 | } |
||
| 267 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.