mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-06 23:16:33 +02:00
Applied fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
3663603b80
commit
fe1f144ec3
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
/**
|
||||
* An abstract specification allows the creation of wrapped specifications
|
||||
* An abstract specification allows the creation of wrapped specifications.
|
||||
*/
|
||||
abstract class AbstractSpecification implements SpecificationInterface
|
||||
{
|
||||
/**
|
||||
* Checks if given item meets all criteria
|
||||
* Checks if given item meets all criteria.
|
||||
*
|
||||
* @param Item $item
|
||||
*
|
||||
@@ -16,7 +17,7 @@ abstract class AbstractSpecification implements SpecificationInterface
|
||||
abstract public function isSatisfiedBy(Item $item);
|
||||
|
||||
/**
|
||||
* Creates a new logical AND specification
|
||||
* Creates a new logical AND specification.
|
||||
*
|
||||
* @param SpecificationInterface $spec
|
||||
*
|
||||
@@ -28,7 +29,7 @@ abstract class AbstractSpecification implements SpecificationInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new logical OR composite specification
|
||||
* Creates a new logical OR composite specification.
|
||||
*
|
||||
* @param SpecificationInterface $spec
|
||||
*
|
||||
@@ -40,7 +41,7 @@ abstract class AbstractSpecification implements SpecificationInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new logical NOT specification
|
||||
* Creates a new logical NOT specification.
|
||||
*
|
||||
* @return SpecificationInterface
|
||||
*/
|
||||
|
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
/**
|
||||
* A logical OR specification
|
||||
* A logical OR specification.
|
||||
*/
|
||||
class Either extends AbstractSpecification
|
||||
{
|
||||
|
||||
protected $left;
|
||||
protected $right;
|
||||
|
||||
/**
|
||||
* A composite wrapper of two specifications
|
||||
* A composite wrapper of two specifications.
|
||||
*
|
||||
* @param SpecificationInterface $left
|
||||
* @param SpecificationInterface $right
|
||||
@@ -23,7 +23,7 @@ class Either extends AbstractSpecification
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the evaluation of both wrapped specifications as a logical OR
|
||||
* Returns the evaluation of both wrapped specifications as a logical OR.
|
||||
*
|
||||
* @param Item $item
|
||||
*
|
||||
|
@@ -1,15 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
/**
|
||||
* An trivial item
|
||||
* An trivial item.
|
||||
*/
|
||||
class Item
|
||||
{
|
||||
protected $price;
|
||||
|
||||
/**
|
||||
* An item must have a price
|
||||
* An item must have a price.
|
||||
*
|
||||
* @param int $price
|
||||
*/
|
||||
@@ -19,7 +20,7 @@ class Item
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the items price
|
||||
* Get the items price.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
/**
|
||||
* A logical Not specification
|
||||
* A logical Not specification.
|
||||
*/
|
||||
class Not extends AbstractSpecification
|
||||
{
|
||||
|
||||
protected $spec;
|
||||
|
||||
/**
|
||||
* Creates a new specification wrapping another
|
||||
* Creates a new specification wrapping another.
|
||||
*
|
||||
* @param SpecificationInterface $spec
|
||||
*/
|
||||
@@ -20,7 +20,7 @@ class Not extends AbstractSpecification
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the negated result of the wrapped specification
|
||||
* Returns the negated result of the wrapped specification.
|
||||
*
|
||||
* @param Item $item
|
||||
*
|
||||
|
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
/**
|
||||
* A logical AND specification
|
||||
* A logical AND specification.
|
||||
*/
|
||||
class Plus extends AbstractSpecification
|
||||
{
|
||||
|
||||
protected $left;
|
||||
protected $right;
|
||||
|
||||
/**
|
||||
* Creation of a logical AND of two specifications
|
||||
* Creation of a logical AND of two specifications.
|
||||
*
|
||||
* @param SpecificationInterface $left
|
||||
* @param SpecificationInterface $right
|
||||
@@ -23,7 +23,7 @@ class Plus extends AbstractSpecification
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the composite AND of specifications passes
|
||||
* Checks if the composite AND of specifications passes.
|
||||
*
|
||||
* @param Item $item
|
||||
*
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
/**
|
||||
* A specification to check an Item is priced between min and max
|
||||
* A specification to check an Item is priced between min and max.
|
||||
*/
|
||||
class PriceSpecification extends AbstractSpecification
|
||||
{
|
||||
@@ -10,7 +11,7 @@ class PriceSpecification extends AbstractSpecification
|
||||
protected $minPrice;
|
||||
|
||||
/**
|
||||
* Sets the optional maximum price
|
||||
* Sets the optional maximum price.
|
||||
*
|
||||
* @param int $maxPrice
|
||||
*/
|
||||
@@ -20,7 +21,7 @@ class PriceSpecification extends AbstractSpecification
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the optional minimum price
|
||||
* Sets the optional minimum price.
|
||||
*
|
||||
* @param int $minPrice
|
||||
*/
|
||||
@@ -30,7 +31,7 @@ class PriceSpecification extends AbstractSpecification
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Item price falls between bounds
|
||||
* Checks if Item price falls between bounds.
|
||||
*
|
||||
* @param Item $item
|
||||
*
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\Specification;
|
||||
|
||||
/**
|
||||
* An interface for a specification
|
||||
* An interface for a specification.
|
||||
*/
|
||||
interface SpecificationInterface
|
||||
{
|
||||
/**
|
||||
* A boolean evaluation indicating if the object meets the specification
|
||||
* A boolean evaluation indicating if the object meets the specification.
|
||||
*
|
||||
* @param Item $item
|
||||
*
|
||||
@@ -16,21 +17,21 @@ interface SpecificationInterface
|
||||
public function isSatisfiedBy(Item $item);
|
||||
|
||||
/**
|
||||
* Creates a logical AND specification
|
||||
* Creates a logical AND specification.
|
||||
*
|
||||
* @param SpecificationInterface $spec
|
||||
*/
|
||||
public function plus(SpecificationInterface $spec);
|
||||
|
||||
/**
|
||||
* Creates a logical OR specification
|
||||
* Creates a logical OR specification.
|
||||
*
|
||||
* @param SpecificationInterface $spec
|
||||
*/
|
||||
public function either(SpecificationInterface $spec);
|
||||
|
||||
/**
|
||||
* Creates a logical not specification
|
||||
* Creates a logical not specification.
|
||||
*/
|
||||
public function not();
|
||||
}
|
||||
|
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace DesignPatterns\Behavioral\Specification\Tests;
|
||||
|
||||
use DesignPatterns\Behavioral\Specification\PriceSpecification;
|
||||
use DesignPatterns\Behavioral\Specification\Item;
|
||||
use DesignPatterns\Behavioral\Specification\PriceSpecification;
|
||||
|
||||
/**
|
||||
* SpecificationTest tests the specification pattern
|
||||
* SpecificationTest tests the specification pattern.
|
||||
*/
|
||||
class SpecificationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
Reference in New Issue
Block a user