RemoveWords   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 40%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A keepWord() 0 4 1
1
<?php
2
3
namespace SixtyNine\Cloud\Filters;
4
5
/**
6
 * Remove words in a blacklist.
7
 */
8
class RemoveWords extends AbstractFilter implements FilterInterface
9
{
10
    protected $unwantedWords;
11
12
    /**
13
     * @param string[] $unwantedWords Array of words to be removed.
14
     */
15
    public function __construct($unwantedWords = array(
16
        'and', 'our', 'your', 'their', 'his', 'her', 'the', 'you', 'them', 'yours',
17
        'with', 'such', 'even')
18
    )
19
    {
20
        $this->unwantedWords = $unwantedWords;
21
    }
22
23
    /** {@inheritdoc} */
24 9
    public function keepWord($word)
25
    {
26 9
        return !in_array($word, $this->unwantedWords);
27
    }
28
}