Simple decorator base class for PHP.
Code information:
Package information:
Create an class that extends Koine\Decorator and override only the changed methods in there.
<?phpclass Product
{
publicfunctiongetPrice()
{
return123.99;
}
publicfunctiongetName()
{
return"Product Name";
}
}
class ProductDecorator extends \Koine\Decorator
{
publicfunctiongetPrice()
{
return'US ' . $this->object->getPrice();
}
}
$product = newProduct;
$decorator = newProductDecorator($product);
$decorator->getName(); // Product Name$decorator->getPrice(); // US 123.99Append the lib to your requirements key in your composer.json.
{// composer.json// [..]require: {// append this line to your requirements"koine/decorator": "dev-master"}}- Learn composer. You should not be looking for an alternative install. It is worth the time. Trust me ;-)
- Follow this set of instructions
Here is the issue tracker.
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
phpunit --configuration tests/phpunit.xmlphpcs --standard=PSR2 lib
phpcs --standard=PSR2 tests



