Completed
Push — master ( 1e60c5...8c1e01 )
by Valentin
18s queued 16s
created

ILike::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\DataGrid\Specification\Filter\Postgres;
6
7
use Spiral\DataGrid\Specification\Filter\Like;
8
use Spiral\DataGrid\Specification\FilterInterface;
9
use Spiral\DataGrid\SpecificationInterface;
10
11
final class ILike implements FilterInterface
12
{
13
    /** @var Like */
14
    private $like;
15
16
    public function __construct(string $expression, $value = null, string $pattern = '%%%s%%')
17
    {
18
        $this->like = new Like($expression, $value, $pattern);
19
    }
20
21
    /**
22
     * @inheritDoc
23
     */
24
    public function withValue($value): ?SpecificationInterface
25
    {
26
        $filter = clone $this;
27
        return $filter->like->withValue($value);
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getExpression(): string
34
    {
35
        return $this->like->getExpression();
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getPattern(): string
42
    {
43
        return $this->like->getPattern();
44
    }
45
46
    /**
47
     * @inheritDoc
48
     */
49
    public function getValue()
50
    {
51
        return $this->like->getValue();
52
    }
53
}
54