public function loadRoutes() { try { $routes = Config::getInstance()->load($this->routesFile); } catch (InvalidFileException $e) { throw new InvalidRoutesFileException($e->getMessage()); } $this->routes = $routes; return $this; }
public function loadServices() { try { $services = Config::getInstance()->load($this->getServicesFile()); } catch (InvalidFileException $e) { throw new InvalidServicesFileException($e->getMessage()); } $this->setServices($services); return $this; }
public function loadControllers($controllerFile = '') { $this->register(new ServiceControllerServiceProvider()); if ($controllerFile === '') { $controllerFile = $this->getAppConfig()['core']['configDir'] . $this->getAppConfig()['core']['controllersFile']; } try { $this->setControllers(Config::getInstance()->load($controllerFile)); } catch (InvalidFileException $e) { throw new InvalidControllersFileException($e->getMessage()); } return $this; }
/** * @expectedException Flint\Exception\InvalidFileException * @expectedExceptionMessage Config can't be loaded, file does not exist: fake */ public function testLoadInvalidFileThrowsException() { $fakeFile = 'fake'; Config::getInstance()->load($fakeFile); }
<?php require_once __DIR__ . "/../vendor/autoload.php"; use FlintExample\ExampleApp, Flint\Config; $config = Config::getInstance()->load(__DIR__ . "/../app/config.php"); $app = ExampleApp::getInstance($config); $app->run();