ArrayStopwordAnalyzer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Onoi\Tesa\StopwordAnalyzer;
4
5
/**
6
 * @license GNU GPL v2+
7
 * @since 0.1
8
 *
9
 * @author mwjames
10
 */
11
class ArrayStopwordAnalyzer implements StopwordAnalyzer {
12
13
	/**
14
	 * Any change to the content of its data files should be reflected in a
15
	 * version change (the version number does not necessarily correlate with
16
	 * the library version)
17
	 */
18
	const VERSION = '0.1';
19
20
	/**
21
	 * @var Cdb
22
	 */
23
	private $stopwords;
24
25
	/**
26
	 * @since 0.1
27
	 *
28
	 * @param array $stopwords
29
	 */
30 4
	public function __construct( array $stopwords = array() ) {
31 4
		$this->stopwords = array_flip( $stopwords );
0 ignored issues
show
Documentation Bug introduced by
It seems like array_flip($stopwords) of type array is incompatible with the declared type object<Onoi\Tesa\StopwordAnalyzer\Cdb> of property $stopwords.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
32 4
	}
33
34
	/**
35
	 * @since 0.1
36
	 *
37
	 * @param string $word
38
	 *
39
	 * @return boolean
40
	 */
41 3
	public function isStopWord( $word ) {
42 3
		return isset( $this->stopwords[$word] );
43
	}
44
45
}
46