public function addRule($Validation, $arguments = []) { if (!$Validation instanceof ValidationInterface) { $this->appendRule(Validation::buildRule($Validation, $arguments)); } else { $this->appendRule($Validation); } return $this; }
private function getRule($input) { if (!isset($input[$this->comparedKey])) { throw $this->reportError($this->comparedKey); } if (!isset($input[$this->baseKey])) { throw $this->reportError($this->baseKey); } try { $rule = Validation::__callStatic($this->ruleName, [$input[$this->baseKey]]); $rule->setName($this->comparedKey); } catch (ComponentException $exception) { throw $this->reportError($input, ['component' => true]); } return $rule; }
function __construct(FieldsBuild $field, AssociationBuild $assoc, Validation $v) { $field->name($v->notEmpty())->alias($v->notEmpty())->location($assoc->belongTo()); }