\Phabstractic\Data\Types\ResourceAbstractFilter

Filter Abstract Class - Defines a predicate data structure that defines an allowed list

Allows values and types to be checked against internal predicate logic.

CHANGELOG

1.0: Created AbstractFilter - April 11th, 2015 2.0: reformatted for inclusion in phabstractic changed checkElements for loop to use correct value changed checkElements to strictly check for false changed checkElements to pass on strict, as wel as throw implements FilterInterface - July 13th, 2016

Summary

Methods
Properties
Constants
isAllowed()
checkElements()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

isAllowed()

isAllowed(mixed  $type, boolean  $strict = false) : boolean

Is value allowd 'through' this filter?

This steps the given value through the filtering process.

For flexibility in checking (if container object is strict or not) we provide a strict option in the function rather than the object at constructor time.

Parameters

mixed $type

The type to check

boolean $strict

Should we throw errors?

Throws

\Phabstractic\Data\Types\Resource\Phabstractic\Data\Types\Exception\InvalidArgumentException

CAN throw this exception

Returns

boolean —

Allowed or not?

checkElements()

checkElements(array  $values, \Phabstractic\Data\Types\Resource\FilterInterface  $filter, boolean  $strict = false) : boolean

Checks values to see if they fit through the filter

This goes through each value, and compares it against the fiter logic

Parameters

array $values

The values to check against the restrictions

\Phabstractic\Data\Types\Resource\FilterInterface $filter
boolean $strict

Throw errors?

Returns

boolean —

Valid types?