rikbruil / specification
A PHP implementation of the Specification-pattern
Installs: 224 694
Dependents: 1
Suggesters: 0
Security: 0
Stars: 18
Watchers: 4
Forks: 3
Open Issues: 0
Requires
- php: >=5.3.3
Requires (Dev)
- fabpot/php-cs-fixer: ~1.5
- henrikbjorn/phpspec-code-coverage: ~1.0
- phpspec/phpspec: ~2.1@dev
- satooshi/php-coveralls: ~0.6
This package is not auto-updated.
Last update: 2024-12-21 19:00:17 UTC
README
PHP implementation of the Specification pattern
Usage
$overDue = new OverDueSpecification(); $noticeSent = new NoticeSentSpecification(); $inCollection = new InCollectionSpecification(); // example of specification pattern logic chaining $sendToCollection = $overDue->andX($noticeSent) ->not($inCollection); foreach ($service->getInvoices() as $currentInvoice) { if (! $sendToCollection->isSatisfiedBy($currentInvoice)) { continue; } $currentInvoice->sendToCollection(); }
Requirements
- PHP 5.3+
License
Specification is licensed under the MIT License - see the LICENSE
file for details