ArrayStopwordAnalyzer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A isStopWord() 0 3 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