class Contains extends StringComparator (View source)

Check if a string contains any or all of the search strings, with support for case insensitivity.

Traits

Methods

__construct(array|string $search, bool $caseSensitive = true, bool $all = true)

No description

bool
__invoke(mixed $value)

Compare the input value against the comparator.

static Contains
all(array|string $search, bool $caseSensitive = true)

No description

static Contains
any(array|string $search, bool $caseSensitive = true)

No description

bool
check(mixed $value)

Compare the input string against the comparator.

bool
checkString(string $value)

Compare the input string against the comparator.

static Contains
make(array|string $search, bool $caseSensitive = true, bool $all = true)

No description

string
resolveStringInput(mixed $value)

No description

Details

__construct(array|string $search, bool $caseSensitive = true, bool $all = true)

No description

Parameters

array|string $search

The string(s) to search for

bool $caseSensitive

Whether to perform a case-sensitive search (default: true)

bool $all

Whether to check if all the search strings are contained in the subject (default: true)

final bool __invoke(mixed $value)

Compare the input value against the comparator.

Parameters

mixed $value

Return Value

bool

static Contains all(array|string $search, bool $caseSensitive = true)

No description

Parameters

array|string $search
bool $caseSensitive

Return Value

Contains

static Contains any(array|string $search, bool $caseSensitive = true)

No description

Parameters

array|string $search
bool $caseSensitive

Return Value

Contains

final bool check(mixed $value)

Compare the input string against the comparator.

Parameters

mixed $value

Return Value

bool

protected bool checkString(string $value)

Compare the input string against the comparator.

Parameters

string $value

Return Value

bool

static Contains make(array|string $search, bool $caseSensitive = true, bool $all = true)

No description

Parameters

array|string $search

The string(s) to search for

bool $caseSensitive

Whether to perform a case-sensitive search (default: true)

bool $all

Whether to check if all the search strings are contained in the subject (default: true)

Return Value

Contains

protected string resolveStringInput(mixed $value)

No description

Parameters

mixed $value

Return Value

string