/var
/www
/china-money
/ecom
/vendor
/doctrine
/dbal
/lib
/Doctrine
/DBAL
/Driver
/PDOConnection.php
* @since 2.0
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param array|null $options
*
* @throws PDOException in case of an error.
*/
public function __construct($dsn, $user = null, $password = null, array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Doctrine\DBAL\Driver\PDOStatement', []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function getServerVersion()
{
Arguments
"SQLSTATE[HY000] [2002] No such file or directory"
Arguments
AppServiceProvider {#1282}
32
/var
/www
/china-money
/ecom
/vendor
/doctrine
/dbal
/lib
/Doctrine
/DBAL
/Driver
/PDOConnection.php
/**
* PDO implementation of the Connection interface.
* Used by all PDO-based drivers.
*
* @since 2.0
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param array|null $options
*
* @throws PDOException in case of an error.
*/
public function __construct($dsn, $user = null, $password = null, array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Doctrine\DBAL\Driver\PDOStatement', []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
Arguments
"SQLSTATE[HY000] [2002] No such file or directory"
/var
/www
/china-money
/ecom
/vendor
/doctrine
/dbal
/lib
/Doctrine
/DBAL
/Driver
/PDOConnection.php
/**
* PDO implementation of the Connection interface.
* Used by all PDO-based drivers.
*
* @since 2.0
*/
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
/**
* @param string $dsn
* @param string|null $user
* @param string|null $password
* @param array|null $options
*
* @throws PDOException in case of an error.
*/
public function __construct($dsn, $user = null, $password = null, array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, ['Doctrine\DBAL\Driver\PDOStatement', []]);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
* {@inheritdoc}
*/
public function exec($statement)
{
try {
return parent::exec($statement);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
/**
Arguments
"mysql:host=localhost;port=3306;dbname=china_money"
"root"
"password"
array:5 [
8 => 0
3 => 2
11 => 0
17 => false
20 => false
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/Connector.php
} catch (Exception $e) {
return $this->tryAgainIfCausedByLostConnection(
$e, $dsn, $username, $password, $options
);
}
}
/**
* Create a new PDO connection instance.
*
* @param string $dsn
* @param string $username
* @param string $password
* @param array $options
* @return \PDO
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
return new PDOConnection($dsn, $username, $password, $options);
}
return new PDO($dsn, $username, $password, $options);
}
/**
* Determine if the connection is persistent.
*
* @param array $options
* @return bool
*/
protected function isPersistentConnection($options)
{
return isset($options[PDO::ATTR_PERSISTENT]) &&
$options[PDO::ATTR_PERSISTENT];
}
/**
* Handle an exception that occurred during connect execution.
*
Arguments
"mysql:host=localhost;port=3306;dbname=china_money"
"root"
"password"
array:5 [
8 => 0
3 => 2
11 => 0
17 => false
20 => false
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/Connector.php
PDO::ATTR_EMULATE_PREPARES => false,
];
/**
* Create a new PDO connection.
*
* @param string $dsn
* @param array $config
* @param array $options
* @return \PDO
*/
public function createConnection($dsn, array $config, array $options)
{
list($username, $password) = [
$config['username'] ?? null, $config['password'] ?? null,
];
try {
return $this->createPdoConnection(
$dsn, $username, $password, $options
);
} catch (Exception $e) {
return $this->tryAgainIfCausedByLostConnection(
$e, $dsn, $username, $password, $options
);
}
}
/**
* Create a new PDO connection instance.
*
* @param string $dsn
* @param string $username
* @param string $password
* @param array $options
* @return \PDO
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
Arguments
"mysql:host=localhost;port=3306;dbname=china_money"
"root"
"password"
array:5 [
8 => 0
3 => 2
11 => 0
17 => false
20 => false
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/MySqlConnector.php
use PDO;
class MySqlConnector extends Connector implements ConnectorInterface
{
/**
* Establish a database connection.
*
* @param array $config
* @return \PDO
*/
public function connect(array $config)
{
$dsn = $this->getDsn($config);
$options = $this->getOptions($config);
// We need to grab the PDO options that should be used while making the brand
// new connection instance. The PDO options control various aspects of the
// connection's behavior, and some might be specified by the developers.
$connection = $this->createConnection($dsn, $config, $options);
if (! empty($config['database'])) {
$connection->exec("use `{$config['database']}`;");
}
$this->configureEncoding($connection, $config);
// Next, we will check to see if a timezone has been specified in this config
// and if it has we will issue a statement to modify the timezone with the
// database. Setting this DB timezone is an optional configuration item.
$this->configureTimezone($connection, $config);
$this->setModes($connection, $config);
return $connection;
}
/**
* Set the connection character set and collation.
*
Arguments
"mysql:host=localhost;port=3306;dbname=china_money"
array:13 [
"driver" => "mysql"
"host" => "localhost"
"port" => "3306"
"database" => "china_money"
"username" => "root"
"password" => "password"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => ""
"strict" => false
"engine" => null
"name" => "mysql"
]
array:5 [
8 => 0
3 => 2
11 => 0
17 => false
20 => false
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/ConnectionFactory.php
{
return array_key_exists('host', $config)
? $this->createPdoResolverWithHosts($config)
: $this->createPdoResolverWithoutHosts($config);
}
/**
* Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts.
*
* @param array $config
* @return \Closure
*/
protected function createPdoResolverWithHosts(array $config)
{
return function () use ($config) {
foreach (Arr::shuffle($hosts = $this->parseHosts($config)) as $key => $host) {
$config['host'] = $host;
try {
return $this->createConnector($config)->connect($config);
} catch (PDOException $e) {
if (count($hosts) - 1 === $key && $this->container->bound(ExceptionHandler::class)) {
$this->container->make(ExceptionHandler::class)->report($e);
}
}
}
throw $e;
};
}
/**
* Parse the hosts configuration item into an array.
*
* @param array $config
* @return array
*/
protected function parseHosts(array $config)
{
$hosts = Arr::wrap($config['host']);
Arguments
array:13 [
"driver" => "mysql"
"host" => "localhost"
"port" => "3306"
"database" => "china_money"
"username" => "root"
"password" => "password"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => ""
"strict" => false
"engine" => null
"name" => "mysql"
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connection.php
$this->doctrineConnection = new DoctrineConnection([
'pdo' => $this->getPdo(),
'dbname' => $this->getConfig('database'),
'driver' => $driver->getName(),
], $driver);
}
return $this->doctrineConnection;
}
/**
* Get the current PDO connection.
*
* @return \PDO
*/
public function getPdo()
{
if ($this->pdo instanceof Closure) {
return $this->pdo = call_user_func($this->pdo);
}
return $this->pdo;
}
/**
* Get the current PDO connection used for reading.
*
* @return \PDO
*/
public function getReadPdo()
{
if ($this->transactions > 0) {
return $this->getPdo();
}
if ($this->getConfig('sticky') && $this->recordsModified) {
return $this->getPdo();
}
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connection.php
$this->doctrineConnection = new DoctrineConnection([
'pdo' => $this->getPdo(),
'dbname' => $this->getConfig('database'),
'driver' => $driver->getName(),
], $driver);
}
return $this->doctrineConnection;
}
/**
* Get the current PDO connection.
*
* @return \PDO
*/
public function getPdo()
{
if ($this->pdo instanceof Closure) {
return $this->pdo = call_user_func($this->pdo);
}
return $this->pdo;
}
/**
* Get the current PDO connection used for reading.
*
* @return \PDO
*/
public function getReadPdo()
{
if ($this->transactions > 0) {
return $this->getPdo();
}
if ($this->getConfig('sticky') && $this->recordsModified) {
return $this->getPdo();
}
Arguments
Closure {#1122
class: "Illuminate\Database\Connectors\ConnectionFactory"
this: ConnectionFactory {#39 …}
use: {
$config: array:13 [
"driver" => "mysql"
"host" => "localhost"
"port" => "3306"
"database" => "china_money"
"username" => "root"
"password" => "password"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => ""
"strict" => false
"engine" => null
"name" => "mysql"
]
}
}
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connection.php
*
* @return \Doctrine\DBAL\Schema\AbstractSchemaManager
*/
public function getDoctrineSchemaManager()
{
return $this->getDoctrineDriver()->getSchemaManager($this->getDoctrineConnection());
}
/**
* Get the Doctrine DBAL database connection instance.
*
* @return \Doctrine\DBAL\Connection
*/
public function getDoctrineConnection()
{
if (is_null($this->doctrineConnection)) {
$driver = $this->getDoctrineDriver();
$this->doctrineConnection = new DoctrineConnection([
'pdo' => $this->getPdo(),
'dbname' => $this->getConfig('database'),
'driver' => $driver->getName(),
], $driver);
}
return $this->doctrineConnection;
}
/**
* Get the current PDO connection.
*
* @return \PDO
*/
public function getPdo()
{
if ($this->pdo instanceof Closure) {
return $this->pdo = call_user_func($this->pdo);
}
return $this->pdo;
/var
/www
/china-money
/ecom
/vendor
/larapack
/doctrine-support
/src
/DoctrineSupportServiceProvider.php
return $connection;
});
}
/**
* Add Doctrine types for the connection.
*
* @param Connection $connection
*/
protected function addDoctrineTypes(Connection $connection)
{
$name = $connection->getDriverName();
foreach (array_get($this->types, $name, []) as $type => $handler) {
if (!Type::hasType($type)) {
Type::addType($type, $handler);
}
$connection->getDoctrineConnection()
->getDatabasePlatform()
->registerDoctrineTypeMapping($type, $type);
}
}
}
/var
/www
/china-money
/ecom
/vendor
/larapack
/doctrine-support
/src
/DoctrineSupportServiceProvider.php
*
* @var array
*/
protected $types = [
'mysql' => [
'enum' => EnumType::class,
],
];
/**
* Register the application services.
*/
public function register()
{
// Set resolver for MySQL
Connection::resolverFor('mysql', function ($connection, $database, $prefix = '', array $config = []) {
$connection = new MySqlConnection($connection, $database, $prefix, $config);
// Add Doctrine types for better support
$this->addDoctrineTypes($connection);
return $connection;
});
}
/**
* Add Doctrine types for the connection.
*
* @param Connection $connection
*/
protected function addDoctrineTypes(Connection $connection)
{
$name = $connection->getDriverName();
foreach (array_get($this->types, $name, []) as $type => $handler) {
if (!Type::hasType($type)) {
Type::addType($type, $handler);
}
$connection->getDoctrineConnection()
Arguments
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/ConnectionFactory.php
throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]");
}
/**
* Create a new connection instance.
*
* @param string $driver
* @param \PDO|\Closure $connection
* @param string $database
* @param string $prefix
* @param array $config
* @return \Illuminate\Database\Connection
*
* @throws \InvalidArgumentException
*/
protected function createConnection($driver, $connection, $database, $prefix = '', array $config = [])
{
if ($resolver = Connection::getResolver($driver)) {
return $resolver($connection, $database, $prefix, $config);
}
switch ($driver) {
case 'mysql':
return new MySqlConnection($connection, $database, $prefix, $config);
case 'pgsql':
return new PostgresConnection($connection, $database, $prefix, $config);
case 'sqlite':
return new SQLiteConnection($connection, $database, $prefix, $config);
case 'sqlsrv':
return new SqlServerConnection($connection, $database, $prefix, $config);
}
throw new InvalidArgumentException("Unsupported driver [$driver]");
}
}
Arguments
MySqlConnection {#1121}
"china_money"
""
array:13 [
"driver" => "mysql"
"host" => "localhost"
"port" => "3306"
"database" => "china_money"
"username" => "root"
"password" => "password"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => ""
"strict" => false
"engine" => null
"name" => "mysql"
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/ConnectionFactory.php
* @param string $name
* @return array
*/
protected function parseConfig(array $config, $name)
{
return Arr::add(Arr::add($config, 'prefix', ''), 'name', $name);
}
/**
* Create a single database connection instance.
*
* @param array $config
* @return \Illuminate\Database\Connection
*/
protected function createSingleConnection(array $config)
{
$pdo = $this->createPdoResolver($config);
return $this->createConnection(
$config['driver'], $pdo, $config['database'], $config['prefix'], $config
);
}
/**
* Create a single database connection instance.
*
* @param array $config
* @return \Illuminate\Database\Connection
*/
protected function createReadWriteConnection(array $config)
{
$connection = $this->createSingleConnection($this->getWriteConfig($config));
return $connection->setReadPdo($this->createReadPdo($config));
}
/**
* Create a new PDO instance for reading.
*
* @param array $config
Arguments
"mysql"
Closure {#1122
class: "Illuminate\Database\Connectors\ConnectionFactory"
this: ConnectionFactory {#39 …}
use: {
$config: array:13 [
"driver" => "mysql"
"host" => "localhost"
"port" => "3306"
"database" => "china_money"
"username" => "root"
"password" => "password"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => ""
"strict" => false
"engine" => null
"name" => "mysql"
]
}
}
"china_money"
""
array:13 [
"driver" => "mysql"
"host" => "localhost"
"port" => "3306"
"database" => "china_money"
"username" => "root"
"password" => "password"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => ""
"strict" => false
"engine" => null
"name" => "mysql"
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/Connectors
/ConnectionFactory.php
{
$this->container = $container;
}
/**
* Establish a PDO connection based on the configuration.
*
* @param array $config
* @param string $name
* @return \Illuminate\Database\Connection
*/
public function make(array $config, $name = null)
{
$config = $this->parseConfig($config, $name);
if (isset($config['read'])) {
return $this->createReadWriteConnection($config);
}
return $this->createSingleConnection($config);
}
/**
* Parse and prepare the database configuration.
*
* @param array $config
* @param string $name
* @return array
*/
protected function parseConfig(array $config, $name)
{
return Arr::add(Arr::add($config, 'prefix', ''), 'name', $name);
}
/**
* Create a single database connection instance.
*
* @param array $config
* @return \Illuminate\Database\Connection
*/
Arguments
array:13 [
"driver" => "mysql"
"host" => "localhost"
"port" => "3306"
"database" => "china_money"
"username" => "root"
"password" => "password"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => ""
"strict" => false
"engine" => null
"name" => "mysql"
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/DatabaseManager.php
*/
protected function makeConnection($name)
{
$config = $this->configuration($name);
// First we will check by the connection name to see if an extension has been
// registered specifically for that connection. If it has we will call the
// Closure and pass it the config allowing it to resolve the connection.
if (isset($this->extensions[$name])) {
return call_user_func($this->extensions[$name], $config, $name);
}
// Next we will check to see if an extension has been registered for a driver
// and will call the Closure if so, which allows us to have a more generic
// resolver for the drivers themselves which applies to all connections.
if (isset($this->extensions[$driver = $config['driver']])) {
return call_user_func($this->extensions[$driver], $config, $name);
}
return $this->factory->make($config, $name);
}
/**
* Get the configuration for a connection.
*
* @param string $name
* @return array
*
* @throws \InvalidArgumentException
*/
protected function configuration($name)
{
$name = $name ?: $this->getDefaultConnection();
// To get the database connection configuration, we will just pull each of the
// connection configurations and get the configurations for the given name.
// If the configuration doesn't exist, we'll throw an exception and bail.
$connections = $this->app['config']['database.connections'];
if (is_null($config = Arr::get($connections, $name))) {
Arguments
array:13 [
"driver" => "mysql"
"host" => "localhost"
"port" => "3306"
"database" => "china_money"
"username" => "root"
"password" => "password"
"unix_socket" => ""
"charset" => "utf8mb4"
"collation" => "utf8mb4_unicode_ci"
"prefix" => ""
"strict" => false
"engine" => null
"name" => "mysql"
]
"mysql"
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Database
/DatabaseManager.php
}
/**
* Get a database connection instance.
*
* @param string $name
* @return \Illuminate\Database\Connection
*/
public function connection($name = null)
{
list($database, $type) = $this->parseConnectionName($name);
$name = $name ?: $database;
// If we haven't created this connection, we'll create it based on the config
// provided in the application. Once we've created the connections we will
// set the "fetch mode" for PDO which determines the query return types.
if (! isset($this->connections[$name])) {
$this->connections[$name] = $this->configure(
$this->makeConnection($database), $type
);
}
return $this->connections[$name];
}
/**
* Parse the connection into an array of the name and read / write type.
*
* @param string $name
* @return array
*/
protected function parseConnectionName($name)
{
$name = $name ?: $this->getDefaultConnection();
return Str::endsWith($name, ['::read', '::write'])
? explode('::', $name, 2) : [$name, null];
}
Arguments
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Support
/Facades
/Schema.php
{
/**
* Get a schema builder instance for a connection.
*
* @param string $name
* @return \Illuminate\Database\Schema\Builder
*/
public static function connection($name)
{
return static::$app['db']->connection($name)->getSchemaBuilder();
}
/**
* Get a schema builder instance for the default connection.
*
* @return \Illuminate\Database\Schema\Builder
*/
protected static function getFacadeAccessor()
{
return static::$app['db']->connection()->getSchemaBuilder();
}
}
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Support
/Facades
/Facade.php
* @param mixed $instance
* @return void
*/
public static function swap($instance)
{
static::$resolvedInstance[static::getFacadeAccessor()] = $instance;
if (isset(static::$app)) {
static::$app->instance(static::getFacadeAccessor(), $instance);
}
}
/**
* Get the root object behind the facade.
*
* @return mixed
*/
public static function getFacadeRoot()
{
return static::resolveFacadeInstance(static::getFacadeAccessor());
}
/**
* Get the registered name of the component.
*
* @return string
*
* @throws \RuntimeException
*/
protected static function getFacadeAccessor()
{
throw new RuntimeException('Facade does not implement getFacadeAccessor method.');
}
/**
* Resolve the facade root instance from the container.
*
* @param string|object $name
* @return mixed
*/
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Support
/Facades
/Facade.php
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public static function setFacadeApplication($app)
{
static::$app = $app;
}
/**
* Handle dynamic, static calls to the object.
*
* @param string $method
* @param array $args
* @return mixed
*
* @throws \RuntimeException
*/
public static function __callStatic($method, $args)
{
$instance = static::getFacadeRoot();
if (! $instance) {
throw new RuntimeException('A facade root has not been set.');
}
return $instance->$method(...$args);
}
}
/var
/www
/china-money
/ecom
/app
/Providers
/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
Schema::defaultStringLength(191);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
Arguments
"defaultStringLength"
array:1 [
0 => 191
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Container
/BoundMethod.php
class BoundMethod
{
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param \Illuminate\Container\Container $container
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public static function call($container, $callback, array $parameters = [], $defaultMethod = null)
{
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return call_user_func_array(
$callback, static::getMethodDependencies($container, $callback, $parameters)
);
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
* @param \Illuminate\Container\Container $container
* @param string $target
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*
* @throws \InvalidArgumentException
*/
protected static function callClass($container, $target, array $parameters = [], $defaultMethod = null)
{
$segments = explode('@', $target);
// We will assume an @ sign is used to delimit the class name from the method
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Container
/BoundMethod.php
class BoundMethod
{
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param \Illuminate\Container\Container $container
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public static function call($container, $callback, array $parameters = [], $defaultMethod = null)
{
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return call_user_func_array(
$callback, static::getMethodDependencies($container, $callback, $parameters)
);
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
* @param \Illuminate\Container\Container $container
* @param string $target
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*
* @throws \InvalidArgumentException
*/
protected static function callClass($container, $target, array $parameters = [], $defaultMethod = null)
{
$segments = explode('@', $target);
// We will assume an @ sign is used to delimit the class name from the method
Arguments
array:2 [
0 => AppServiceProvider {#1282}
1 => "boot"
]
[]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Container
/BoundMethod.php
* @param callable $callback
* @param mixed $default
* @return mixed
*/
protected static function callBoundMethod($container, $callback, $default)
{
if (! is_array($callback)) {
return $default instanceof Closure ? $default() : $default;
}
// Here we need to turn the array callable into a Class@method string we can use to
// examine the container and see if there are any method bindings for this given
// method. If there are, we can call this method binding callback immediately.
$method = static::normalizeMethod($callback);
if ($container->hasMethodBinding($method)) {
return $container->callMethodBinding($method, $callback[0]);
}
return $default instanceof Closure ? $default() : $default;
}
/**
* Normalize the given callback into a Class@method string.
*
* @param callable $callback
* @return string
*/
protected static function normalizeMethod($callback)
{
$class = is_string($callback[0]) ? $callback[0] : get_class($callback[0]);
return "{$class}@{$callback[1]}";
}
/**
* Get all dependencies for a given method.
*
* @param \Illuminate\Container\Container $container
* @param callable|string $callback
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Container
/BoundMethod.php
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param \Illuminate\Container\Container $container
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public static function call($container, $callback, array $parameters = [], $defaultMethod = null)
{
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return call_user_func_array(
$callback, static::getMethodDependencies($container, $callback, $parameters)
);
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
* @param \Illuminate\Container\Container $container
* @param string $target
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*
* @throws \InvalidArgumentException
*/
protected static function callClass($container, $target, array $parameters = [], $defaultMethod = null)
{
$segments = explode('@', $target);
// We will assume an @ sign is used to delimit the class name from the method
// name. We will split on this @ sign and then build a callable array that
// we can pass right back into the "call" method for dependency binding.
Arguments
Application {#2}
array:2 [
0 => AppServiceProvider {#1282}
1 => "boot"
]
Closure {#31
class: "Illuminate\Container\BoundMethod"
use: {
$container: Application {#2 …}
$callback: array:2 [
0 => AppServiceProvider {#1282}
1 => "boot"
]
$parameters: []
}
}
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Container
/Container.php
* @return \Closure
*/
public function wrap(Closure $callback, array $parameters = [])
{
return function () use ($callback, $parameters) {
return $this->call($callback, $parameters);
};
}
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
}
/**
* Get a closure to resolve the given type from the container.
*
* @param string $abstract
* @return \Closure
*/
public function factory($abstract)
{
return function () use ($abstract) {
return $this->make($abstract);
};
}
/**
* An alias function name for make().
*
* @param string $abstract
* @param array $parameters
Arguments
Application {#2}
array:2 [
0 => AppServiceProvider {#1282}
1 => "boot"
]
[]
null
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Foundation
/Application.php
array_walk($this->serviceProviders, function ($p) {
$this->bootProvider($p);
});
$this->booted = true;
$this->fireAppCallbacks($this->bootedCallbacks);
}
/**
* Boot the given service provider.
*
* @param \Illuminate\Support\ServiceProvider $provider
* @return mixed
*/
protected function bootProvider(ServiceProvider $provider)
{
if (method_exists($provider, 'boot')) {
return $this->call([$provider, 'boot']);
}
}
/**
* Register a new boot listener.
*
* @param mixed $callback
* @return void
*/
public function booting($callback)
{
$this->bootingCallbacks[] = $callback;
}
/**
* Register a new "booted" listener.
*
* @param mixed $callback
* @return void
*/
Arguments
array:2 [
0 => AppServiceProvider {#1282}
1 => "boot"
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Foundation
/Application.php
}
/**
* Boot the application's service providers.
*
* @return void
*/
public function boot()
{
if ($this->booted) {
return;
}
// Once the application has booted we will also fire some "booted" callbacks
// for any listeners that need to do work after this initial booting gets
// finished. This is useful when ordering the boot-up processes we run.
$this->fireAppCallbacks($this->bootingCallbacks);
array_walk($this->serviceProviders, function ($p) {
$this->bootProvider($p);
});
$this->booted = true;
$this->fireAppCallbacks($this->bootedCallbacks);
}
/**
* Boot the given service provider.
*
* @param \Illuminate\Support\ServiceProvider $provider
* @return mixed
*/
protected function bootProvider(ServiceProvider $provider)
{
if (method_exists($provider, 'boot')) {
return $this->call([$provider, 'boot']);
}
}
Arguments
AppServiceProvider {#1282}
Arguments
AppServiceProvider {#1282}
32
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Foundation
/Application.php
/**
* Boot the application's service providers.
*
* @return void
*/
public function boot()
{
if ($this->booted) {
return;
}
// Once the application has booted we will also fire some "booted" callbacks
// for any listeners that need to do work after this initial booting gets
// finished. This is useful when ordering the boot-up processes we run.
$this->fireAppCallbacks($this->bootingCallbacks);
array_walk($this->serviceProviders, function ($p) {
$this->bootProvider($p);
});
$this->booted = true;
$this->fireAppCallbacks($this->bootedCallbacks);
}
/**
* Boot the given service provider.
*
* @param \Illuminate\Support\ServiceProvider $provider
* @return mixed
*/
protected function bootProvider(ServiceProvider $provider)
{
if (method_exists($provider, 'boot')) {
return $this->call([$provider, 'boot']);
}
}
/**
Arguments
array:44 [
0 => EventServiceProvider {#6}
1 => LogServiceProvider {#8}
2 => RoutingServiceProvider {#10}
3 => AuthServiceProvider {#41}
4 => CookieServiceProvider {#37}
5 => DatabaseServiceProvider {#51}
6 => EncryptionServiceProvider {#58}
7 => FilesystemServiceProvider {#60}
8 => FormRequestServiceProvider {#66}
9 => FoundationServiceProvider {#65}
10 => NotificationServiceProvider {#68}
11 => PaginationServiceProvider {#70}
12 => SessionServiceProvider {#74}
13 => ViewServiceProvider {#78}
14 => ServiceProvider {#82}
15 => TrustedProxyServiceProvider {#83}
16 => HooksServiceProvider {#85}
17 => VoyagerHooksServiceProvider {#84}
18 => ImageServiceProvider {#106}
19 => ServiceProvider {#109}
20 => VoyagerEventServiceProvider {#116}
21 => VoyagerDummyServiceProvider {#117}
22 => DoctrineSupportServiceProvider {#118}
23 => VoyagerServiceProvider {#115}
24 => GeneratorsServiceProvider {#1314}
25 => MigrationsGeneratorServiceProvider {#1303}
26 => OrchestratorEventServiceProvider {#1289}
27 => VoyagerDeploymentOrchestratorServiceProvider {#1299}
28 => DataTablesServiceProvider {#1297}
29 => UtilitiesServiceProvider {#1290}
30 => RouteServiceProvider {#1283}
31 => LogViewerServiceProvider {#1293}
32 => AppServiceProvider {#1282}
33 => AuthServiceProvider {#1273}
34 => EventServiceProvider {#1280}
35 => RouteServiceProvider {#1279}
36 => PDFMergerServiceProvider {#1278}
37 => ServiceProvider {#1276}
38 => TranslationServiceProvider {#1269}
39 => ArtisanServiceProvider {#1257}
40 => MigrationServiceProvider {#1191}
41 => ComposerServiceProvider {#1187}
42 => ConsoleSupportServiceProvider {#1258}
43 => HashServiceProvider {#1133}
]
Closure {#22
class: "Illuminate\Foundation\Application"
this: Application {#2 …}
parameters: {
$p: {}
}
}
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Foundation
/Bootstrap
/BootProviders.php
<?php
namespace Illuminate\Foundation\Bootstrap;
use Illuminate\Contracts\Foundation\Application;
class BootProviders
{
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function bootstrap(Application $app)
{
$app->boot();
}
}
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Foundation
/Application.php
$this->register(new LogServiceProvider($this));
$this->register(new RoutingServiceProvider($this));
}
/**
* Run the given array of bootstrap classes.
*
* @param array $bootstrappers
* @return void
*/
public function bootstrapWith(array $bootstrappers)
{
$this->hasBeenBootstrapped = true;
foreach ($bootstrappers as $bootstrapper) {
$this['events']->fire('bootstrapping: '.$bootstrapper, [$this]);
$this->make($bootstrapper)->bootstrap($this);
$this['events']->fire('bootstrapped: '.$bootstrapper, [$this]);
}
}
/**
* Register a callback to run after loading the environment.
*
* @param \Closure $callback
* @return void
*/
public function afterLoadingEnvironment(Closure $callback)
{
return $this->afterBootstrapping(
LoadEnvironmentVariables::class, $callback
);
}
/**
* Register a callback to run before a bootstrapper.
Arguments
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Foundation
/Http
/Kernel.php
Facade::clearResolvedInstance('request');
$this->bootstrap();
return (new Pipeline($this->app))
->send($request)
->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
->then($this->dispatchToRouter());
}
/**
* Bootstrap the application for HTTP requests.
*
* @return void
*/
public function bootstrap()
{
if (! $this->app->hasBeenBootstrapped()) {
$this->app->bootstrapWith($this->bootstrappers());
}
}
/**
* Get the route dispatcher callback.
*
* @return \Closure
*/
protected function dispatchToRouter()
{
return function ($request) {
$this->app->instance('request', $request);
return $this->router->dispatch($request);
};
}
/**
* Call the terminate method on any terminable middleware.
*
Arguments
array:6 [
0 => "Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables"
1 => "Illuminate\Foundation\Bootstrap\LoadConfiguration"
2 => "Illuminate\Foundation\Bootstrap\HandleExceptions"
3 => "Illuminate\Foundation\Bootstrap\RegisterFacades"
4 => "Illuminate\Foundation\Bootstrap\RegisterProviders"
5 => "Illuminate\Foundation\Bootstrap\BootProviders"
]
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Foundation
/Http
/Kernel.php
$this->app['events']->dispatch(
new Events\RequestHandled($request, $response)
);
return $response;
}
/**
* Send the given request through the middleware / router.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
protected function sendRequestThroughRouter($request)
{
$this->app->instance('request', $request);
Facade::clearResolvedInstance('request');
$this->bootstrap();
return (new Pipeline($this->app))
->send($request)
->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
->then($this->dispatchToRouter());
}
/**
* Bootstrap the application for HTTP requests.
*
* @return void
*/
public function bootstrap()
{
if (! $this->app->hasBeenBootstrapped()) {
$this->app->bootstrapWith($this->bootstrappers());
}
}
/**
/var
/www
/china-money
/ecom
/vendor
/laravel
/framework
/src
/Illuminate
/Foundation
/Http
/Kernel.php
$router->middlewareGroup($key, $middleware);
}
foreach ($this->routeMiddleware as $key => $middleware) {
$router->aliasMiddleware($key, $middleware);
}
}
/**
* Handle an incoming HTTP request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function handle($request)
{
try {
$request->enableHttpMethodParameterOverride();
$response = $this->sendRequestThroughRouter($request);
} catch (Exception $e) {
$this->reportException($e);
$response = $this->renderException($request, $e);
} catch (Throwable $e) {
$this->reportException($e = new FatalThrowableError($e));
$response = $this->renderException($request, $e);
}
$this->app['events']->dispatch(
new Events\RequestHandled($request, $response)
);
return $response;
}
/**
* Send the given request through the middleware / router.
*
Arguments
Request {#42
#json: null
#convertedFiles: null
#userResolver: null
#routeResolver: null
+attributes: ParameterBag {#44}
+request: ParameterBag {#50}
+query: ParameterBag {#50}
+server: ServerBag {#46}
+files: FileBag {#47}
+cookies: ParameterBag {#45}
+headers: HeaderBag {#48}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: array:1 [
0 => "*/*"
]
#pathInfo: null
#requestUri: null
#baseUrl: null
#basePath: null
#method: null
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
pathInfo: "/"
requestUri: "/"
baseUrl: ""
basePath: ""
method: "GET"
format: "html"
}
/var
/www
/china-money
/ecom
/public
/index.php
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
Arguments
Request {#42
#json: null
#convertedFiles: null
#userResolver: null
#routeResolver: null
+attributes: ParameterBag {#44}
+request: ParameterBag {#50}
+query: ParameterBag {#50}
+server: ServerBag {#46}
+files: FileBag {#47}
+cookies: ParameterBag {#45}
+headers: HeaderBag {#48}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: array:1 [
0 => "*/*"
]
#pathInfo: null
#requestUri: null
#baseUrl: null
#basePath: null
#method: null
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
pathInfo: "/"
requestUri: "/"
baseUrl: ""
basePath: ""
method: "GET"
format: "html"
}