Skip to content

Commit 621d6d8

Browse files
authoredAug 30, 2018
Merge pull request #56 from SkipsoLabs/master
Added support for words from array
2 parents e927540 + 73b204b commit 621d6d8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎src/CensorWords.php

+11
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ public function addDictionary($dictionary)
5757
$this->badwords = array_merge($this->badwords, $this->readBadWords($dictionary));
5858
}
5959

60+
/**
61+
* Adds more words to current bad words list from an array of words.
62+
*
63+
* @param array
64+
*/
65+
public function addFromArray($words)
66+
{
67+
$badwords = array_merge($this->badwords, $words);
68+
$this->badwords = array_keys(array_count_values($badwords));
69+
}
70+
6071
/**
6172
* Read bad words list from dictionar(y|ies) and return it
6273
*

0 commit comments

Comments
 (0)
Please sign in to comment.