public function runField($field, array $data, ResultInterface $result = null)
{
if ($result === null) {
$result = new Result();
}
$fieldResult = false;
if (isset($data[$field])) {
$fieldResult = $this->validateField($field, $data, $result);
}
// Log the result
$result->setResult($fieldResult);
return $result;
}
/** * Validates one key-value pair * * @param string $key * @param mixed $value */ public function validateOne($key, $value) { $result = $this->validator->runField($key, array($key => $value)); if ($result->isValid() === false) { throw new InvalidArgumentException($result->getError($key)); } }