/**
  *
  * @param string $key message key
  * @return string messages
  */
 public function get($key)
 {
     $fileKey = Strings::splitBy($key, self::MESSAGE_PATH_SEPARATOR);
     if ($fileKey[0] == $key) {
         throw new MessageException("Key must separated with " . self::MESSAGE_PATH_SEPARATOR . " in {$key}");
     }
     $fileBase = $fileKey[0];
     $messageKey = $fileKey[1];
     $lang = Zool::app()->getLanguage();
     if (!isset($this->messsages[$lang][$fileBase])) {
         $this->loadLocale($lang, $fileBase, $messageKey);
     }
     if (isset($this->messsages[$lang][$fileBase][$messageKey])) {
         return $this->messsages[$lang][$fileBase][$messageKey];
     } elseif (Strings::contains($messageKey, self::MESSAGE_PATH_SEPARATOR)) {
         // find module locale
         $tmp = Strings::splitBy($messageKey, self::MESSAGE_PATH_SEPARATOR);
         $fileBase .= self::MESSAGE_PATH_SEPARATOR . $tmp[0];
         $messageKey = $tmp[1];
     }
     if (isset($this->messsages[$lang][$fileBase][$messageKey])) {
         return $this->messsages[$lang][$fileBase][$messageKey];
     }
     return $key;
 }
 /**
  *
  * @param string $query query part of library URL
  * @return string out namespace
  */
 private function outNamespace($query)
 {
     $queryParams = [$query];
     if (Strings::contains($query, '&')) {
         $queryParams = explode('&', $query);
     }
     foreach ($queryParams as $param) {
         list($arg, $value) = explode('=', $attribute);
         if ($arg == self::OUT_NAMESPACE_ARGUMENT) {
             return $value;
         }
     }
 }
 /**
  * @param string $alias resource alias
  */
 public function moduleNameAndPath($alias)
 {
     $isModuleResource = Strings::contains($alias, self::MODULE_SEPARATOR) && Strings::contains($alias, self::PATH_SEPARATOR) && strpos($alias, '.') < strpos($alias, '/');
     $module = APP_MODULE_NAME;
     $path = $alias;
     if ($isModuleResource) {
         list($module, $path) = explode(self::MODULE_SEPARATOR, $alias, 2);
         $path = trim($path, '/');
     }
     if (!Modules::instance()->exists($module)) {
         throw new ModuleNotFoundException($module);
     }
     return [$module, $path];
 }
require_once BASE_PATH . '/zool/util/log/LogProvider.php';
function displayException($exception)
{
    echo "\n\n" . get_class($exception);
    echo $exception->getMessage() . ' (' . $exception->getFile() . ':' . $exception->getLine() . ")";
    echo $exception->getTraceAsString();
    if ($exception->getPrevious() !== null) {
        displayException($exception->getPrevious());
    }
}
$appdeployer = new \zool\deploy\ApplicationDeployer(['zool' => ZOOL_PATH, 'app' => APP_PATH]);
$prevmtimehash = $argv[1];
$app = new Directory(BASE_PATH);
$files = $app->getFiles(true, ModuleDeployer::PHP_FILE_FILTER);
$mtime = '';
foreach ($files as $file) {
    if (!Strings::endsWidth($file, Deployment::DEPLOYMENT_DESCRIPTOR) && (Strings::contains($file, 'component') || Strings::contains($file, 'zool') || true)) {
        $mtime .= filemtime($file);
    }
}
$mtimehash = md5($mtime);
if ($prevmtimehash != $mtimehash) {
    try {
        $appdeployer->deploy(BASE_PATH);
    } catch (Exception $e) {
        echo "\n///////////////////  INCOMPLETE DEPLOYMENT  ///////////////////\n\n";
        displayException($e);
        //echo $mtimehash."\n";
    }
}
echo $mtimehash . "\n";