<?php
namespace Moto\System\Widgets; use Moto; abstract class AbstractValidator { const ERROR_STRUCTURE_PLAIN = 'PLAIN'; const ERROR_STRUCTURE_TREE = 'TREE'; protected $_errorStructure = self::ERROR_STRUCTURE_PLAIN; protected function _updateErrors(&$errors, $path, $error) { if ($this->_errorStructure === self::ERROR_STRUCTURE_TREE) { $temp = Moto\Util::getFromArrayDeep($errors, $path); if (empty($temp)) { $temp = array(); } $temp[] = $error; Moto\Util::setToArrayDeep($errors, $path, $temp); return $errors; } if (!array_key_exists($path, $errors)) { $errors[$path] = array(); } $errors[$path][] = $error; return $errors; } public function errors($content, $parent = null, $context = array()) { return array(); } }