public function validate(array $controls = NULL)
{
foreach ($controls === NULL ? $this->getComponents() : $controls as $control) {
if ($control instanceof IControl || $control instanceof self) {
$control->validate();
}
}
if ($this->onValidate !== NULL) {
if (!is_array($this->onValidate) && !$this->onValidate instanceof \Traversable) {
throw new Nette\UnexpectedValueException('Property Form::$onValidate must be array or Traversable, ' . gettype($this->onValidate) . ' given.');
}
foreach ($this->onValidate as $handler) {
$params = Nette\Utils\Callback::toReflection($handler)->getParameters();
$values = isset($params[1]) ? $this->getValues($params[1]->isArray()) : NULL;
Nette\Utils\Callback::invoke($handler, $this, $values);
}
}
$this->validated = TRUE;
}