You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
38 lines
801 B
PHP
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;
|
|
}
|
|
}
|