<?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;
  }
}
