Ejemplo n.º 1
0
 private function MergeResources($path)
 {
     $path = \Nemiro\Server::MapPath($path);
     if (file_exists($path)) {
         if (!($data = json_decode(file_get_contents($path), TRUE))) {
             \Nemiro\Console::Error('Resources file "%s" parse error #%s.', $path, json_last_error());
             return FALSE;
         } else {
             if (!isset($this->Resources)) {
                 $this->Resources = array();
             }
             foreach ($data as $item) {
                 $this->Resources[$item['Key']] = $item['Value'];
             }
             return TRUE;
         }
     } else {
         return FALSE;
     }
 }
Ejemplo n.º 2
0
 /**
  * If the specified expression is false, the message is written to the log. 
  * 
  * @param \bool|callable $expression 
  * @param \string $msg The message text.
  * @param mixed $arg The argument.
  * @param mixed $args The arguments.
  * 
  * @return void
  */
 public static function Assert($expression, $msg, $arg = NULL, ...$args)
 {
     if (!\Nemiro\App::$Debug) {
         return;
     }
     if (is_callable($expression)) {
         if ($expression() === FALSE) {
             \Nemiro\Console::Error($msg, $arg, $args);
         }
     } else {
         if ($expression === FALSE) {
             \Nemiro\Console::Error($msg, $arg, $args);
         }
     }
 }