Beispiel #1
0
 /**
  * Creates the correct type of Application
  *
  * @param  string                   $type      'Web' or 'Cli'
  * @return  Application
  *
  * @throws \Exception
  */
 public static function createApplication($type = 'Web')
 {
     if ($type == 'Web') {
         // We use getDI instead of new, as we want at same time to set the default DI:
         $application = Web::createDI();
     } elseif ($type == 'Cli') {
         $application = Cli::createDI();
     } else {
         throw new \Exception('Unknown Application type', E_USER_ERROR);
     }
     $application->startTimeMicroSeconds = isset($_SERVER['REQUEST_TIME_FLOAT']) ? $_SERVER['REQUEST_TIME_FLOAT'] : microtime(true);
     $application->startTime = isset($_SERVER['REQUEST_TIME']) ? $_SERVER['REQUEST_TIME'] : time();
     $application->set('CBLib\\Application\\ApplicationContainerInterface', $application, true)->alias('CBLib\\Application\\ApplicationContainerInterface', 'DI')->alias('CBLib\\Application\\ApplicationContainerInterface', 'Application');
     $application->set('CBLib\\Cms\\CmsInterface', Cms::getGetCmsFunction(), true)->alias('CBLib\\Cms\\CmsInterface', 'Cms');
     return $application;
 }