/** * 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); } }
/** * @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); }