public function resolveRuleAlias($rule)
{
if (isset($this->alias[$rule])) {
$rule = $this->alias[$rule];
}
// Only rule names are passed here,
// not args, so a comma could only be
// a custom message.
// TODO: but what about array validation?
// Probably a rare edge case, but we
// should mention it in the docs??
if (strpos($rule, '?') !== false) {
list($rule, $error) = explode('?', $rule, 2);
// Trim off any leading quote from from
// the error message
if (!$error) {
$error = $this->pullRule();
}
$this->custom_error = preg_replace('/^\'/', '', $error);
}
if (substr($rule, 0, 2) === '>=') {
$this->pushRule(substr($rule, 2));
return 'gte';
}
if (substr($rule, 0, 2) === '<=') {
$this->pushRule(substr($rule, 2));
return 'lte';
}
if (substr($rule, 0, 1) === '>') {
$this->pushRule(substr($rule, 1));
return 'gt';
}
if (substr($rule, 0, 1) === '<') {
$this->pushRule(substr($rule, 1));
return 'lt';
}
if (substr($rule, 0, 2) === '!=') {
$this->pushRule(substr($rule, 1));
return 'ne';
}
if (substr($rule, 0, 1) === '=') {
$this->pushRule(substr($rule, 1));
return 'eqf';
}
if (substr($rule, 0, 1) === '[') {
$this->pushRule($rule);
return 'regex';
}
if (substr($rule, 0, 1) === '$') {
$this->get(substr($rule, 1));
}
return $rule;
}