Completed
Push — master ( 7a35bc...7eff79 )
by Krzysztof
05:49 queued 02:58
created

TextCriteria   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 71.43%

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
rs 10
ccs 5
cts 7
cp 0.7143

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getText() 0 4 1
A setText() 0 6 1
A shouldBeApplied() 0 4 2
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
    public function getText()
16
    {
17
        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