2004. Class

2004.1. Zend\Validator\InArray

2004.1.1. Methods

2004.1.1.1. getHaystack

getHaystack()

Returns the haystack option

Return type:mixed
Throws :ExceptionRuntimeException if haystack option is not set

2004.1.1.2. setHaystack

setHaystack()

Sets the haystack option

Parameters:mixed
Return type:InArray Provides a fluent interface

2004.1.1.3. getStrict

getStrict()

Returns the strict option

Return type:bool|int

2004.1.1.4. setStrict

setStrict()

Sets the strict option mode InArray::CHECK_STRICT | InArray::CHECK_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY | InArray::CHECK_NOT_STRICT

Parameters:int
Return type:InArray Provides a fluent interface
Throws :ExceptionInvalidArgumentException

2004.1.1.5. getRecursive

getRecursive()

Returns the recursive option

Return type:bool

2004.1.1.6. setRecursive

setRecursive()

Sets the recursive option

Parameters:bool
Return type:InArray Provides a fluent interface

2004.1.1.7. isValid

isValid()

Returns true if and only if $value is contained in the haystack option. If the strict option is true, then the type of $value is also checked.

Parameters:mixed – See {@link http://php.net/manual/function.in-array.php#104501}
Return type:bool

2004.1.2. Constants

2004.1.2.1. NOT_IN_ARRAY

2004.1.2.2. COMPARE_STRICT

standard in_array strict checking value and type

2004.1.2.3. COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY

Non strict check but prevents “asdf” == 0 returning TRUE causing false/positive. This is the most secure option for non-strict checks and replaces strict = false This will only be effective when the input is a string

2004.1.2.4. COMPARE_NOT_STRICT

Standard non-strict check where “asdf” == 0 returns TRUE This will be wanted when comparing “0” against int 0