2017 © Pedro Peláez
 

library specification

An implementation of the Specification design pattern

image

kanel/specification

An implementation of the Specification design pattern

  • Thursday, July 13, 2017
  • by elkaadka
  • Repository
  • 0 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

build, (*1)

Specification design pattern

Implementation of the "Specification" design pattern., (*2)

The Goal of this pattern is to have separate classes of logic in order to do condition composition without rewriting and maintaining the conditions at different places., (*3)

How to

All the classes should extend Kanel/Specification (abstract class), (*4)

$isAvailable = new isProductAvailable(); 
$isShippable = new isProductShippable();
$isOnSale = new isProductOnSale();

Then perform a composition of specification, (*5)

$specification = $isAvailable->and($isOnSale)->xor($isShippable);

if ($specification->isSatisfiedBy($product)) {

}

Available operators :

  • and
  • or
  • xor
  • not

If you look for another implementation of the specification design pattern look at kanel/specifications2, (*6)

The Versions

13/07 2017

dev-master

9999999-dev

An implementation of the Specification design pattern

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Adil El Kanabi

13/07 2017

1.0.0

1.0.0.0

An implementation of the Specification design pattern

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

by Adil El Kanabi