Completed
Push — master ( fe0acb...db8d28 )
by wen
11:03
created

Filter   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 88
c 0
b 0
f 0
wmc 9
lcom 1
cbo 0
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValue() 0 4 1
A setValue() 0 6 1
A getName() 0 4 1
A setName() 0 5 1
A getTitle() 0 4 1
A setTitle() 0 5 1
A isActive() 0 4 1
A apply() 0 4 1
1
<?php
2
3
namespace Sco\Admin\View\Filters;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use Sco\Admin\Contracts\View\Filters\FilterInterface;
7
8
abstract class Filter implements FilterInterface
9
{
10
    protected $type;
11
12
    protected $value;
13
14
    protected $name;
15
16
    protected $title;
17
18
    public function __construct($name, $title)
19
    {
20
        $this->setName($name)->setTitle($title);
21
    }
22
23
    /**
24
     * @return mixed
25
     */
26
    public function getValue()
27
    {
28
        return $this->value;
29
    }
30
31
    /**
32
     * @param mixed $value
33
     *
34
     * @return $this
35
     */
36
    public function setValue($value)
37
    {
38
        $this->value = $value;
39
40
        return $this;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46
    public function getName()
47
    {
48
        return $this->name;
49
    }
50
51
    /**
52
     * @param mixed $name
53
     *
54
     * @return Filter
55
     */
56
    public function setName($name)
57
    {
58
        $this->name = $name;
59
        return $this;
60
    }
61
62
    /**
63
     * @return mixed
64
     */
65
    public function getTitle()
66
    {
67
        return $this->title;
68
    }
69
70
    /**
71
     * @param mixed $title
72
     *
73
     * @return Filter
74
     */
75
    public function setTitle($title)
76
    {
77
        $this->title = $title;
78
        return $this;
79
    }
80
81
    public function isActive()
82
    {
83
        return !is_null($this->value);
84
    }
85
86
    /**
87
     * Apply filter to the query.
88
     *
89
     * @param Builder $query
90
     */
91
    public function apply(Builder $query)
92
    {
93
94
    }
95
}
96