diff options
Diffstat (limited to 'app/bootstrap.php.cache')
-rw-r--r-- | app/bootstrap.php.cache | 159 |
1 files changed, 91 insertions, 68 deletions
diff --git a/app/bootstrap.php.cache b/app/bootstrap.php.cache index 0b20a88..f0fc7b6 100644 --- a/app/bootstrap.php.cache +++ b/app/bootstrap.php.cache @@ -27,8 +27,8 @@ interface ContainerInterface } namespace Symfony\Component\DependencyInjection { -use Symfony\Component\DependencyInjection\Exception\NonExistentServiceException; -use Symfony\Component\DependencyInjection\Exception\CircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; @@ -102,7 +102,7 @@ class Container implements ContainerInterface return $this->services[$id]; } if (isset($this->loading[$id])) { - throw new CircularReferenceException($id, array_keys($this->loading)); + throw new ServiceCircularReferenceException($id, array_keys($this->loading)); } if (method_exists($this, $method = 'get'.strtr($id, array('_' => '', '.' => '_')).'Service')) { $this->loading[$id] = true; @@ -116,7 +116,7 @@ class Container implements ContainerInterface return $service; } if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { - throw new NonExistentServiceException($id); + throw new ServiceNotFoundException($id); } } public function getServiceIds() @@ -154,13 +154,6 @@ class Container implements ContainerInterface } $this->scopedServices[$name] = array(); } - public function getCurrentScopedStack($name) - { - if (!isset($this->scopeStacks[$name]) || 0 === $this->scopeStacks[$name]->count()) { - return null; - } - return $this->scopeStacks[$name]->top(); - } public function leaveScope($name) { if (!isset($this->scopedServices[$name])) { @@ -431,7 +424,7 @@ class HttpKernel implements HttpKernelInterface private function handleRaw(Request $request, $type = self::MASTER_REQUEST) { $event = new GetResponseEvent($this, $request, $type); - $this->dispatcher->dispatch(Events::onCoreRequest, $event); + $this->dispatcher->dispatch(CoreEvents::REQUEST, $event); if ($event->hasResponse()) { return $this->filterResponse($event->getResponse(), $request, $type); } @@ -439,13 +432,13 @@ class HttpKernel implements HttpKernelInterface throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". Maybe you forgot to add the matching route in your routing configuration?', $request->getPathInfo())); } $event = new FilterControllerEvent($this, $controller, $request, $type); - $this->dispatcher->dispatch(Events::onCoreController, $event); + $this->dispatcher->dispatch(CoreEvents::CONTROLLER, $event); $controller = $event->getController(); $arguments = $this->resolver->getArguments($request, $controller); $response = call_user_func_array($controller, $arguments); if (!$response instanceof Response) { $event = new GetResponseForControllerResultEvent($this, $request, $type, $response); - $this->dispatcher->dispatch(Events::onCoreView, $event); + $this->dispatcher->dispatch(CoreEvents::VIEW, $event); if ($event->hasResponse()) { $response = $event->getResponse(); } @@ -462,13 +455,13 @@ class HttpKernel implements HttpKernelInterface private function filterResponse(Response $response, Request $request, $type) { $event = new FilterResponseEvent($this, $request, $type, $response); - $this->dispatcher->dispatch(Events::onCoreResponse, $event); + $this->dispatcher->dispatch(CoreEvents::RESPONSE, $event); return $event->getResponse(); } private function handleException(\Exception $e, $request, $type) { $event = new GetResponseForExceptionEvent($this, $request, $type, $e); - $this->dispatcher->dispatch(Events::onCoreException, $event); + $this->dispatcher->dispatch(CoreEvents::EXCEPTION, $event); if (!$event->hasResponse()) { throw $e; } @@ -601,6 +594,9 @@ abstract class Kernel implements KernelInterface } public function shutdown() { + if (false === $this->booted) { + return; + } $this->booted = false; foreach ($this->getBundles() as $bundle) { $bundle->shutdown(); @@ -835,6 +831,15 @@ abstract class Kernel implements KernelInterface } protected function buildContainer() { + foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { + if (!is_dir($dir)) { + if (false === @mkdir($dir, 0777, true)) { + throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, dirname($dir))); + } + } elseif (!is_writable($dir)) { + throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); + } + } $container = new ContainerBuilder(new ParameterBag($this->getKernelParameters())); $extensions = array(); foreach ($this->bundles as $bundle) { @@ -852,16 +857,6 @@ abstract class Kernel implements KernelInterface if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) { $container->merge($cont); } - foreach (array('cache', 'logs') as $name) { - $dir = $container->getParameter(sprintf('kernel.%s_dir', $name)); - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) { - exit(sprintf("Unable to create the %s directory (%s)\n", $name, dirname($dir))); - } - } elseif (!is_writable($dir)) { - exit(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); - } - } $container->addCompilerPass(new AddClassesToCachePass($this)); $container->compile(); $this->addClassesToCache($container->getParameter('kernel.compiled_classes')); @@ -940,14 +935,10 @@ class ParameterBag { $this->parameters = array_replace($this->parameters, $parameters); } - public function get($key, $default = null) - { - return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; - } - public function getDeep($path, $default = null) + public function get($path, $default = null, $deep = false) { - if (false === $pos = strpos($path, '[')) { - return $this->get($path, $default); + if (!$deep || false === $pos = strpos($path, '[')) { + return array_key_exists($path, $this->parameters) ? $this->parameters[$path] : $default; } $root = substr($path, 0, $pos); if (!array_key_exists($root, $this->parameters)) { @@ -995,21 +986,21 @@ class ParameterBag { unset($this->parameters[$key]); } - public function getAlpha($key, $default = '') + public function getAlpha($key, $default = '', $deep = false) { - return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default)); + return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default, $deep)); } - public function getAlnum($key, $default = '') + public function getAlnum($key, $default = '', $deep = false) { - return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default)); + return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default, $deep)); } - public function getDigits($key, $default = '') + public function getDigits($key, $default = '', $deep = false) { - return preg_replace('/[^[:digit:]]/', '', $this->get($key, $default)); + return preg_replace('/[^[:digit:]]/', '', $this->get($key, $default, $deep)); } - public function getInt($key, $default = 0) + public function getInt($key, $default = 0, $deep = false) { - return (int) $this->get($key, $default); + return (int) $this->get($key, $default, $deep); } } } @@ -1120,6 +1111,24 @@ class HeaderBag $this->set($key, $values); } } + public function __toString() + { + if (!$this->headers) { + return ''; + } + $beautifier = function ($name) { + return preg_replace('/\-(.)/e', "'-'.strtoupper('\\1')", ucfirst($name)); + }; + $max = max(array_map('strlen', array_keys($this->headers))) + 1; + $content = ''; + ksort($this->headers); + foreach ($this->headers as $name => $values) { + foreach ($values as $value) { + $content .= sprintf("%-{$max}s %s\r\n", $beautifier($name).':', $value); + } + } + return $content; + } public function all() { return $this->headers; @@ -1310,7 +1319,14 @@ class Request } static public function createFromGlobals() { - return new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); + $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); + if (0 === strpos($request->server->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') + && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE')) + ) { + parse_str($request->getContent(), $data); + $request->request = new ParameterBag($data); + } + return $request; } static public function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) { @@ -1325,6 +1341,7 @@ class Request 'REMOTE_ADDR' => '127.0.0.1', 'SCRIPT_NAME' => '', 'SCRIPT_FILENAME' => '', + 'SERVER_PROTOCOL' => 'HTTP/1.1', ); $components = parse_url($uri); if (isset($components['host'])) { @@ -1411,6 +1428,13 @@ class Request $this->server = clone $this->server; $this->headers = clone $this->headers; } + public function __toString() + { + return + sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n". + $this->headers."\r\n". + $this->getContent(); + } public function overrideGlobals() { $_GET = $this->query->all(); @@ -1422,18 +1446,22 @@ class Request } $_REQUEST = array_merge($_GET, $_POST); } - public function get($key, $default = null) + public function get($key, $default = null, $deep = false) { - return $this->query->get($key, $this->attributes->get($key, $this->request->get($key, $default))); + return $this->query->get($key, $this->attributes->get($key, $this->request->get($key, $default, $deep), $deep), $deep); } public function getSession() { return $this->session; } - public function hasSession() + public function hasPreviousSession() { return $this->cookies->has(session_name()) && null !== $this->session; } + public function hasSession() + { + return null !== $this->session; + } public function setSession(Session $session) { $this->session = $session; @@ -1484,17 +1512,12 @@ class Request } public function getHttpHost() { - $host = $this->headers->get('HOST'); - if (!empty($host)) { - return $host; - } $scheme = $this->getScheme(); - $name = $this->server->get('SERVER_NAME'); $port = $this->getPort(); if (('http' == $scheme && $port == 80) || ('https' == $scheme && $port == 443)) { - return $name; + return $this->getHost(); } - return $name.':'.$port; + return $this->getHost().':'.$port; } public function getRequestUri() { @@ -1570,7 +1593,7 @@ class Request if (null === $this->method) { $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); if ('POST' === $this->method) { - $this->method = strtoupper($this->request->get('_method', 'POST')); + $this->method = strtoupper($this->server->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', 'POST'))); } } return $this->method; @@ -1801,14 +1824,14 @@ class Request { $baseUrl = $this->getBaseUrl(); if (null === ($requestUri = $this->getRequestUri())) { - return ''; + return '/'; } - $pathInfo = ''; + $pathInfo = '/'; if ($pos = strpos($requestUri, '?')) { $requestUri = substr($requestUri, 0, $pos); } if ((null !== $baseUrl) && (false === ($pathInfo = substr($requestUri, strlen($baseUrl))))) { - return ''; + return '/'; } elseif (null === $baseUrl) { return $requestUri; } @@ -1985,8 +2008,8 @@ class UniversalClassLoader { private $namespaces = array(); private $prefixes = array(); - private $namespaceFallback = array(); - private $prefixFallback = array(); + private $namespaceFallbacks = array(); + private $prefixFallbacks = array(); public function getNamespaces() { return $this->namespaces; @@ -1995,21 +2018,21 @@ class UniversalClassLoader { return $this->prefixes; } - public function getNamespaceFallback() + public function getNamespaceFallbacks() { - return $this->namespaceFallback; + return $this->namespaceFallbacks; } - public function getPrefixFallback() + public function getPrefixFallbacks() { - return $this->prefixFallback; + return $this->prefixFallbacks; } - public function registerNamespaceFallback($dirs) + public function registerNamespaceFallbacks(array $dirs) { - $this->namespaceFallback = (array) $dirs; + $this->namespaceFallbacks = $dirs; } - public function registerPrefixFallback($dirs) + public function registerPrefixFallbacks(array $dirs) { - $this->prefixFallback = (array) $dirs; + $this->prefixFallbacks = $dirs; } public function registerNamespaces(array $namespaces) { @@ -2059,7 +2082,7 @@ class UniversalClassLoader } } } - foreach ($this->namespaceFallback as $dir) { + foreach ($this->namespaceFallbacks as $dir) { $file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; if (file_exists($file)) { return $file; @@ -2076,7 +2099,7 @@ class UniversalClassLoader } } } - foreach ($this->prefixFallback as $dir) { + foreach ($this->prefixFallbacks as $dir) { $file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; if (file_exists($file)) { return $file; |