/** * Adds another validator to this instance * * This checks to see if the current validator is an "Collection\All" instance. * If it is, then it adds the given validator on to the list. If it isn't, * then it wraps the current validator and the validator in the instance in * an All validator and sets it to the validator for this instance. * * @param \r8\iface\Validator $validator The validator to add to this instance * @return \r8\Form\Field Returns a self reference */ public function andValidator(\r8\iface\Validator $validator) { if ($this->validator instanceof \r8\Validator\All) { $this->validator->add($validator); } else { $this->validator = new \r8\Validator\All($this->validator, $validator); } return $this; }
/** * @see \r8\iface\Log\Matcher::matches */ public function matches(\r8\Log\Message $message) { return $this->validator->isValid($message->getMessage()); }
/** * Returns whether the current element should be included in the iteration * * @return Boolean */ public function accept() { return $this->validator->isValid($this->current()); }