public function run($data, ResultInterface $result = null)
{
if ($result === null) {
$result = new Result();
}
$result->setResult(true);
foreach ($this->fields as $fieldName => $rules) {
$fieldResult = $this->validateField($fieldName, $data, $result);
if (!$fieldResult) {
// There was a failure so log it to the result object
$result->setResult(false);
}
}
return $result;
}