标签:laravel
/**
* Get the Closure to be used when building a type.
* Get the Closure to be used when building a type.
* @param string $abstract
* @param string $concrete
* @return \Closure
*/
protected function getClosure($abstract, $concrete)// one is abstract other is concrete
{
return function ($c, $parameters = []) use ($abstract, $concrete) {// like get four parameters
$method = ($abstract == $concrete) ? ‘build‘ : ‘make‘;// create the new type by class type.
return $c->$method($concrete, $parameters);// return the instance of the class ,
};
}本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1771360
每天laravel-20160802| Container -5
标签:laravel
原文地址:http://jingshanls.blog.51cto.com/3357095/1771360