Daily laravel-20160721| Application-1

Source: Internet
Author: User

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 spaceclass 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        &nbSP; $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 ():


This article is from the "Focus on PHP" blog, please be sure to keep this source http://jingshanls.blog.51cto.com/3357095/1765638

Daily laravel-20160721| Application-1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.