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

TextCriteria   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 43
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
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
     * @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