sohoa/framework — pull request #40 by camael24 (2013-12-13 12:07:10+00:00)
Title: Add validate instruction and get the error

$array = array(
'foo' => 'hello world',
'bar' => 'fooo bar kkkqsdkqsdklqsdlqskdqskdqsdlkqsd'
);

$validation = array(
'foo' => 'strlen=11|strlen>=11|strlen>10',
'bar' => 'strlen>1|strlen<20'
);

$valid = new \Sohoa\Framework\Validate($array, $validation);

if ($valid->isValid() === false)
var_dump($valid->getErrors());

var_dump($valid->getError('foo'), $valid->getError('bar'));
var_dump($valid->hasError('foo'), $valid->hasError('bar'));