Ejemplo n.º 1
0
 /**
  * Confront the JSON schema object with the current configuration
  *
  * @param array $cfg Configuration
  * @return bool
  */
 public static function check_config($cfg)
 {
     if (!is_array($cfg)) {
         self::$error = "The configuration is not a valid array";
         return false;
     }
     self::$validator->check(\bbn\tools::to_object($cfg), static::$schema);
     self::$error = '';
     if (self::$validator->isValid()) {
         return 1;
     }
     foreach (self::$validator->getErrors() as $error) {
         self::$error .= sprintf("[%s] %s", $error['property'], $error['message']);
         var_dump($cfg);
     }
     return false;
 }