[Foundation] moved some Kernel initializations in the boot() method to speed up creation of Kernel instances
This commit is contained in:
parent
0858289397
commit
a9d8f39382
@ -50,28 +50,23 @@ abstract class Kernel implements RequestHandlerInterface, \Serializable
|
|||||||
*/
|
*/
|
||||||
public function __construct($environment, $debug)
|
public function __construct($environment, $debug)
|
||||||
{
|
{
|
||||||
|
$this->environment = $environment;
|
||||||
$this->debug = (Boolean) $debug;
|
$this->debug = (Boolean) $debug;
|
||||||
|
$this->booted = false;
|
||||||
|
$this->rootDir = realpath($this->registerRootDir());
|
||||||
|
$this->name = basename($this->rootDir);
|
||||||
|
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
{
|
{
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
|
|
||||||
|
$this->startTime = microtime(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->debug)
|
|
||||||
{
|
|
||||||
$this->startTime = microtime(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->booted = false;
|
|
||||||
$this->environment = $environment;
|
|
||||||
$this->bundles = $this->registerBundles();
|
|
||||||
$this->bundleDirs = $this->registerBundleDirs();
|
|
||||||
$this->rootDir = realpath($this->registerRootDir());
|
|
||||||
$this->name = basename($this->rootDir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract public function registerRootDir();
|
abstract public function registerRootDir();
|
||||||
@ -111,6 +106,9 @@ abstract class Kernel implements RequestHandlerInterface, \Serializable
|
|||||||
throw new \LogicException('The kernel is already booted.');
|
throw new \LogicException('The kernel is already booted.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->bundles = $this->registerBundles();
|
||||||
|
$this->bundleDirs = $this->registerBundleDirs();
|
||||||
|
|
||||||
// initialize the container
|
// initialize the container
|
||||||
$this->container = $this->initializeContainer();
|
$this->container = $this->initializeContainer();
|
||||||
$this->container->setService('kernel', $this);
|
$this->container->setService('kernel', $this);
|
||||||
|
@ -390,28 +390,23 @@ abstract class Kernel implements RequestHandlerInterface, \Serializable
|
|||||||
|
|
||||||
public function __construct($environment, $debug)
|
public function __construct($environment, $debug)
|
||||||
{
|
{
|
||||||
|
$this->environment = $environment;
|
||||||
$this->debug = (Boolean) $debug;
|
$this->debug = (Boolean) $debug;
|
||||||
|
$this->booted = false;
|
||||||
|
$this->rootDir = realpath($this->registerRootDir());
|
||||||
|
$this->name = basename($this->rootDir);
|
||||||
|
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
{
|
{
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
|
|
||||||
|
$this->startTime = microtime(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->debug)
|
|
||||||
{
|
|
||||||
$this->startTime = microtime(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->booted = false;
|
|
||||||
$this->environment = $environment;
|
|
||||||
$this->bundles = $this->registerBundles();
|
|
||||||
$this->bundleDirs = $this->registerBundleDirs();
|
|
||||||
$this->rootDir = realpath($this->registerRootDir());
|
|
||||||
$this->name = basename($this->rootDir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract public function registerRootDir();
|
abstract public function registerRootDir();
|
||||||
@ -438,6 +433,9 @@ abstract class Kernel implements RequestHandlerInterface, \Serializable
|
|||||||
throw new \LogicException('The kernel is already booted.');
|
throw new \LogicException('The kernel is already booted.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->bundles = $this->registerBundles();
|
||||||
|
$this->bundleDirs = $this->registerBundleDirs();
|
||||||
|
|
||||||
$this->container = $this->initializeContainer();
|
$this->container = $this->initializeContainer();
|
||||||
$this->container->setService('kernel', $this);
|
$this->container->setService('kernel', $this);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user