Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Tests Adapt Unit Tests code to PHPUnit 6 Mar 8, 2017
uml #352 re-generated outdated assets for Specification Jan 10, 2019
AndSpecification.php Specification pattern - performance optimization Apr 12, 2017
Item.php
NotSpecification.php PHP7 Specification Sep 22, 2016
OrSpecification.php Specification pattern - performance optimization Apr 12, 2017
PriceSpecification.php
README.rst
SpecificationInterface.php PHP7 Specification Sep 22, 2016

README.rst

Specification

Purpose

Builds a clear specification of business rules, where objects can be checked against. The composite specification class has one method called isSatisfiedBy that returns either true or false depending on whether the given object satisfies the specification.

Examples

UML Diagram

Alt Specification UML Diagram

Code

You can also find this code on GitHub

Item.php

.. literalinclude:: Item.php
   :language: php
   :linenos:

SpecificationInterface.php

.. literalinclude:: SpecificationInterface.php
   :language: php
   :linenos:

OrSpecification.php

.. literalinclude:: OrSpecification.php
   :language: php
   :linenos:

PriceSpecification.php

.. literalinclude:: PriceSpecification.php
   :language: php
   :linenos:

AndSpecification.php

.. literalinclude:: AndSpecification.php
   :language: php
   :linenos:

NotSpecification.php

.. literalinclude:: NotSpecification.php
   :language: php
   :linenos:

Test

Tests/SpecificationTest.php

.. literalinclude:: Tests/SpecificationTest.php
   :language: php
   :linenos: