Updated to Symfony 3.0.0
This commit is contained in:
parent
8224c23e92
commit
68cd5ac864
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace {
|
||||
error_reporting(error_reporting() & ~E_USER_DEPRECATED);
|
||||
$loader = require_once __DIR__.'/./autoload.php';
|
||||
}
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpFoundation
|
||||
{
|
||||
|
@ -31,44 +26,9 @@ public function add(array $parameters = array())
|
|||
{
|
||||
$this->parameters = array_replace($this->parameters, $parameters);
|
||||
}
|
||||
public function get($path, $default = null, $deep = false)
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
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)) {
|
||||
return $default;
|
||||
}
|
||||
$value = $this->parameters[$root];
|
||||
$currentKey = null;
|
||||
for ($i = $pos, $c = strlen($path); $i < $c; ++$i) {
|
||||
$char = $path[$i];
|
||||
if ('['=== $char) {
|
||||
if (null !== $currentKey) {
|
||||
throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "[" at position %d.', $i));
|
||||
}
|
||||
$currentKey ='';
|
||||
} elseif (']'=== $char) {
|
||||
if (null === $currentKey) {
|
||||
throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i));
|
||||
}
|
||||
if (!is_array($value) || !array_key_exists($currentKey, $value)) {
|
||||
return $default;
|
||||
}
|
||||
$value = $value[$currentKey];
|
||||
$currentKey = null;
|
||||
} else {
|
||||
if (null === $currentKey) {
|
||||
throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "%s" at position %d.', $char, $i));
|
||||
}
|
||||
$currentKey .= $char;
|
||||
}
|
||||
}
|
||||
if (null !== $currentKey) {
|
||||
throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".'));
|
||||
}
|
||||
return $value;
|
||||
return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default;
|
||||
}
|
||||
public function set($key, $value)
|
||||
{
|
||||
|
@ -82,29 +42,29 @@ public function remove($key)
|
|||
{
|
||||
unset($this->parameters[$key]);
|
||||
}
|
||||
public function getAlpha($key, $default ='', $deep = false)
|
||||
public function getAlpha($key, $default ='')
|
||||
{
|
||||
return preg_replace('/[^[:alpha:]]/','', $this->get($key, $default, $deep));
|
||||
return preg_replace('/[^[:alpha:]]/','', $this->get($key, $default));
|
||||
}
|
||||
public function getAlnum($key, $default ='', $deep = false)
|
||||
public function getAlnum($key, $default ='')
|
||||
{
|
||||
return preg_replace('/[^[:alnum:]]/','', $this->get($key, $default, $deep));
|
||||
return preg_replace('/[^[:alnum:]]/','', $this->get($key, $default));
|
||||
}
|
||||
public function getDigits($key, $default ='', $deep = false)
|
||||
public function getDigits($key, $default ='')
|
||||
{
|
||||
return str_replace(array('-','+'),'', $this->filter($key, $default, $deep, FILTER_SANITIZE_NUMBER_INT));
|
||||
return str_replace(array('-','+'),'', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT));
|
||||
}
|
||||
public function getInt($key, $default = 0, $deep = false)
|
||||
public function getInt($key, $default = 0)
|
||||
{
|
||||
return (int) $this->get($key, $default, $deep);
|
||||
return (int) $this->get($key, $default);
|
||||
}
|
||||
public function getBoolean($key, $default = false, $deep = false)
|
||||
public function getBoolean($key, $default = false)
|
||||
{
|
||||
return $this->filter($key, $default, $deep, FILTER_VALIDATE_BOOLEAN);
|
||||
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array())
|
||||
public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array())
|
||||
{
|
||||
$value = $this->get($key, $default, $deep);
|
||||
$value = $this->get($key, $default);
|
||||
if (!is_array($options) && $options) {
|
||||
$options = array('flags'=> $options);
|
||||
}
|
||||
|
@ -711,15 +671,15 @@ public static function getHttpMethodParameterOverride()
|
|||
{
|
||||
return self::$httpMethodParameterOverride;
|
||||
}
|
||||
public function get($key, $default = null, $deep = false)
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if ($this !== $result = $this->query->get($key, $this, $deep)) {
|
||||
if ($this !== $result = $this->attributes->get($key, $this)) {
|
||||
return $result;
|
||||
}
|
||||
if ($this !== $result = $this->attributes->get($key, $this, $deep)) {
|
||||
if ($this !== $result = $this->query->get($key, $this)) {
|
||||
return $result;
|
||||
}
|
||||
if ($this !== $result = $this->request->get($key, $this, $deep)) {
|
||||
if ($this !== $result = $this->request->get($key, $this)) {
|
||||
return $result;
|
||||
}
|
||||
return $default;
|
||||
|
@ -990,7 +950,7 @@ static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes
|
|||
public function getRequestFormat($default ='html')
|
||||
{
|
||||
if (null === $this->format) {
|
||||
$this->format = $this->get('_format', $default);
|
||||
$this->format = $this->attributes->get('_format', $default);
|
||||
}
|
||||
return $this->format;
|
||||
}
|
||||
|
@ -1360,7 +1320,6 @@ public static $statusTexts = array(
|
|||
303 =>'See Other',
|
||||
304 =>'Not Modified',
|
||||
305 =>'Use Proxy',
|
||||
306 =>'Reserved',
|
||||
307 =>'Temporary Redirect',
|
||||
308 =>'Permanent Redirect', 400 =>'Bad Request',
|
||||
401 =>'Unauthorized',
|
||||
|
@ -1375,10 +1334,10 @@ public static $statusTexts = array(
|
|||
410 =>'Gone',
|
||||
411 =>'Length Required',
|
||||
412 =>'Precondition Failed',
|
||||
413 =>'Request Entity Too Large',
|
||||
414 =>'Request-URI Too Long',
|
||||
413 =>'Payload Too Large',
|
||||
414 =>'URI Too Long',
|
||||
415 =>'Unsupported Media Type',
|
||||
416 =>'Requested Range Not Satisfiable',
|
||||
416 =>'Range Not Satisfiable',
|
||||
417 =>'Expectation Failed',
|
||||
418 =>'I\'m a teapot', 422 =>'Unprocessable Entity', 423 =>'Locked', 424 =>'Failed Dependency', 425 =>'Reserved for WebDAV advanced collections expired proposal', 426 =>'Upgrade Required', 428 =>'Precondition Required', 429 =>'Too Many Requests', 431 =>'Request Header Fields Too Large', 500 =>'Internal Server Error',
|
||||
501 =>'Not Implemented',
|
||||
|
@ -1393,9 +1352,6 @@ $this->headers = new ResponseHeaderBag($headers);
|
|||
$this->setContent($content);
|
||||
$this->setStatusCode($status);
|
||||
$this->setProtocolVersion('1.0');
|
||||
if (!$this->headers->has('Date')) {
|
||||
$this->setDate(\DateTime::createFromFormat('U', time(), new \DateTimeZone('UTC')));
|
||||
}
|
||||
}
|
||||
public static function create($content ='', $status = 200, $headers = array())
|
||||
{
|
||||
|
@ -1458,12 +1414,15 @@ public function sendHeaders()
|
|||
if (headers_sent()) {
|
||||
return $this;
|
||||
}
|
||||
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
|
||||
if (!$this->headers->has('Date')) {
|
||||
$this->setDate(\DateTime::createFromFormat('U', time()));
|
||||
}
|
||||
foreach ($this->headers->allPreserveCase() as $name => $values) {
|
||||
foreach ($values as $value) {
|
||||
header($name.': '.$value, false, $this->statusCode);
|
||||
}
|
||||
}
|
||||
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
|
||||
foreach ($this->headers->getCookies() as $cookie) {
|
||||
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
|
||||
}
|
||||
|
@ -1513,7 +1472,7 @@ if ($this->isInvalid()) {
|
|||
throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code));
|
||||
}
|
||||
if (null === $text) {
|
||||
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] :'';
|
||||
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] :'unknown status';
|
||||
return $this;
|
||||
}
|
||||
if (false === $text) {
|
||||
|
@ -1572,7 +1531,10 @@ return $this->headers->hasCacheControlDirective('must-revalidate') || $this->hea
|
|||
}
|
||||
public function getDate()
|
||||
{
|
||||
return $this->headers->getDate('Date', new \DateTime());
|
||||
if (!$this->headers->has('Date')) {
|
||||
$this->setDate(\DateTime::createFromFormat('U', time()));
|
||||
}
|
||||
return $this->headers->getDate('Date');
|
||||
}
|
||||
public function setDate(\DateTime $date)
|
||||
{
|
||||
|
@ -1997,48 +1959,36 @@ interface ContainerInterface
|
|||
const EXCEPTION_ON_INVALID_REFERENCE = 1;
|
||||
const NULL_ON_INVALID_REFERENCE = 2;
|
||||
const IGNORE_ON_INVALID_REFERENCE = 3;
|
||||
const SCOPE_CONTAINER ='container';
|
||||
const SCOPE_PROTOTYPE ='prototype';
|
||||
public function set($id, $service, $scope = self::SCOPE_CONTAINER);
|
||||
public function set($id, $service);
|
||||
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
|
||||
public function has($id);
|
||||
public function initialized($id);
|
||||
public function getParameter($name);
|
||||
public function hasParameter($name);
|
||||
public function setParameter($name, $value);
|
||||
public function enterScope($name);
|
||||
public function leaveScope($name);
|
||||
public function addScope(ScopeInterface $scope);
|
||||
public function hasScope($name);
|
||||
public function isScopeActive($name);
|
||||
}
|
||||
}
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
interface IntrospectableContainerInterface extends ContainerInterface
|
||||
interface ResettableContainerInterface extends ContainerInterface
|
||||
{
|
||||
public function initialized($id);
|
||||
public function reset();
|
||||
}
|
||||
}
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||
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;
|
||||
class Container implements IntrospectableContainerInterface
|
||||
class Container implements ResettableContainerInterface
|
||||
{
|
||||
protected $parameterBag;
|
||||
protected $services = array();
|
||||
protected $methodMap = array();
|
||||
protected $aliases = array();
|
||||
protected $scopes = array();
|
||||
protected $scopeChildren = array();
|
||||
protected $scopedServices = array();
|
||||
protected $scopeStacks = array();
|
||||
protected $loading = array();
|
||||
private $underscoreMap = array('_'=>'','.'=>'_','\\'=>'_');
|
||||
public function __construct(ParameterBagInterface $parameterBag = null)
|
||||
|
@ -2070,29 +2020,14 @@ public function setParameter($name, $value)
|
|||
{
|
||||
$this->parameterBag->set($name, $value);
|
||||
}
|
||||
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
|
||||
public function set($id, $service)
|
||||
{
|
||||
if (self::SCOPE_PROTOTYPE === $scope) {
|
||||
throw new InvalidArgumentException(sprintf('You cannot set service "%s" of scope "prototype".', $id));
|
||||
}
|
||||
$id = strtolower($id);
|
||||
if ('service_container'=== $id) {
|
||||
return;
|
||||
}
|
||||
if (self::SCOPE_CONTAINER !== $scope) {
|
||||
if (!isset($this->scopedServices[$scope])) {
|
||||
throw new RuntimeException(sprintf('You cannot set service "%s" of inactive scope.', $id));
|
||||
}
|
||||
$this->scopedServices[$scope][$id] = $service;
|
||||
throw new InvalidArgumentException('You cannot set service "service_container".');
|
||||
}
|
||||
$this->services[$id] = $service;
|
||||
if (method_exists($this, $method ='synchronize'.strtr($id, $this->underscoreMap).'Service')) {
|
||||
$this->$method();
|
||||
}
|
||||
if (null === $service) {
|
||||
if (self::SCOPE_CONTAINER !== $scope) {
|
||||
unset($this->scopedServices[$scope][$id]);
|
||||
}
|
||||
unset($this->services[$id]);
|
||||
}
|
||||
}
|
||||
|
@ -2154,16 +2089,11 @@ $this->loading[$id] = true;
|
|||
try {
|
||||
$service = $this->$method();
|
||||
} catch (\Exception $e) {
|
||||
unset($this->loading[$id]);
|
||||
if (array_key_exists($id, $this->services)) {
|
||||
unset($this->services[$id]);
|
||||
}
|
||||
if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
|
||||
return;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
} finally {
|
||||
unset($this->loading[$id]);
|
||||
}
|
||||
return $service;
|
||||
}
|
||||
}
|
||||
|
@ -2171,13 +2101,17 @@ public function initialized($id)
|
|||
{
|
||||
$id = strtolower($id);
|
||||
if ('service_container'=== $id) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if (isset($this->aliases[$id])) {
|
||||
$id = $this->aliases[$id];
|
||||
}
|
||||
return isset($this->services[$id]) || array_key_exists($id, $this->services);
|
||||
}
|
||||
public function reset()
|
||||
{
|
||||
$this->services = array();
|
||||
}
|
||||
public function getServiceIds()
|
||||
{
|
||||
$ids = array();
|
||||
|
@ -2190,87 +2124,6 @@ $ids[] = self::underscore($match[1]);
|
|||
$ids[] ='service_container';
|
||||
return array_unique(array_merge($ids, array_keys($this->services)));
|
||||
}
|
||||
public function enterScope($name)
|
||||
{
|
||||
if (!isset($this->scopes[$name])) {
|
||||
throw new InvalidArgumentException(sprintf('The scope "%s" does not exist.', $name));
|
||||
}
|
||||
if (self::SCOPE_CONTAINER !== $this->scopes[$name] && !isset($this->scopedServices[$this->scopes[$name]])) {
|
||||
throw new RuntimeException(sprintf('The parent scope "%s" must be active when entering this scope.', $this->scopes[$name]));
|
||||
}
|
||||
if (isset($this->scopedServices[$name])) {
|
||||
$services = array($this->services, $name => $this->scopedServices[$name]);
|
||||
unset($this->scopedServices[$name]);
|
||||
foreach ($this->scopeChildren[$name] as $child) {
|
||||
if (isset($this->scopedServices[$child])) {
|
||||
$services[$child] = $this->scopedServices[$child];
|
||||
unset($this->scopedServices[$child]);
|
||||
}
|
||||
}
|
||||
$this->services = call_user_func_array('array_diff_key', $services);
|
||||
array_shift($services);
|
||||
if (!isset($this->scopeStacks[$name])) {
|
||||
$this->scopeStacks[$name] = new \SplStack();
|
||||
}
|
||||
$this->scopeStacks[$name]->push($services);
|
||||
}
|
||||
$this->scopedServices[$name] = array();
|
||||
}
|
||||
public function leaveScope($name)
|
||||
{
|
||||
if (!isset($this->scopedServices[$name])) {
|
||||
throw new InvalidArgumentException(sprintf('The scope "%s" is not active.', $name));
|
||||
}
|
||||
$services = array($this->services, $this->scopedServices[$name]);
|
||||
unset($this->scopedServices[$name]);
|
||||
foreach ($this->scopeChildren[$name] as $child) {
|
||||
if (isset($this->scopedServices[$child])) {
|
||||
$services[] = $this->scopedServices[$child];
|
||||
unset($this->scopedServices[$child]);
|
||||
}
|
||||
}
|
||||
$this->services = call_user_func_array('array_diff_key', $services);
|
||||
if (isset($this->scopeStacks[$name]) && count($this->scopeStacks[$name]) > 0) {
|
||||
$services = $this->scopeStacks[$name]->pop();
|
||||
$this->scopedServices += $services;
|
||||
if ($this->scopeStacks[$name]->isEmpty()) {
|
||||
unset($this->scopeStacks[$name]);
|
||||
}
|
||||
foreach ($services as $array) {
|
||||
foreach ($array as $id => $service) {
|
||||
$this->set($id, $service, $name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public function addScope(ScopeInterface $scope)
|
||||
{
|
||||
$name = $scope->getName();
|
||||
$parentScope = $scope->getParentName();
|
||||
if (self::SCOPE_CONTAINER === $name || self::SCOPE_PROTOTYPE === $name) {
|
||||
throw new InvalidArgumentException(sprintf('The scope "%s" is reserved.', $name));
|
||||
}
|
||||
if (isset($this->scopes[$name])) {
|
||||
throw new InvalidArgumentException(sprintf('A scope with name "%s" already exists.', $name));
|
||||
}
|
||||
if (self::SCOPE_CONTAINER !== $parentScope && !isset($this->scopes[$parentScope])) {
|
||||
throw new InvalidArgumentException(sprintf('The parent scope "%s" does not exist, or is invalid.', $parentScope));
|
||||
}
|
||||
$this->scopes[$name] = $parentScope;
|
||||
$this->scopeChildren[$name] = array();
|
||||
while ($parentScope !== self::SCOPE_CONTAINER) {
|
||||
$this->scopeChildren[$parentScope][] = $name;
|
||||
$parentScope = $this->scopes[$parentScope];
|
||||
}
|
||||
}
|
||||
public function hasScope($name)
|
||||
{
|
||||
return isset($this->scopes[$name]);
|
||||
}
|
||||
public function isScopeActive($name)
|
||||
{
|
||||
return isset($this->scopedServices[$name]);
|
||||
}
|
||||
public static function camelize($id)
|
||||
{
|
||||
return strtr(ucwords(strtr($id, array('_'=>' ','.'=>'_ ','\\'=>'_ '))), array(' '=>''));
|
||||
|
@ -2279,6 +2132,9 @@ public static function underscore($id)
|
|||
{
|
||||
return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/','/([a-z\d])([A-Z])/'), array('\\1_\\2','\\1_\\2'), strtr($id,'_','.')));
|
||||
}
|
||||
private function __clone()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Symfony\Component\HttpKernel
|
||||
|
@ -2304,7 +2160,6 @@ public function registerContainerConfiguration(LoaderInterface $loader);
|
|||
public function boot();
|
||||
public function shutdown();
|
||||
public function getBundles();
|
||||
public function isClassInActiveBundle($class);
|
||||
public function getBundle($name, $first = true);
|
||||
public function locateResource($name, $dir = null, $first = true);
|
||||
public function getName();
|
||||
|
@ -2339,6 +2194,7 @@ use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
|||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
@ -2363,14 +2219,14 @@ protected $booted = false;
|
|||
protected $name;
|
||||
protected $startTime;
|
||||
protected $loadClassCache;
|
||||
const VERSION ='2.7.6';
|
||||
const VERSION_ID = 20706;
|
||||
const MAJOR_VERSION = 2;
|
||||
const MINOR_VERSION = 7;
|
||||
const RELEASE_VERSION = 6;
|
||||
const VERSION ='3.0.0';
|
||||
const VERSION_ID = 30000;
|
||||
const MAJOR_VERSION = 3;
|
||||
const MINOR_VERSION = 0;
|
||||
const RELEASE_VERSION = 0;
|
||||
const EXTRA_VERSION ='';
|
||||
const END_OF_MAINTENANCE ='05/2018';
|
||||
const END_OF_LIFE ='05/2019';
|
||||
const END_OF_MAINTENANCE ='07/2016';
|
||||
const END_OF_LIFE ='01/2017';
|
||||
public function __construct($environment, $debug)
|
||||
{
|
||||
$this->environment = $environment;
|
||||
|
@ -2380,16 +2236,6 @@ $this->name = $this->getName();
|
|||
if ($this->debug) {
|
||||
$this->startTime = microtime(true);
|
||||
}
|
||||
$defClass = new \ReflectionMethod($this,'init');
|
||||
$defClass = $defClass->getDeclaringClass()->name;
|
||||
if (__CLASS__ !== $defClass) {
|
||||
@trigger_error(sprintf('Calling the %s::init() method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', $defClass), E_USER_DEPRECATED);
|
||||
$this->init();
|
||||
}
|
||||
}
|
||||
public function init()
|
||||
{
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
public function __clone()
|
||||
{
|
||||
|
@ -2451,16 +2297,6 @@ public function getBundles()
|
|||
{
|
||||
return $this->bundles;
|
||||
}
|
||||
public function isClassInActiveBundle($class)
|
||||
{
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in version 3.0.', E_USER_DEPRECATED);
|
||||
foreach ($this->getBundles() as $bundle) {
|
||||
if (0 === strpos($class, $bundle->getNamespace())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public function getBundle($name, $first = true)
|
||||
{
|
||||
if (!isset($this->bundleMap[$name])) {
|
||||
|
@ -2729,6 +2565,7 @@ new XmlFileLoader($container, $locator),
|
|||
new YamlFileLoader($container, $locator),
|
||||
new IniFileLoader($container, $locator),
|
||||
new PhpFileLoader($container, $locator),
|
||||
new DirectoryLoader($container, $locator),
|
||||
new ClosureLoader($container),
|
||||
));
|
||||
return new DelegatingLoader($resolver);
|
||||
|
@ -2845,7 +2682,7 @@ public function getPath();
|
|||
}
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
abstract class ContainerAware implements ContainerAwareInterface
|
||||
trait ContainerAwareTrait
|
||||
{
|
||||
protected $container;
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
|
@ -2856,14 +2693,15 @@ $this->container = $container;
|
|||
}
|
||||
namespace Symfony\Component\HttpKernel\Bundle
|
||||
{
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
abstract class Bundle extends ContainerAware implements BundleInterface
|
||||
abstract class Bundle implements BundleInterface
|
||||
{
|
||||
use ContainerAwareTrait;
|
||||
protected $name;
|
||||
protected $extension;
|
||||
protected $path;
|
||||
|
@ -2879,11 +2717,10 @@ public function build(ContainerBuilder $container)
|
|||
public function getContainerExtension()
|
||||
{
|
||||
if (null === $this->extension) {
|
||||
$class = $this->getContainerExtensionClass();
|
||||
if (class_exists($class)) {
|
||||
$extension = new $class();
|
||||
$extension = $this->createContainerExtension();
|
||||
if (null !== $extension) {
|
||||
if (!$extension instanceof ExtensionInterface) {
|
||||
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', $class));
|
||||
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_class($extension)));
|
||||
}
|
||||
$basename = preg_replace('/Bundle$/','', $this->getName());
|
||||
$expectedAlias = Container::underscore($basename);
|
||||
|
@ -2957,6 +2794,12 @@ protected function getContainerExtensionClass()
|
|||
$basename = preg_replace('/Bundle$/','', $this->getName());
|
||||
return $this->getNamespace().'\\DependencyInjection\\'.$basename.'Extension';
|
||||
}
|
||||
protected function createContainerExtension()
|
||||
{
|
||||
if (class_exists($class = $this->getContainerExtensionClass())) {
|
||||
return new $class();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Symfony\Component\Config
|
||||
|
@ -2974,19 +2817,14 @@ namespace Symfony\Component\Config
|
|||
use Symfony\Component\Config\Resource\ResourceInterface;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
class ConfigCache implements ConfigCacheInterface
|
||||
class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
{
|
||||
private $debug;
|
||||
private $file;
|
||||
public function __construct($file, $debug)
|
||||
private $resourceCheckers;
|
||||
public function __construct($file, array $resourceCheckers = array())
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->debug = (bool) $debug;
|
||||
}
|
||||
public function __toString()
|
||||
{
|
||||
@trigger_error('ConfigCache::__toString() is deprecated since version 2.7 and will be removed in 3.0. Use the getPath() method instead.', E_USER_DEPRECATED);
|
||||
return $this->file;
|
||||
$this->resourceCheckers = $resourceCheckers;
|
||||
}
|
||||
public function getPath()
|
||||
{
|
||||
|
@ -2997,19 +2835,21 @@ public function isFresh()
|
|||
if (!is_file($this->file)) {
|
||||
return false;
|
||||
}
|
||||
if (!$this->debug) {
|
||||
return true;
|
||||
}
|
||||
if (!$this->resourceCheckers) {
|
||||
return true; }
|
||||
$metadata = $this->getMetaFile();
|
||||
if (!is_file($metadata)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
$time = filemtime($this->file);
|
||||
$meta = unserialize(file_get_contents($metadata));
|
||||
foreach ($meta as $resource) {
|
||||
if (!$resource->isFresh($time)) {
|
||||
return false;
|
||||
}
|
||||
foreach ($this->resourceCheckers as $checker) {
|
||||
if (!$checker->supports($resource)) {
|
||||
continue; }
|
||||
if ($checker->isFresh($resource, $time)) {
|
||||
break; }
|
||||
return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -3023,7 +2863,7 @@ try {
|
|||
$filesystem->chmod($this->file, $mode, $umask);
|
||||
} catch (IOException $e) {
|
||||
}
|
||||
if (null !== $metadata && true === $this->debug) {
|
||||
if (null !== $metadata) {
|
||||
$filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null);
|
||||
try {
|
||||
$filesystem->chmod($this->getMetaFile(), $mode, $umask);
|
||||
|
@ -3037,6 +2877,28 @@ return $this->file.'.meta';
|
|||
}
|
||||
}
|
||||
}
|
||||
namespace Symfony\Component\Config
|
||||
{
|
||||
use Symfony\Component\Config\Resource\SelfCheckingResourceChecker;
|
||||
class ConfigCache extends ResourceCheckerConfigCache
|
||||
{
|
||||
private $debug;
|
||||
public function __construct($file, $debug)
|
||||
{
|
||||
parent::__construct($file, array(
|
||||
new SelfCheckingResourceChecker(),
|
||||
));
|
||||
$this->debug = (bool) $debug;
|
||||
}
|
||||
public function isFresh()
|
||||
{
|
||||
if (!$this->debug && is_file($this->getPath())) {
|
||||
return true;
|
||||
}
|
||||
return parent::isFresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Symfony\Component\HttpKernel
|
||||
{
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
||||
|
@ -3190,46 +3052,3 @@ return (string) $var;
|
|||
}
|
||||
}
|
||||
}
|
||||
namespace Symfony\Component\HttpKernel\DependencyInjection
|
||||
{
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\HttpKernel;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Scope;
|
||||
class ContainerAwareHttpKernel extends HttpKernel
|
||||
{
|
||||
protected $container;
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null, $triggerDeprecation = true)
|
||||
{
|
||||
parent::__construct($dispatcher, $controllerResolver, $requestStack);
|
||||
if ($triggerDeprecation) {
|
||||
@trigger_error('The '.__CLASS__.' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpKernel class instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
$this->container = $container;
|
||||
if (!$container->hasScope('request')) {
|
||||
$container->addScope(new Scope('request'));
|
||||
}
|
||||
}
|
||||
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
{
|
||||
$this->container->enterScope('request');
|
||||
$this->container->set('request', $request,'request');
|
||||
try {
|
||||
$response = parent::handle($request, $type, $catch);
|
||||
} catch (\Exception $e) {
|
||||
$this->container->set('request', null,'request');
|
||||
$this->container->leaveScope('request');
|
||||
throw $e;
|
||||
}
|
||||
$this->container->set('request', null,'request');
|
||||
$this->container->leaveScope('request');
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace { return $loader; }
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
{
|
||||
"require": {
|
||||
"symfony/finder": "^2.7",
|
||||
"symfony/console": "^2.7",
|
||||
"symfony/process": "^2.7",
|
||||
"symfony/validator": "^2.7",
|
||||
"symfony/event-dispatcher": "^2.7",
|
||||
"symfony/dependency-injection": "^2.7",
|
||||
"symfony/config": "^2.7",
|
||||
"symfony/yaml": "^2.7",
|
||||
"symfony/var-dumper": "^2.7",
|
||||
"symfony/assetic-bundle": "~2.3",
|
||||
"symfony/finder": "3.0.0",
|
||||
"symfony/console": "3.0.0",
|
||||
"symfony/process": "3.0.0",
|
||||
"symfony/validator": "3.0.0",
|
||||
"symfony/event-dispatcher": "3.0.0",
|
||||
"symfony/dependency-injection": "3.0.0",
|
||||
"symfony/config": "3.0.0",
|
||||
"symfony/yaml": "3.0.0",
|
||||
"symfony/var-dumper": "3.0.0",
|
||||
"symfony/assetic-bundle": "~2.7",
|
||||
"psr/log":"~1",
|
||||
"james-heinrich/getid3": "^1.9",
|
||||
"doctrine/common": "^2.5",
|
||||
"doctrine/orm": "^2.5",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"doctrine/doctrine-bundle": "^1.5",
|
||||
"symfony/symfony": "^2.7",
|
||||
"sensio/distribution-bundle": "~4.0",
|
||||
"doctrine/doctrine-bundle": "^1.6",
|
||||
"doctrine/doctrine-cache-bundle": "^1.2",
|
||||
"symfony/symfony": "3.0.0",
|
||||
"sensio/distribution-bundle": "^5.0",
|
||||
"sensio/framework-extra-bundle": "^3.0.2",
|
||||
"incenteev/composer-parameter-handler": "~2.0",
|
||||
"symfony/swiftmailer-bundle": "~2.3",
|
||||
"symfony/monolog-bundle": "~2.4"
|
||||
"incenteev/composer-parameter-handler": "^2.0",
|
||||
"symfony/swiftmailer-bundle": "^2.3",
|
||||
"symfony/monolog-bundle": "^2.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -67,7 +68,7 @@
|
|||
"prefer-stable":true,
|
||||
"license":"MIT",
|
||||
"require-dev": {
|
||||
"sensio/generator-bundle": "~2.3",
|
||||
"phpunit/phpunit":"@stable"
|
||||
"sensio/generator-bundle": "^3.0",
|
||||
"symfony/phpunit-bridge":"^2.7"
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue