Spork Code Libraries

InArray

Filter a value by a list of possible values

If value is not in list the default value (null by default) is returned.

Extends

Properties

$default

$default : mixed

Type

mixed — Default value to return if filtered value is not in list

$values

$values : array

Type

array — List of values to test filtered value against

Methods

inline()

inline(integer  $value, array  $options = array()) : mixed

Static function to execute filter

Parameters

integer $value
array $options

Returns

mixed
static
Inherited from
\Spork\Filter\AbstractFilter

__construct()

__construct(array  $values = null, mixed  $default = null) 

Parameters

array $values
mixed $default

filter()

filter(mixed  $value) : mixed

Filter value

If value is in list of valid values value is returned. Otherwise default value is returned.

Parameters

mixed $value

Returns

mixed

setDefault()

setDefault(mixed  $default) 

Set default value

Parameters

mixed $default

getDefault()

getDefault() : mixed

Get default value

Returns

mixed

setValues()

setValues(array  $values) 

Set filter values

Parameters

array $values

getValues()

getValues() : array

Get filter values

Returns

array