/** * The RestrictedList Constructor * * Takes the data, runs it through the restrictions via the parent class * if all is successful (nothing is thrown), creates the composited\ * Stack object * * Options: strict - Do we raise exceptions when values are misaligned? * * @param mixed $data The data to populate the internal member array * @param Falcraft\Data\Types\Resource\AbstractFilter $restrictions * The predicate type object * @param array $options The options for the stack * */ function __construct($data = null, DataResource\AbstractFilter $restrictions = null, $options = array()) { if (is_array($options)) { $options = array_change_key_case($options); } $this->configure($options); parent::__construct($data, $restrictions, $options); }
/** * The Sorted List constructor * * Accepts data, and the obligatory options parameter * * Passes the required restrictions onto the parent class along with * the options * * NOTE: In order to sort a list it MUST all be the same type, so * restrictions are set up. * * This instantiates the class and sets the index * * @param mixed $data The data to initialize the queue * @param Falcraft\Data\Types\Resource\AbstractFilter * The types filter * @param array $options The options to pass into the object * */ public function __construct($data = null, $restrictions = null, $options = array()) { if (is_array($options)) { $options = array_change_key_case($options); } $this->configure($options); parent::__construct($data, $this->restrictions, $options); // Auto sort according to comparison function provided by child usort($this->list, array($this, 'cmp')); }