Skip to content

Commit

Permalink
Added support for words from array
Browse files Browse the repository at this point in the history
  • Loading branch information
phaberest committed Aug 28, 2018
1 parent f8b2a48 commit 73b204b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/CensorWords.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 73b204b

Please sign in to comment.