koine / delegator
Deletates methods to objects
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
Simple method delegator for PHP.
Code information:
Package information:
Usage
<?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
Installing
Via Composer
Append the lib to your requirements key in your composer.json.
{ // composer.json // [..] require: { // append this line to your requirements "koine/delegator": "dev-master" } }
Alternative install
- Learn composer. You should not be looking for an alternative install. It is worth the time. Trust me ;-)
- Follow this set of instructions
Issues/Features proposals
Here is the issue tracker.
Contributing
Only TDD code will be accepted. Please follow the PSR-2 code standard.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
How to run the tests:
phpunit --configuration tests/phpunit.xml
To check the code standard run:
phpcs --standard=PSR2 lib phpcs --standard=PSR2 tests