Completed
Push — master ( 9401a4...2cc7a2 )
by mw
13:59
created

ArrayStopwordAnalyzer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 0
dl 0
loc 35
rs 10

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
	public function __construct( array $stopwords = array() ) {
31
		$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
	}
33
34
	/**
35
	 * @since 0.1
36
	 *
37
	 * @param string $word
38
	 *
39
	 * @return boolean
40
	 */
41
	public function isStopWord( $word ) {
42
		return isset( $this->stopwords[$word] );
43
	}
44
45
}
46