/**
  * @param GetResponseEvent $event
  *
  * @return GetResponseEvent
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     try {
         $this->routerListener->onKernelRequest($event);
     } catch (NotFoundHttpException $e) {
         if (null !== $this->logger) {
             $this->logger->info('Request handled by the ' . $this->legacyKernel->getName() . ' kernel.');
         }
         $response = $this->legacyKernel->handle($event->getRequest(), $event->getRequestType(), true);
         if ($response->getStatusCode() !== 404) {
             $event->setResponse($response);
             return $event;
         }
     }
 }
 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (!$this->kernel->isBooted()) {
         $this->kernel->boot($this->container);
     }
 }
 /**
  * Autoload the legacy code.
  *
  * @return void
  */
 public function autoload()
 {
     // Load the global functions
     require_once BASEPATH . 'core/Common.php';
     // Load the framework constants
     if (defined('ENVIRONMENT') and file_exists(APPPATH . 'config/' . ENVIRONMENT . '/constants.php')) {
         require_once APPPATH . 'config/' . ENVIRONMENT . '/constants.php';
     } else {
         require_once APPPATH . 'config/constants.php';
     }
     // Set the subclass_prefix
     if (isset($assign_to_config['subclass_prefix']) and $assign_to_config['subclass_prefix'] != '') {
         get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
     }
     // Set a liberal script execution time limit
     if (function_exists("set_time_limit") == true and @ini_get("safe_mode") == 0) {
         @set_time_limit(300);
     }
     // Start the timer... tick tock tick tock...
     $BM = load_class('Benchmark', 'core');
     $BM->mark('total_execution_time_start');
     $BM->mark('loading_time:_base_classes_start');
     $GLOBALS['BM'] = $BM;
     $this->kernel->getContainer()->set('BM', $BM);
     // Instantiate the hooks class
     $EXT = load_class('Hooks', 'core');
     $GLOBALS['EXT'] = $EXT;
     $this->kernel->getContainer()->set('EXT', $EXT);
     // Is there a "pre_system" hook?
     $EXT->_call_hook('pre_system');
     // Instantiate the config class
     $CFG = load_class('Config', 'core');
     $GLOBALS['CFG'] = $CFG;
     $this->kernel->getContainer()->set('CFG', $CFG);
     // Do we have any manually set config items in the index.php file?
     if (isset($assign_to_config)) {
         $CFG->_assign_to_config($assign_to_config);
     }
     // Instantiate the UTF-8 class
     $UNI = load_class('Utf8', 'core');
     $GLOBALS['UNI'] = $UNI;
     $this->kernel->getContainer()->set('UNI', $UNI);
     // Instantiate the URI class
     $URI = load_class('URI', 'core');
     $GLOBALS['URI'] = $URI;
     $this->kernel->getContainer()->set('URI', $URI);
     // Instantiate the routing class and set the routing
     $RTR = load_class('Router', 'core');
     $RTR->_set_routing();
     $GLOBALS['RTR'] = $RTR;
     $this->kernel->getContainer()->set('RTR', $RTR);
     // Set any routing overrides that may exist in the main index file
     if (isset($routing)) {
         $RTR->_set_overrides($routing);
     }
     // Instantiate the output class
     $OUT = load_class('Output', 'core');
     $GLOBALS['OUT'] = $OUT;
     $this->kernel->getContainer()->set('OUT', $OUT);
     // Is there a valid cache file?  If so, we're done...
     if ($EXT->_call_hook('cache_override') === false) {
         if ($OUT->_display_cache($CFG, $URI) == true) {
             exit;
         }
     }
     // Load the security class for xss and csrf support
     $SEC = load_class('Security', 'core');
     $GLOBALS['SEC'] = $SEC;
     $this->kernel->getContainer()->set('SEC', $SEC);
     // Load the Input class and sanitize globals
     $IN = load_class('Input', 'core');
     $GLOBALS['IN'] = $IN;
     $this->kernel->getContainer()->set('IN', $IN);
     // Load the Language class
     $LANG = load_class('Lang', 'core');
     $GLOBALS['LANG'] = $LANG;
     $this->kernel->getContainer()->set('LANG', $LANG);
     // Load the app controller and local controller
     require_once BASEPATH . 'core/Controller.php';
     $this->isAutoloaded = true;
 }