Passed
Pull Request — master (#20)
by Peter
03:49 queued 01:47
created

Analyzer::getText()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * AnalyzerText package.
4
 *
5
 * @author  Peter Gribanov <[email protected]>
6
 */
7
8
namespace AnalyzerText\Analyzer;
9
10
use AnalyzerText\Text;
11
use AnalyzerText\Filter\Factory;
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