Ejemplo n.º 1
0
 /**
  * Start the bootstrap
  *
  * @param   string $baseDir     Icinga Web 2 base directory
  * @param   string $configDir   Path to Icinga Web 2's configuration files
  *
  * @return  static
  */
 public static function start($baseDir = null, $configDir = null)
 {
     $application = new static($baseDir, $configDir);
     $application->bootstrap();
     return $application;
 }
Ejemplo n.º 2
0
 /**
  * Initiate application core.
  *
  * @param array $directories Spiral directories should include root, libraries and application
  *                           directories.
  * @param bool  $catchErrors
  * @return static
  */
 public static function init(array $directories, $catchErrors = true)
 {
     /**
      * @var Core $core
      */
     $core = new static($directories + ['framework' => dirname(__DIR__)]);
     $core->bindings = [static::class => $core, self::class => $core, ContainerInterface::class => $core, ConfiguratorInterface::class => $core, HippocampusInterface::class => $core, CoreInterface::class => $core] + $core->bindings;
     //Error and exception handlers
     if ($catchErrors) {
         register_shutdown_function([$core, 'handleShutdown']);
         set_error_handler([$core, 'handleError']);
         set_exception_handler([$core, 'handleException']);
     }
     foreach ($core->autoload as $module) {
         $core->get($module);
     }
     //Bootstrapping our application
     $core->bootstrap();
     return $core;
 }