25 lines
460 B
PHP
25 lines
460 B
PHP
<?php
|
|
|
|
namespace App\Processors\Customer;
|
|
|
|
use App\Processor\Customer\ServiceInterface;
|
|
use App\Processors\Customer\ServiceContext;
|
|
|
|
class ServiceComposite implements ServiceInterface
|
|
{
|
|
private array $pipes;
|
|
|
|
public function __construct(array $pipes)
|
|
{
|
|
$this->pipes = $pipes;
|
|
}
|
|
|
|
public function process(ServiceContext $ctx): ServiceContext
|
|
{
|
|
foreach ($this->pipes as $pipe) {
|
|
$ctx = $pipe->process($ctx);
|
|
}
|
|
return $ctx;
|
|
}
|
|
}
|