每天laravel-20160721|Application-1
2016-04-20 09:44
633 查看
namespace Illuminate\Console; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Container\Container; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Application as SymfonyApplication; use Symfony\Component\Console\Command\Command as SymfonyCommand; use Illuminate\Contracts\Console\Application as ApplicationContract; // my name space class Application extends SymfonyApplication implements ApplicationContract {// class Application extends SymfonyApplication implements ApplicationContract /** * The Laravel application instance. * * @var \Illuminate\Contracts\Container\Container */ protected $laravel;// The laravel application instance. // all use this instance in the /** * The output from the previous command. * * @var \Symfony\Component\Console\Output\BufferedOutput */ protected $lastOutput;//The output from the previous command. // The previous command output String. /** * Create a new Artisan console application. * * @param \Illuminate\Contracts\Container\Container $laravel * @param \Illuminate\Contracts\Events\Dispatcher $events * @param string $version * @return void */ public function __construct(Container $laravel, Dispatcher $events, $version) { parent::__construct('Laravel Framework', $version);// use parents construct , may like set $this->laravel = $laravel;// set the instance the laravel $this->setAutoExit(false);// set the auto Exit $this->setCatchExceptions(false);//set Catch Exceptions $events->fire(new Events\ArtisanStarting($this));//fire the Events \Artisan Starting }// Create a new Artisan console application /** * Run an Artisan console command by name. * * @param string $command * @param array $parameters * @return int */ // Run an Artisan console command by name. public function call($command, array $parameters = [])//Run an Artisan console command by name. {// call $command array $parameters $parameters = collect($parameters)->prepend($command);// collect($parameters)->prepend($command) // set the parameters ,format the parameters. // set parameter $this->lastOutput = new BufferedOutput;// $this->lastOutput get the new Buffered Output // the Output string is a Output class // set the lastOutput $this->setCatchExceptions(false);// set Catch Exceptions // Set Catch Exceptions // set the Exceptions $result = $this->run(new ArrayInput($parameters->toArray()), $this->lastOutput);// run () // run the function use parameters and Output. $this->setCatchExceptions(true);// set the Set Catch Exception return $result;// back the result to the call } /** * Get the output for the last run command. * * @return string */ public function output() { return $this->lastOutput ? $this->lastOutput->fetch() : ''; }// Get the output for the last run command. // return $this->lastOutput ? $this->lastOutput->fetch():
相关文章推荐
- php json对接app接口
- Android Studio 快捷键修改
- 初识 iOS 9 中新的联系人框架
- Android四大控件之Activity详解:实践篇
- iOS 开发多线程及其进程和线程的介绍和理解
- 浩瀚移动POS收银开单扫描解决方案PDA仓储系统,无线批发,移动批发,无线POS,无线销售APP-车销管理PDA
- android开发百度地图黑屏闪退现象解决办法
- 微信支付宝扫码支付相关接口
- Android-绑定服务的实现方式
- iOS 类别和扩展(Categories和Extensions)
- iOS中的小知识点
- 《学习笔记》android6.0 锁屏壁纸功能
- Activity和layout的关系,activity的启动模式
- Android开发-API指南-<compatible-screens>
- 城管停车执法打印APP 移动云POS 现场打印告知单-执法平台+智能POS客户端系统
- Gson将字符串转map时,int默认为double类型
- iOS 数据缓存
- 常用的移动端框架
- nexus5x刷最新android M
- Android基础:Android中的action category type