每天laravel-20160820| ContextualBinding
2016-06-02 10:17
543 查看
<?php namespace Illuminate\Container; use Illuminate\Contracts\Container\ContextualBindingBuilder as ContextualBindingBuilderContract; class ContextualBindingBuilder implements ContextualBindingBuilderContract { /** * The underlying container instance. * * @var \Illuminate\Container\Container */ protected $container;// The underlying container instance /** * The concrete instance. * * @var string */ protected $concrete;// a instance about concrete /** * The abstract target. * * @var string */ protected $needs;// a target about the abstract /** * Create a new contextual binding builder. * * @param \Illuminate\Container\Container $container * @param string $concrete * @return void */ public function __construct(Container $container, $concrete) { $this->concrete = $concrete; $this->container = $container;// set the } /** * Define the abstract target that depends on the context. * * @param string $abstract * @return $this */ public function needs($abstract) { $this->needs = $abstract; return $this; }// function is needs /** * Define the implementation for the contextual binding. * * @param \Closure|string $implementation * @return void */ public function give($implementation) { $this->container->addContextualBinding($this->concrete, $this->needs, $implementation); }// Define the implementation for the contextual binding }
相关文章推荐
- php artisan migrate : [PDOException] could not find driver解决办法
- phpstudy自己电脑连接另一台电脑上的数据库
- 自定义ContentProvider及使用ContentResolver解析详细步骤
- Yii2杂记
- PHP3.2中Model层的in操作的实现,特别针对字符串的操作
- PHP开发者的路书
- PHP处理数组和XML之间的互相转换
- PHP三级联动菜单
- php7 改为从栈上分配内在的思路
- 使用FileInputStream和ByteArrayOutputStream 实现文本数据的回读
- php实现子字符串位置相互对调互换的方法 原创
- yii2分页之实现跳转到具体某页的实例代码
- 既简单又安全的PHP验证码 附调用方法
- Yii多表联合查询操作详解
- php for 循环使用的简单实例
- laravel
- yii2中如何使用modal弹窗之基本使用
- Laravel 发送不加密的 cookie
- php正则手机号码验证
- php开发框架