Exemplo n.º 1
0
 /**
  * @param string... $path0_
  *
  * @return \Components\Io_Path
  */
 public static function pathComponentsResource($path0_)
 {
     if (null === self::$m_pathComponents) {
         self::$m_pathComponents = Environment::pathComponents();
     }
     return new Io_Path(self::$m_pathComponents . '/' . implode('/', func_get_args()));
 }
 private static function load()
 {
     $locale = self::$m_locale->name();
     $language = self::$m_locale->languageName();
     if (false === isset(self::$m_loaded[$locale])) {
         if (self::$m_cache[$locale] = Cache::get(self::CACHE_KEY . "/{$locale}")) {
             return self::$m_loaded[$locale] = true;
         }
         self::$m_cache[$locale] = [];
         if (false === isset(self::$m_loaded[$language])) {
             if (self::$m_cache[$language] = Cache::get(self::CACHE_KEY . "/{$language}")) {
                 return self::$m_loaded[$language] = true;
             }
             self::$m_cache[$language] = [];
             $directoryIterator = new \RecursiveDirectoryIterator(Environment::pathComponents(), \RecursiveDirectoryIterator::SKIP_DOTS | \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
             $iterator = new \RegexIterator(new \RecursiveIteratorIterator($directoryIterator), '/\\/([a-zA-Z0-9]+)\\/resource\\/i18n\\/translation\\/((?>[a-zA-Z0-9\\/]+\\/)|(?R))*([_a-zA-Z]+)\\.json$/', \RegexIterator::GET_MATCH);
             foreach ($iterator as $path => $match) {
                 self::loadFile($path, $match[3]);
             }
             foreach (self::$m_cache as $loc => $translations) {
                 $l = I18n_Locale::forName($loc);
                 $ll = $l->languageName();
                 if ($loc !== $ll && isset(self::$m_cache[$ll])) {
                     self::$m_cache[$loc] = array_merge(self::$m_cache[$ll], self::$m_cache[$loc]);
                 }
                 Cache::set(self::CACHE_KEY . "/{$loc}", self::$m_cache[$loc]);
                 self::$m_loaded[$loc] = true;
             }
             self::$m_loaded[$language] = true;
         }
         if (false === isset(self::$m_loaded[$locale]) && isset(self::$m_loaded[$language])) {
             self::$m_cache[$locale] = array_merge(self::$m_cache[$language], self::$m_cache[$locale]);
             Cache::set(self::CACHE_KEY . "/{$locale}", self::$m_cache[$locale]);
             self::$m_loaded[$locale] = true;
         }
     }
 }
<?php

namespace Components;

/* @var $this Test_Runner */
if (null === $this->getTestRootPath()) {
    $this->setTestRootPath(Environment::pathComponents());
}
if (null === $this->getBuildPath()) {
    $this->setBuildPath(Environment::pathApplication() . '/build');
}
$this->addListener(new Test_Listener_Emma($this->getTestRootPath(), $this->getBuildPath() . '/emma.xml'));