/** * Is the specification satisfied by $candidate? * * @param object $candidate Candidate object * @return boolean */ public function isSatisfiedBy($candidate) { if (!$this->_shortCircuit) { $ret = $this->_leftSpec->isSatisfiedBy($candidate); return $this->_rightSpec->isSatisfiedBy($candidate) || $ret; } return $this->_leftSpec->isSatisfiedBy($candidate) || $this->_rightSpec->isSatisfiedBy($candidate); }
/** * Is the specification satisfied by $candidate? * * @param object $candidate Candidate object * @return boolean */ public function isSatisfiedBy($candidate) { return !$this->_spec->isSatisfiedBy($candidate); }
/** * Adds an item at the end of collection. * * @param mixed $item An object of type Collection::_cType * @param Streamwide_Specification_Abstract $rule Rule to add items. * @return void * @throws Streamwide_Collection_Exception when the object type is not of collection type */ public function addItem($item, Streamwide_Specification_Abstract $rule = null) { if (false === $this->_checkUserProvidedItem($item)) { $message = '%s has been set to work with objects of type "%s"'; throw new Streamwide_Collection_Exception(sprintf($message, get_class($this), $this->_cType)); } $this->_checkCallback(); if (null !== $rule && false === $rule->isSatisfiedBy($item)) { return null; } $this->_collection[] = $item; }