/**
  * Gets all the translations for the provided locale
  * @param string $localeCode code of the locale
  * @return array an associative array with translation key - value pairs
  * @throws zibo\ZiboException when the locale code is empty or invalid
  */
 public function getTranslations($localeCode)
 {
     if (!String::isString($localeCode, String::NOT_EMPTY)) {
         throw new ZiboException('Provided locale code is empty');
     }
     if (isset($this->translations[$localeCode])) {
         return $this->translations[$localeCode];
     }
     $this->translations[$localeCode] = array();
     $translationFile = Zibo::DIRECTORY_L10N . File::DIRECTORY_SEPARATOR . $localeCode . self::EXTENSION;
     $translationFiles = array_reverse($this->zibo->getFiles($translationFile));
     $this->translations[$localeCode] = $this->getTranslationsFromFiles($translationFiles);
     return $this->translations[$localeCode];
 }
 /**
  * Gets the dependency container
  * @param zibo\core\Zibo $zibo Instance of zibo
  * @return zibo\core\di\DependencyContainer
  */
 public function getContainer(Zibo $zibo)
 {
     $container = new DependencyContainer();
     $files = array_reverse($zibo->getFiles(self::PATH_FILE));
     foreach ($files as $file) {
         $this->readDependencies($container, $file);
     }
     return $container;
 }
Esempio n. 3
0
 /**
  * Reads the routes from the data source
  * @return array Array with Route instances
  */
 protected function readRoutes()
 {
     $routes = array();
     $files = array_reverse($this->zibo->getFiles(self::PATH_FILE));
     foreach ($files as $file) {
         $fileRoutes = $this->readRoutesFromFile($file);
         $routes = $fileRoutes + $routes;
     }
     return $routes;
 }
Esempio n. 4
0
 /**
  * Gets the style for
  * @param zibo\core\Zibo $zibo
  * @param zibo\library\optimizer\CssOptimizer $optimizer
  * @param string $path Path of the CSS file in the Zibo filesystem structure
  * @return string Path to the style
  */
 private function getStyleForIE(Zibo $zibo, CssOptimizer $optimizer, $path)
 {
     $styles = $zibo->getFiles($path);
     if (!$styles) {
         return null;
     }
     return $optimizer->optimize($styles);
 }