Completed
Push — master ( 5c46bf...f77784 )
by Mahmoud
03:22
created

NotNullCriteria   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A apply() 0 4 1
1
<?php
2
3
namespace App\Port\Criteria\Eloquent;
4
5
use App\Port\Criteria\Abstracts\Criteria;
6
use Prettus\Repository\Contracts\RepositoryInterface as PrettusRepositoryInterface;
7
8
/**
9
 * Class ThisFieldCriteria
10
 *
11
 * @author  Mahmoud Zalt  <[email protected]>
12
 */
13
class NotNullCriteria extends Criteria
14
{
15
16
    /**
17
     * @var
18
     */
19
    private $field;
20
21
    /**
22
     * ThisFieldCriteria constructor.
23
     *
24
     * @param $field
25
     */
26
    public function __construct($field)
27
    {
28
        $this->field = $field;
29
    }
30
31
    /**
32
     * @param                                                   $model
33
     * @param \Prettus\Repository\Contracts\RepositoryInterface $repository
34
     *
35
     * @return  mixed
36
     */
37
    public function apply($model, PrettusRepositoryInterface $repository)
38
    {
39
        return $model->whereNotNull($this->field);
40
    }
41
}
42