Test Setup Failed
Push — master ( 8eb8d2...671183 )
by Churakov
04:26 queued 12s
created

BaseFilter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
dl 0
loc 52
rs 10
c 1
b 0
f 1
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 3 1
A __construct() 0 4 1
A render() 0 2 1
A getValue() 0 3 1
A getName() 0 3 1
1
<?php
2
3
namespace ChurakovMike\EasyGrid\Filters;
4
5
use ChurakovMike\EasyGrid\Traits\Configurable;
6
7
/**
8
 * Class BaseFilter
9
 * @package ChurakovMike\EasyGrid\Filters
10
 */
11
abstract class BaseFilter
12
{
13
    use Configurable;
14
15
    /**
16
     * @var string $name
17
     */
18
    public $name;
19
20
    /**
21
     * @var string $value
22
     */
23
    public $value;
24
25
    /**
26
     * BaseFilter constructor.
27
     * @param $config
28
     */
29
    public function __construct($config)
30
    {
31
        $this->loadConfig($config);
32
        $this->setValue();
33
    }
34
35
    /**
36
     * Render filters template.
37
     */
38
    public function render(): string
39
    {
40
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
41
42
    /**
43
     * @return mixed
44
     */
45
    public function getValue(): string
46
    {
47
        return $this->value ?? '';
48
    }
49
50
    public function setValue()
51
    {
52
        $this->value = request()->input('filters.' . $this->getName());
53
    }
54
55
    /**
56
     * Return filter name.
57
     *
58
     * @return string
59
     */
60
    public function getName(): string
61
    {
62
        return $this->name;
63
    }
64
}
65