Skip to content

Repository files navigation

Koine Decorator

Simple decorator base class for PHP.

Code information:

Build StatusCoverage StatusCode ClimateScrutinizer Code Quality

Package information:

Latest Stable VersionTotal DownloadsLatest Unstable VersionLicenseDependency Status

Usage

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.99

Installing

Via Composer

Append the lib to your requirements key in your composer.json.

{// composer.json// [..]require: {// append this line to your requirements"koine/decorator": "dev-master"}}

Alternative install

Issues/Features proposals

Here is the issue tracker.

Contributing

Only TDD code will be accepted. Please follow the PSR-2 code standard.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. 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

Lincense

MIT

Authors

About

Simple decorator base Class for PHP objects

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages