コード例 #1
0
 /**
  * @param Application $app
  *
  * @throws \ObjectivePHP\Config\Exception
  */
 public function __invoke(ApplicationInterface $app)
 {
     // setup autoloading for current package
     //
     // note that a relative path is relative to the application root directory!
     $app->getAutoloader()->addPsr4('Project\\Package\\Example\\', 'packages/Example/src');
     // init package here
     $configLoader = new DirectoryLoader();
     $configLoader->loadInto($app->getConfig(), __DIR__ . '/config');
 }
コード例 #2
0
 /**
  * @param ApplicationInterface $app
  *
  * @return null
  * @throws \ObjectivePHP\Config\Exception
  */
 public function __invoke(ApplicationInterface $app)
 {
     // init package here
     $configLoader = new DirectoryLoader();
     $packageConfig = $configLoader->load(__DIR__ . '/../config');
     $app->getConfig()->merge($packageConfig);
     $config = $app->getConfig();
     // if devtools are disabled by configuration, stop here
     if (!$config->get(EnableDevtools::class)) {
         return null;
     }
     // plug listeners according to configuration
     if ($config->get(DevtoolsMonitor::class . '.php-console')) {
         (new PhpConsoleListener())->__invoke($app);
     }
 }
コード例 #3
0
 public function testConfigTreeLoading()
 {
     $configLoader = new DirectoryLoader();
     $config = $configLoader->load(__DIR__ . '/config');
     $this->assertEquals($this->getExpectedConfig(), $config->toArray());
 }
コード例 #4
0
 /**
  *
  */
 public function loadConfig($path)
 {
     $configLoader = new DirectoryLoader();
     $this->config = $configLoader->load($path);
     return $this;
 }