示例#1
0
 public function loadRoutes()
 {
     try {
         $routes = Config::getInstance()->load($this->routesFile);
     } catch (InvalidFileException $e) {
         throw new InvalidRoutesFileException($e->getMessage());
     }
     $this->routes = $routes;
     return $this;
 }
示例#2
0
 public function loadServices()
 {
     try {
         $services = Config::getInstance()->load($this->getServicesFile());
     } catch (InvalidFileException $e) {
         throw new InvalidServicesFileException($e->getMessage());
     }
     $this->setServices($services);
     return $this;
 }
示例#3
0
文件: App.php 项目: studionone/Flint
 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;
 }
示例#4
0
 /**
  * @expectedException Flint\Exception\InvalidFileException
  * @expectedExceptionMessage Config can't be loaded, file does not exist: fake
  */
 public function testLoadInvalidFileThrowsException()
 {
     $fakeFile = 'fake';
     Config::getInstance()->load($fakeFile);
 }
示例#5
0
<?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();