okaybueno /
laravel-repositories
| 1 | <?php |
||
| 2 | |||
| 3 | namespace OkayBueno\Repositories; |
||
| 4 | |||
| 5 | use OkayBueno\Repositories\Criteria\CriteriaInterface; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Interface RepositoryInterface |
||
| 9 | * @package OkayBueno\Repositories |
||
| 10 | */ |
||
| 11 | interface RepositoryInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Finds one item by the provided field. |
||
| 15 | * |
||
| 16 | * @param $value mixed Value used for the filter. If NULL passed then it will take ONLY the criteria. |
||
| 17 | * @param string $field Field on the database that you will filter by. Default: id. |
||
| 18 | * @param array $columns Columns to retrieve with the object. |
||
| 19 | * @return mixed Model|NULL An Eloquent object when there is a result, NULL when there are no matches. |
||
| 20 | */ |
||
| 21 | public function findOneBy( $value = NULL, $field = 'id', array $columns = ['*'] ); |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Finds ALL items the repository abstract without any kind of filter. |
||
| 25 | * |
||
| 26 | * @param array $columns Columns to retrieve with the objects. |
||
| 27 | * @return mixed Collection Laravel Eloquent's Collection that may or may not be empty. |
||
| 28 | */ |
||
| 29 | public function findAll( array $columns = ['*'] ); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Finds ALL items by the provided field. If NULL specified for the first 2 parameters, then it will take ONLY the |
||
| 33 | * criteria. |
||
| 34 | * |
||
| 35 | * @param $value mixed Value used for the filter. |
||
| 36 | * @param string $field Field on the database that you will filter by. Default: id. |
||
| 37 | * @param array $columns Columns to retrieve with the objects. |
||
| 38 | * @return mixed Collection Laravel Eloquent's Collection that may or may not be empty. |
||
| 39 | */ |
||
| 40 | public function findAllBy( $value = NULL, $field = NULL, array $columns = ['*'] ); |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Finds ALL the items in the repository where the given field is inside the given values. |
||
| 44 | * |
||
| 45 | * @param array $value mixed Array of values used for the filter. |
||
| 46 | * @param string $field Field on the database that you will filter by. |
||
| 47 | * @param array $columns Columns to retrieve with the objects. |
||
| 48 | * @return mixed Collection Laravel Eloquent's Collection that may or may not be empty. |
||
| 49 | */ |
||
| 50 | public function findAllWhereIn( array $value, $field, array $columns = ['*'] ); |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Allows you to eager-load entity relationships when retrieving entities, either with or without criterias. |
||
| 54 | * |
||
| 55 | * @param array|string $relations Relations to eager-load along with the entities. |
||
| 56 | * @return mixed The current repository object instance. |
||
| 57 | */ |
||
| 58 | public function with( $relations ); |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Adds a criteria to the query. |
||
| 62 | * |
||
| 63 | * @param CriteriaInterface $criteria Object that declares and implements the criteria used. |
||
| 64 | * @return mixed The current repository object instance. |
||
| 65 | */ |
||
| 66 | public function addCriteria( CriteriaInterface $criteria ); |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Skips the current criteria (all of them). Useful when you don't want to reset the object but just not use the |
||
| 70 | * filters applied so far. |
||
| 71 | * |
||
| 72 | * @param bool|TRUE $status If you want to skip the criteria or not. |
||
| 73 | * @return mixed The current repository object instance. |
||
| 74 | */ |
||
| 75 | public function skipCriteria( $status = TRUE ); |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Returns a Paginator that based on the criteria or filters given. |
||
| 79 | * |
||
| 80 | * @param int $perPage Number of results to return per page. |
||
| 81 | * @param array $columns Columns to retrieve with the objects. |
||
| 82 | * @return Paginator object with the results and the paginator. |
||
|
0 ignored issues
–
show
|
|||
| 83 | */ |
||
| 84 | public function paginate( $perPage, array $columns = ['*'] ); |
||
| 85 | |||
| 86 | /** |
||
| 87 | * Allows you to set the current page with using the paginator. Useful when you want to overwrite the $_GET['page'] |
||
| 88 | * parameter and retrieve a specific page directly without using HTTP. |
||
| 89 | * |
||
| 90 | * @param int $page The page you want to retrieve. |
||
| 91 | * @return mixed The current repository object instance. |
||
| 92 | */ |
||
| 93 | public function setCurrentPage( $page ); |
||
| 94 | |||
| 95 | /** |
||
| 96 | * Creates a new entity of the entity type the repository handles, given certain data. |
||
| 97 | * |
||
| 98 | * @param array $data Data the entity will have. |
||
| 99 | * @return mixed Model|NULL An Eloquent object when the entity was created, NULL in case of error. |
||
| 100 | */ |
||
| 101 | public function create( array $data ); |
||
| 102 | |||
| 103 | /** |
||
| 104 | * Updates as many entities as the filter matches with the given $data. |
||
| 105 | * |
||
| 106 | * @param array $data Fields & new values to be updated on the entity/entities. |
||
| 107 | * @param $value mixed Value used for the filter. |
||
| 108 | * @param string $field Field on the database that you will filter by. Default: id. |
||
| 109 | * @return mixed Model|NULL|integer An Eloquent object representing the updated entity, a number of entities updated if mass updating, |
||
| 110 | * or NULL in case of error. |
||
| 111 | */ |
||
| 112 | public function updateBy( array $data, $value = NULL, $field = 'id' ); |
||
| 113 | |||
| 114 | /** |
||
| 115 | * Removes as many entities as the filter matches. If softdelete is applied, then they will be soft-deleted. |
||
| 116 | * Criteria is applied as well, so please be careful with it. |
||
| 117 | * |
||
| 118 | * @param $value |
||
| 119 | * @param $value mixed Value used for the filter. |
||
| 120 | * @param string $field Field on the database that you will filter by. Default: id. |
||
| 121 | * @return boolean TRUE It will always return TRUE. |
||
| 122 | */ |
||
| 123 | public function delete( $value = NULL, $field = 'id' ); |
||
| 124 | |||
| 125 | /** |
||
| 126 | * @return int number of records matching the criteria (or total amount of records). |
||
| 127 | */ |
||
| 128 | public function count(); |
||
| 129 | |||
| 130 | /** |
||
| 131 | * Resets the current scope of the repository. That is: clean the criteria, and all other properties that could have |
||
| 132 | * been modified, like current page, etc. |
||
| 133 | * |
||
| 134 | * @return mixed The current repository object instance. |
||
| 135 | */ |
||
| 136 | public function resetScope(); |
||
| 137 | |||
| 138 | /** |
||
| 139 | * Permanently removes a record (or set of records) from the database. |
||
| 140 | * Criteria is applied as well, so please be careful with it. |
||
| 141 | * |
||
| 142 | * @param $value mixed Value used for the filter. |
||
| 143 | * @param string $field Field on the database that you will filter by. |
||
| 144 | * @return mixed |
||
| 145 | */ |
||
| 146 | public function destroy( $value = NULL, $field = 'id' ); |
||
| 147 | |||
| 148 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths