pangolinkeys/php-binders
Composer 安装命令:
composer require pangolinkeys/php-binders
包简介
A repository to simplifiy combining arrays.
README 文档
README
A php repository to simplify combining arrays.
Usage
Add Bindable as a trait on the target classes.
use Bindable;
Implement the getKeys() method so the bind method knows how the array is keyed.
public function getKeys() { return array_keys($this->data); }
Create a get method suffixed by the name of the target attribute which is passed a singular key from the getKeys() method and returns a reference to the desired position in the array.
public function &getAge($person) { return $this->data[ $person ]['Age']; }
Finally, call bind and pass through the second object and the key which the bind should occur on.
$people->bind($preference, 'Age');
These methods should be implemented appropriately in both classes.
Example
A working example of this can be found in the /example directory.
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-13