AbstractFilter::sign()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
3
namespace Yaro\Jarboe\Table\Filters;
4
5
use Yaro\Jarboe\Table\Fields\AbstractField;
0 ignored issues
show
Bug introduced by
The type Yaro\Jarboe\Table\Fields\AbstractField was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
abstract class AbstractFilter
8
{
9
    /** @var AbstractField */
10
    protected $field;
11
    protected $value;
12
    protected $sign = '=';
13
14 65
    public static function make()
15
    {
16 65
        return new static;
17
    }
18
19 39
    public function field(AbstractField $field = null)
20
    {
21 39
        if (is_null($field)) {
22 16
            return $this->field;
23
        }
24
25 39
        $this->field = $field;
26 39
    }
27
28 16
    public function value($value = null)
29
    {
30 16
        if (is_null($value)) {
31 16
            return $this->value;
32
        }
33
34 11
        $this->value = $value;
35 11
    }
36
37 4
    public function getValue($tableIdentifier)
38
    {
39 4
        $key = sprintf('jarboe.%s.search.%s', $tableIdentifier, $this->field()->name());
40
41 4
        return session($key);
42
    }
43
44 8
    public function sign(string $sign)
45
    {
46 8
        $this->sign = $sign;
47
48 8
        return $this;
49
    }
50
51
    abstract public function render();
52
53
    abstract public function apply($query);
54
}
55