-
Notifications
You must be signed in to change notification settings - Fork 2
Specs.md
Craig Manley edited this page Feb 17, 2016
·
3 revisions
A Specs object is simply a collection of Spec objects. Specs objects behave as (associative) arrays since they implement the Countable, IteratorAggregate, and ArrayAccess interfaces.
- Class name: Specs
- Namespace: Validate
- This class implements: Countable, IteratorAggregate, ArrayAccess
__construct(array $pairs)
The constructor takes an (associative) array of name => value pairs as argument. Typically, values must be Spec objects. For convenience sake, the following non-Spec type values are also allowed:
- boolean - then these are converted into a Spec object with 'optional' => !$value
- array - these are used as arguments to create a new Spec object
integer count()
Implements countable. Returns the number of Spec objects in the collection.
ArrayIterator getIterator()
Implements IteratorAggregate.
void offsetSet($offset, $value)
Implements ArrayAccess.
boolean offsetExists($offset)
Implements ArrayAccess.
void offsetUnset($offset)
Implements ArrayAccess.
boolean offsetGet($offset)
Implements ArrayAccess
array toArray()
Returns the collection as an (associative) array.
array keys()
Returns the keys.