Completed
Push — master ( 1e85f9...30a20e )
by Mustafa Hussain
02:04
created

ActiveRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 27
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findWhere() 0 4 1
A findWhereIn() 0 7 2
1
<?php
2
3
namespace GuardiansLabs\Repository\Repositories;
4
5
use GuardiansLabs\Repository\Exceptions\RepositoryException;
6
use Illuminate\Support\Collection;
7
8
class ActiveRepository extends BaseRepository
9
{
10
    /**
11
     * @param array $where
12
     * @param array $columns
13
     * @internal param array $attributes
14
     * @return Collection
15
     */
16
    public function findWhere(array $where, $columns = ['*'])
17
    {
18
        return $this->model->where($where[0], $where[1], $where[2])->get($columns);
19
    }
20
21
    /**
22
     * @param $column
23
     * @param $values
24
     * @throws RepositoryException
25
     * @return Collection
26
     */
27
    public function findWhereIn($column, $values)
28
    {
29
        if (!$column) {
30
            throw new RepositoryException("Column Not Given");
31
        }
32
        return $this->model->whereIn($column, $values)->get();
33
    }
34
}
35