mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-11 01:14:01 +02:00
start a restructure
This commit is contained in:
34
Behavioral/Specification/Not.php
Normal file
34
Behavioral/Specification/Not.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace DesignPatterns\Specification;
|
||||
|
||||
/**
|
||||
* A logical Not specification
|
||||
*/
|
||||
class Not extends AbstractSpecification
|
||||
{
|
||||
|
||||
protected $spec;
|
||||
|
||||
/**
|
||||
* Creates a new specification wrapping another
|
||||
*
|
||||
* @param SpecificationInterface $spec
|
||||
|
||||
*/
|
||||
public function __construct(SpecificationInterface $spec)
|
||||
{
|
||||
$this->spec = $spec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the negated result of the wrapped specification
|
||||
*
|
||||
* @param Item $item
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSatisfiedBy(Item $item)
|
||||
{
|
||||
return !$this->spec->isSatisfiedBy($item);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user