Exemple #1
0
 /**
  * @return Nette\Application\Application
  */
 public static function createApplication()
 {
     if (Environment::getVariable('baseUri', NULL) === NULL) {
         Environment::setVariable('baseUri', Environment::getHttpRequest()->getUri()->getBasePath());
     }
     $context = clone Environment::getContext();
     $context->addService('Nette\\Application\\IRouter', 'Nette\\Application\\MultiRouter');
     if (!$context->hasService('Nette\\Application\\IPresenterLoader')) {
         $context->addService('Nette\\Application\\IPresenterLoader', function () {
             return new Nette\Application\PresenterLoader(Environment::getVariable('appDir'));
         });
     }
     $application = new Nette\Application\Application();
     $application->setContext($context);
     $application->catchExceptions = Environment::isProduction();
     return $application;
 }