ValueComparisonTrait
Value comparison trait
Tags
Table of Contents
Methods
- containsMatch() : bool
- Determine if $needle is contained within $haystack (used by Contains/NotContains)
- containsNoneMatch() : bool
- Determine if none of $needle is contained within $haystack (used by NotContains)
- endsWithMatch() : bool
- Determine if $inputValue ends with $comparisonValue (used by EndsWith/NotEndsWith)
- inMatch() : bool
- Determine if $needle is contained within $haystack (used by In/NotIn)
- inNoneMatch() : bool
- Determine if none of $needle is contained within $haystack (used by NotIn)
- resolveComparisonValueString() : string
- Resolve the comparison value string used in default messages (used by StartsWith/NotStartsWith/EndsWith/NotEndsWith)
- resolveInputValue() : mixed
- Resolve the input value, honoring bracket key-field notation
- startsWithMatch() : bool
- Determine if $inputValue starts with $comparisonValue (used by StartsWith/NotStartsWith)
Methods
containsMatch()
Determine if $needle is contained within $haystack (used by Contains/NotContains)
protected
containsMatch(mixed $needle, mixed $haystack) : bool
Parameters
- $needle : mixed
- $haystack : mixed
Return values
boolcontainsNoneMatch()
Determine if none of $needle is contained within $haystack (used by NotContains)
protected
containsNoneMatch(mixed $needle, mixed $haystack) : bool
Note: not a simple boolean negation of containsMatch() — when $needle is an array compared against a scalar $haystack, this requires that none of $needle's elements are found (NOR), whereas containsMatch() requires that all of them are found (AND).
Parameters
- $needle : mixed
- $haystack : mixed
Return values
boolendsWithMatch()
Determine if $inputValue ends with $comparisonValue (used by EndsWith/NotEndsWith)
protected
endsWithMatch(mixed $inputValue, mixed $comparisonValue) : bool
An array $inputValue is never considered to "end with" anything, guarding against PHP silently coercing the array to the literal string "Array" and matching on that.
Parameters
- $inputValue : mixed
- $comparisonValue : mixed
Return values
boolinMatch()
Determine if $needle is contained within $haystack (used by In/NotIn)
protected
inMatch(mixed $needle, mixed $haystack) : bool
Parameters
- $needle : mixed
- $haystack : mixed
Return values
boolinNoneMatch()
Determine if none of $needle is contained within $haystack (used by NotIn)
protected
inNoneMatch(mixed $needle, mixed $haystack) : bool
Note: not a simple boolean negation of inMatch() — when $needle is an array compared against a scalar $haystack, this requires that none of $needle's elements are found (NOR), whereas inMatch() requires that all of them are found (AND).
Parameters
- $needle : mixed
- $haystack : mixed
Return values
boolresolveComparisonValueString()
Resolve the comparison value string used in default messages (used by StartsWith/NotStartsWith/EndsWith/NotEndsWith)
protected
resolveComparisonValueString(mixed $value) : string
Parameters
- $value : mixed
Return values
stringresolveInputValue()
Resolve the input value, honoring bracket key-field notation
protected
resolveInputValue() : mixed
startsWithMatch()
Determine if $inputValue starts with $comparisonValue (used by StartsWith/NotStartsWith)
protected
startsWithMatch(mixed $inputValue, mixed $comparisonValue) : bool
An array $inputValue is never considered to "start with" anything, guarding against PHP silently coercing the array to the literal string "Array" and matching on that.
Parameters
- $inputValue : mixed
- $comparisonValue : mixed