Skip to content

Stratadox/Specification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Specification

Build Status Coverage Status Scrutinizer Code Quality

An implementation of the Specification pattern for Php7

Installation

Install using composer:

composer require stratadox/specification

Usage Sample

// The business logic
$allBoxes = CollectionOfBoxes::containing(
    Box::ofWeight(1),
    Box::ofWeight(2),
    Box::ofWeight(3),
    Box::ofWeight(5),
    Box::ofWeight(12),
    Box::ofWeight(26)
);
$weighBetween2and10 = AreHeavier::than(2)->and(AreLighter::than(10));
$this->assertEquals(
    CollectionOfBoxes::containing(
        Box::ofWeight(3),
        Box::ofWeight(5),
        Box::ofWeight(26)
    ),
    $allBoxes->that($weighBetween2and10->or(AreHeavier::than(20)))
);

About

Specification Pattern for Php7

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages