/** * Check value * @param string $value * @return boolean */ public function check($value) { if ($this->key === null) { throw new \RuntimeException('Is not set params before check'); } $this->fields[$this->key] = $value; foreach ($this->array as $validator) { $label = $this->labels[$this->key]; $stop = $validator->validateField($this->key, $this->fields, $label); if ($validator->hasErrors()) { foreach ($validator->getErrors()->all() as $error) { $this->entity->addError($this->key, $error); } } if ($stop !== true) { return false; } } return true; }