Skip to content

Commit

Permalink
Merge pull request #56 from SkipsoLabs/master
Browse files Browse the repository at this point in the history
Added support for words from array
  • Loading branch information
snipe authored Aug 30, 2018
2 parents e927540 + 73b204b commit 621d6d8
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 621d6d8

Please sign in to comment.