public function run()
    {
        if ('cli' === php_sapi_name()) {
            // do run console application

            $input = new ArgvInput();
            $env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
            $debug = '0' !== getenv('SYMFONY_DEBUG') && !$input->hasParameterOption(['--no-debug', '']) && 'prod' !== $env;

            if ($debug || $this->debug) {
                Debug::enable();
            }

            $application = new Application($this->getKernel());
            $application->run($input);
        } else {
            // do run web application
            $request = Request::createFromGlobals();

            $kernel = $this->getKernel();

            if (!$this->debug) {
                $kernel->loadClassCache();
            }

            if ($this->cacheClass && class_exists($this->cacheClass)) {
                // add (or uncomment) this new line!
                // wrap the default AppKernel with the AppCache one
                $cacheClass = $this->cacheClass;
                $kernel = new $cacheClass($kernel);
            }

            // actually execute the kernel, which turns the request into a response
            // by dispatching events, calling a controller, and returning the response
            $response = $kernel->handle($request);

            // send the headers and echo the content
            $response->send();

            // triggers the kernel.terminate event
            $kernel->terminate($request, $response);
        }
    }