Completed
Push — master ( 965a67...27eb1e )
by Krzysztof
06:05 queued 03:13
created

TextCriteria::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace KGzocha\Searcher\Criteria;
4
5
class TextCriteria implements CriteriaInterface
6
{
7
    /**
8
     * @var string
9
     */
10
    private $text;
11
12
    /**
13
     * @param string $text
14
     */
15 9
    public function __construct($text = null)
16
    {
17 9
        $this->text = $text;
18 9
    }
19
20
    /**
21
     * @return string
22
     */
23 5
    public function getText()
24
    {
25 5
        return $this->text;
26
    }
27
28
    /**
29
     * @param string $text
30
     *
31
     * @return TextCriteria
32
     */
33 7
    public function setText($text)
34
    {
35 7
        $this->text = (string) $text;
36
37 7
        return $this;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 8
    public function shouldBeApplied()
44
    {
45 8
        return $this->text !== null && 0 < mb_strlen($this->text);
46
    }
47
}
48