diff --git a/src/CensorWords.php b/src/CensorWords.php index 0eede25..a453422 100644 --- a/src/CensorWords.php +++ b/src/CensorWords.php @@ -57,6 +57,17 @@ public function addDictionary($dictionary) $this->badwords = array_merge($this->badwords, $this->readBadWords($dictionary)); } + /** + * Adds more words to current bad words list from an array of words. + * + * @param array + */ + public function addFromArray($words) + { + $badwords = array_merge($this->badwords, $words); + $this->badwords = array_keys(array_count_values($badwords)); + } + /** * Read bad words list from dictionar(y|ies) and return it *