Completed
Push — master ( 22cfbb...0f305f )
by Krzysztof
8s
created

TextCriteria   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setText() 0 6 1
A shouldBeApplied() 0 4 2
A getText() 0 4 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
     * @return string
14
     */
15 5
    public function getText()
16
    {
17 5
        return $this->text;
18
    }
19
20
    /**
21
     * @param string $text
22
     *
23
     * @return TextCriteria
24
     */
25 7
    public function setText($text)
26
    {
27 7
        $this->text = (string) $text;
28
29 7
        return $this;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 8
    public function shouldBeApplied()
36
    {
37 8
        return $this->text !== null && 0 < mb_strlen($this->text);
38
    }
39
}
40