Daily laravel-20160808| Container-11

Source: Internet
Author: User

/**    * bind a new callback to an abstract ' s  rebind event.    *    *  @param   string      $abstract     *  @param   \Closure   $callback      *  @return  mixed    */   public function  rebinding ($abstract, closure  $callback)// means binding again    {        $this->reboundcallbacks[$this->normalize ($abstract)][] =   $callback;// set the callback function insert into the array  store       if  ($this->bound ($abstract))  {// if  has bound function set            return  $this->make ($abstract);// return the make result to what you want        }   }   /**    * Refresh  an instance on the given target and method.    *     *  @param   string   $abstract     *  @param   mixed    $target     *  @param   string  $ method    *  @return  mixed    */   public  function refresh ($abstract,  $target,  $method)// refresh means to make  or fire it again   {// use the set target and  method       return  $this->rebinding ($this->normalize ($ Abstract), function ($app,  $instance)  use  ($target,  $method)  {             $target->{$method} ($instance);        });//  return the rebinding   }//"Function use"  type way to import   a closure function.// that will use a variable out  The function,// the first good place i can see is reduce  the parameters   /**    * Fire the  "Rebound"  callbacks for the given abstract type.    *     *  @param   string   $abstract     *  @return   Void    */   protected function rebound ($abstract)// start  to run the rebound callbacks for the given abstract type   {         $instance  =  $this->make ($abstract);// the make  function is the get the instance of the ab        foreach  ($this->getreboundcallbacks ($abstract)  as  $callback)  {//loop  the abstract to call it            call_user_func ($callback,  $this,  $instance);// call user function        }   }


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

Daily laravel-20160808| Container-11

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.