首页 > 其他 > 详细

每天laravel-20160802| Container -5

时间:2016-05-09 11:12:10      阅读:192      评论:0      收藏:0      [点我收藏+]
/**
 * 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

原文:http://jingshanls.blog.51cto.com/3357095/1771360

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!