koine / delegator
将方法委托给对象
dev-master
2015-06-29 09:54 UTC
Requires (Dev)
- phpunit/phpunit: *
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2020-01-10 15:13:59 UTC
README
PHP 简单方法委托。
代码信息
包信息
使用方法
<?php class City { protected $state; protected $name; public function __construct($name, $state) { $this->name = $name; $this->state = $state; } public function getStateName() { $delegator = new \Koine\MethodDelegator; $delegator->method('getName')->to($this->state); return $delegator->delegate(); } } class State { protected $name; public function __construct($name) { $this->name = $name; } public function getName() { return $this->name; } } $state = new State('Some State'); $city = new City('Some City', $state); $city->getStateName(); // Some State
安装
通过 Composer
将库添加到您的 composer.json 文件中的 requirements 键。
{
// composer.json
// [..]
require: {
// append this line to your requirements
"koine/delegator": "dev-master"
}
}
替代安装
问题/特性建议
这里 是问题跟踪器。
贡献
只有通过 TDD 的代码会被接受。请遵循 PSR-2 代码标准。
- 分支它
- 创建您的特性分支(
git checkout -b my-new-feature) - 提交您的更改(
git commit -am 'Add some feature') - 推送到分支(
git push origin my-new-feature) - 创建新的 Pull Request
如何运行测试
phpunit --configuration tests/phpunit.xml
要检查代码标准,运行
phpcs --standard=PSR2 lib phpcs --standard=PSR2 tests