Files
php-flasher/Filter/Specification/OrSpecification.php
T

38 lines
801 B
PHP

<?php
namespace Flasher\Prime\Filter\Specification;
use Flasher\Prime\Envelope;
final class OrSpecification implements SpecificationInterface
{
/**
* @var SpecificationInterface[]
*/
private $specifications;
/**
* @param array|mixed ...$specifications
*/
public function __construct($specifications = array())
{
$specifications = is_array($specifications) ? $specifications : func_get_args();
$this->specifications = $specifications;
}
/**
* @inheritDoc
*/
public function isSatisfiedBy(Envelope $envelope)
{
foreach ($this->specifications as $specification) {
if ($specification->isSatisfiedBy($envelope)) {
return true;
}
}
return false;
}
}