ArticleWord   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 42
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A newFromLexicalString() 0 8 2
A stemm() 0 8 2
1
<?php
2
namespace Mystem;
3
4
/**
5
 * Class ArticleWord
6
 *
7
 * Initialized from Article class, has link to original article and $position, filled with in Article position
8
 * @package Mystem
9
 */
10
class ArticleWord extends Word
11
{
12
13
    protected static $constructorClass = '\Mystem\ArticleWord';
14
15
    /**
16
     * @var string $article link to original article string
17
     */
18
    protected $article;
19
20
    public $position;
21
22
    /**
23
     * @param array|string $lexicalString
24
     * @param int $maxVariants
25
     * @param string $article
26
     * @return ArticleWord
27
     */
28 4
    public static function newFromLexicalString($lexicalString, $maxVariants = null, &$article = null)
29
    {
30
        /* @var ArticleWord $word */
31 4
        $word = parent::newFromLexicalString($lexicalString, $maxVariants);
32 4
        if ($article !== null) {
33 4
            $word->article = &$article;
34 4
        }
35 4
        return $word;
36
    }
37
38
    /**
39
     * @param string $word
40
     * @param int $maxVariants
41
     * @param string $article
42
     * @return ArticleWord
43
     */
44 1
    public static function stemm($word, $maxVariants = null, &$article = null)
45
    {
46
        /* @var ArticleWord $word */
47 1
        $word = parent::stemm($word, $maxVariants);
48 1
        if ($article !== null) {
49 1
            $word->article = &$article;
50 1
        }
51 1
        return $word;
52
    }
53
}
54