public function handleRaw(Request $request, $type = HttpKernelInterface::MASTER_REQUEST)
{
// workaround for https://github.com/symfony/symfony/issues/13617
$pathInfo = $request->server->has('PATH_INFO') ? $request->server->get('PATH_INFO') : '';
if (0 === strlen($pathInfo)) {
$pathInfo = $request->getPathInfo();
}
$format = pathinfo($pathInfo, PATHINFO_EXTENSION);
if (!array_key_exists($format, self::$viewMapping)) {
if (empty($pathInfo)) {
throw new \Exception('Missing or invalid PATH_INFO');
} elseif (empty($this->format)) {
throw new \Exception('Missing format');
} else {
throw new \Exception('Unknown format: \'' . $this->format . '\'');
}
}
// initialize debugging
if (($debugLevel = $request->query->get('debug')) || ($debugLevel = Util\Configuration::read('debug'))) {
if ($debugLevel > 0 && !Util\Debug::isActivated()) {
new Util\Debug($debugLevel, $this->em);
}
} else {
// make sure static debug instance is removed
Util\Debug::deactivate();
}
$class = self::$viewMapping[$format];
$this->view = new $class($request, $format);
$path = explode('/', substr($pathInfo, 1, strrpos($pathInfo, '.') - 1));
list($context, $uuid) = array_merge($path, array(null));
// verify route
if (!array_key_exists($context, self::$controllerMapping)) {
throw new \Exception(empty($context) ? 'Missing context' : 'Unknown context: \'' . $context . '\'');
}
return $this->handler($request, $context, $uuid);
}