namespace Illuminate\Foundation;
//命名空间:ILLuminate\Foundation; 照亮\基础;
加载:
闭包、运行时异常、数组、字符串、请求、容器、文件系统、服务支持、路由支持、http内核接口、http异常、Symfony请求、未发现http异常、应用合同
class Application 继承 Container 接口:ApplicationContract 及 HttpKernelInterface
// 定义了 版本常量
受保护的基础 变量 跟 java 相比 少了 int 类型 及 少了 $ 类型
受保护的 是否从beenBoostrapped 的方式
// 启动
数组 启动 回调
bootedCallbacks 启动后的 情况
这个 数组 终止 callbacks
服务器提供
$loaded 提供
deferred Services 服务器
数据库路径
存储路径
环境变量路径
环境变量文件名字
命名空间
传入的是 基础数据
// 归纳总结:
系统版本
基础路径
是否从bootstrap方式
启动
启动中回调
启动后回调
终止回调
服务器支持
加载支持
延迟服务
monolog配置
数据库基本路径
存储路径
环境路径
环境配置文件
命名空间
调用构造函数:
第一步:注册基本绑定
第二步:注册基本服务提供
第三步:注册内核容器别名
第四步:如果包含 基础路径, 设置基础路径。
<?php
namespace Illuminate\Foundation;// 命名空间
use Closure;// 闭包
use RuntimeException;// 运行时异常
use Illuminate\Support\Arr;// 数组支持
use Illuminate\Support\Str;// 字符串支持
use Illuminate\Http\Request;// 请求
use Illuminate\Container\Container; // 容器
use Illuminate\Filesystem\Filesystem;// 文件系统
use Illuminate\Support\ServiceProvider;// 服务器支持
use Illuminate\Events\EventServiceProvider;// 事件 服务 支持
use Illuminate\Routing\RoutingServiceProvider;// 路由 服务 支持
use Symfony\Component\HttpKernel\HttpKernelInterface;// http 内核 接口
use Symfony\Component\HttpKernel\Exception\HttpException;// http 异常
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;//Symfony 请求
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;// 未发现 http 异常
use Illuminate\Contracts\Foundation\Application as ApplicationContract;// 应用 合同
class Application extends Container implements ApplicationContract, HttpKernelInterface
{
/**
* The Laravel framework version.
*
* @var string
*/
const VERSION = '5.2.22';
/**
* The base path for the Laravel installation.
*
* @var string
*/
protected $basePath;
/**
* Indicates if the application has been bootstrapped before.
*
* @var bool
*/
protected $hasBeenBootstrapped = false;
/**
* Indicates if the application has "booted".
*
* @var bool
*/
protected $booted = false;
/**
* The array of booting callbacks.
*
* @var array
*/
protected $bootingCallbacks = [];
/**
* The array of booted callbacks.
*
* @var array
*/
protected $bootedCallbacks = [];
/**
* The array of terminating callbacks.
*
* @var array
*/
protected $terminatingCallbacks = [];
/**
* All of the registered service providers.
*
* @var array
*/
protected $serviceProviders = [];
/**
* The names of the loaded service providers.
*
* @var array
*/
protected $loadedProviders = [];
/**
* The deferred services and their providers.
*
* @var array
*/
protected $deferredServices = [];
/**
* A custom callback used to configure Monolog.
*
* @var callable|null
*/
protected $monologConfigurator;
/**
* The custom database path defined by the developer.
*
* @var string
*/
protected $databasePath;
/**
* The custom storage path defined by the developer.
*
* @var string
*/
protected $storagePath;
/**
* The custom environment path defined by the developer.
*
* @var string
*/
protected $environmentPath;
/**
* The environment file to load during bootstrapping.
*
* @var string
*/
protected $environmentFile = '.env';
/**
* The application namespace.
*
* @var string
*/
protected $namespace = null;
/**
* Create a new Illuminate application instance.
*
* @param string|null $basePath
* @return void
*/
public function __construct($basePath = null)
{
$this->registerBaseBindings();
$this->registerBaseServiceProviders();
$this->registerCoreContainerAliases();
if ($basePath) {
$this->setBasePath($basePath);
}
}