start a restructure

This commit is contained in:
Antonio Spinelli
2014-03-21 18:03:44 -03:00
parent b0b0d4a1a4
commit e59d70a0ac
180 changed files with 21 additions and 16 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace DesignPatterns\Specification;
/**
* An abstract specification allows the creation of wrapped specifications
*/
abstract class AbstractSpecification implements SpecificationInterface
{
/**
* Checks if given item meets all criteria
*
* @param Item $item
*
* @return bool
*/
abstract public function isSatisfiedBy(Item $item);
/**
* Creates a new logical AND specification
*
* @param SpecificationInterface $spec
*
* @return SpecificationInterface
*/
public function plus(SpecificationInterface $spec)
{
return new Plus($this, $spec);
}
/**
* Creates a new logical OR composite specification
*
* @param SpecificationInterface $spec
*
* @return SpecificationInterface
*/
public function either(SpecificationInterface $spec)
{
return new Either($this, $spec);
}
/**
* Creates a new logical NOT specification
*
* @return SpecificationInterface
*/
public function not()
{
return new Not($this);
}
}