public function getTemplateName() { $templatesPath = Config::getDir(CONFIG::VIEW); $fullPath = $templatesPath . DIRECTORY_SEPARATOR . self::PAGES_DIR . DIRECTORY_SEPARATOR . $this->pageName; if (!file_exists($fullPath)) { $this->app->notFound(); } return self::PAGES_DIR . DIRECTORY_SEPARATOR . $this->pageName; }
/** * Logger constructor. * @param $logName */ public function __construct($logName) { try { $logDir = Config::getDir(Config::LOG); if (!file_exists($logDir)) { mkdir($logDir); } $this->logger = new Logger($logName); $this->logger->pushHandler(new StreamHandler($logDir, Logger::ERROR)); } catch (\Exception $e) { exit($e); } }
/** * @param $path * @return string * @throws AppException */ protected function getFullPath($path) { $settingsPath = Config::getDir(Config::PAGE_SETTINGS); return $settingsPath . DIRECTORY_SEPARATOR . $path; }
/** * @covers Config::getDir * @expectedException Model\AppException */ public function testGetDirThrowsException() { Config::getDir('foo'); }