class Service (View source)

Properties

private string[] $bannedWords

Methods

array
getBannedWords()

No description

void
setBannedWords(array $bannedWords)

No description

bool
hasBannedWords(string $string)

Check if the given sentence has the banned words.

bool
hasBannedWord(string $bannedWord, string $sentence)

Check if the given sentence has the banned word.

array
explodeString(string $string)

Explode string by whitespaces, line separators, tabs, punctuations, etc.

Details

array getBannedWords()

No description

Return Value

array

void setBannedWords(array $bannedWords)

No description

Parameters

array $bannedWords

Return Value

void

bool hasBannedWords(string $string)

Check if the given sentence has the banned words.

Parameters

string $string

The sentence to check for

Return Value

bool

bool hasBannedWord(string $bannedWord, string $sentence)

Check if the given sentence has the banned word.

Parameters

string $bannedWord

The banned word to search for, can contain * as a wildcard, case insensitive

string $sentence

The string being searched, also known as the haystack

Return Value

bool

array explodeString(string $string)

Explode string by whitespaces, line separators, tabs, punctuations, etc.

Parameters

string $string

Original string to explode

Return Value

array

Array of words