Ejemplo n.º 1
0
 public function __construct(array &$data, array $rules, array $messages)
 {
     $this->data = $data;
     $this->rules = $rules;
     $this->messages = $messages;
     $this->scale = ConfigData::getConfig()['scale'];
 }
Ejemplo n.º 2
0
 private static function initLangData()
 {
     $config = ConfigData::getConfig();
     if (empty($config['lang'])) {
         self::$lang = self::$def_lang;
         return;
     }
     $lang_file = ConfigData::baseDir() . '/' . $config['lang'];
     if (!file_exists($lang_file)) {
         $lang_file = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $lang_file);
         throw new \Exception("The file '{$lang_file}' was not found");
     }
     $lang_data = (require_once $lang_file);
     if (!is_array($lang_data) || empty($lang_data)) {
         throw new \Exception("The file '{$lang_file}' must return a non-empty array");
     }
     self::$lang = $lang_data;
 }