예제 #1
0
 /**
  * @param IConfiguration $configuration
  *
  * @return ICacheStorage
  * @throws FileException
  */
 public static function factory(IConfiguration $configuration)
 {
     if ($configuration->getParameter('cache', !$configuration->isDevelMode()) === false || ($cacheDir = $configuration->getDir('cache', false)) === false) {
         return new MemoryStorage();
     }
     FileUtils::createDir($cacheDir);
     return new FileStorage($cacheDir);
 }
예제 #2
0
 /**
  * helper method which finds layout from most concrete folder to module folder
  */
 public function searchLayout()
 {
     $sourceDir = FileUtils::normalize(dirname((new \ReflectionClass($this))->getFileName()));
     $appDir = FileUtils::realpath($this->configuration->getDir('app'));
     while ($sourceDir !== $appDir) {
         if (file_exists($layout = $sourceDir . '/templates/layout.picco')) {
             $this->template->setResource(new File($layout));
             break;
         }
         $sourceDir = dirname($sourceDir);
     }
 }
예제 #3
0
 /**
  * @param IConfiguration $configuration
  * @param IScanner $scanner
  * @param ICacheStorage $cacheStorage
  *
  * @return IReflectionLoader
  */
 public static function factory(IConfiguration $configuration, IScanner $scanner, ICacheStorage $cacheStorage)
 {
     $configSection = $configuration->query(ReflectionLoader::class);
     $reflectionLoader = new self($scanner, $cacheStorage);
     throw new \Exception('need to be updated.');
     $reflectionLoader->addPathList($configSection->getValue('path', []));
     return $reflectionLoader;
 }