Skip to content

Instantly share code, notes, and snippets.

@manuakasam
Created May 29, 2015 16:33
Show Gist options
  • Save manuakasam/aa4707a603181d3ae82f to your computer and use it in GitHub Desktop.
Save manuakasam/aa4707a603181d3ae82f to your computer and use it in GitHub Desktop.
<?php
class RowValidator
{
private $data;
private $filter;
private $errors;
public function __construct($inputFilterInterface, $data)
{
$this->filter = $inputFilterInterface;
$this->data = $data;
}
public function validate()
{
foreach ($data as $singleEntry) {
$validator->setData($singleEntry);
if (false === $validator->isValid()) {
$this->errors[$singleEntry['id']] = $validator->getMessages();
}
}
return ! (bool) count($this->errors);
}
public function getErrorMessages()
{
return $this->errors;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment