Passed
Pull Request — master (#20)
by Peter
02:27
created

Analyzer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 9
dl 0
loc 52
ccs 11
cts 11
cp 1
rs 10
c 1
b 1
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A applyFilters() 0 3 1
A clear() 0 5 1
A setText() 0 6 1
A getText() 0 3 1
1
<?php
2
/**
3
 * AnalyzerText package.
4
 *
5
 * @author  Peter Gribanov <[email protected]>
6
 */
7
8
namespace AnalyzerText\Analyzer;
9
10
use AnalyzerText\Filter\Factory;
11
use AnalyzerText\Text;
12
13
/**
14
 * Базовый класс для анализаторов текста.
15
 *
16
 * @author  Peter Gribanov <[email protected]>
17
 */
18
abstract class Analyzer
19
{
20
    /**
21
     * @var Text
22
     */
23
    protected $text;
24
25
    /**
26
     * Устанавливает аналезируемый текст
27
     *
28
     * @param Text $text
29
     *
30
     * @return Analyzer
31
     */
32 14
    public function setText(Text $text)
33
    {
34 14
        $this->clear();
35 14
        $this->text = $text;
36
37 14
        return $this;
38
    }
39
40
    /**
41
     * Возвращает список слов.
42
     *
43
     * @return Text
44
     */
45 14
    public function getText()
46
    {
47 14
        return $this->text;
48
    }
49
50
    /**
51
     * Очищает анализатор
52
     *
53
     * @return Analyzer
54
     */
55 15
    public function clear()
56
    {
57 15
        $this->text = null;
58
59 15
        return $this;
60
    }
61
62
    /**
63
     * Возвращает фабрику фильтров для применения их.
64
     *
65
     * @return Factory
66
     */
67 9
    public function applyFilters()
68
    {
69 9
        return new Factory($this);
70
    }
71
}
72