| Total Complexity | 4 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class Pipeline implements PipelineInterface |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var SplObjectStorage |
||
| 20 | */ |
||
| 21 | private $storage; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var ProcessorInterface |
||
| 25 | */ |
||
| 26 | private $processor; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Pipeline constructor. |
||
| 30 | * |
||
| 31 | * @param ProcessorInterface $processor |
||
| 32 | */ |
||
| 33 | 48 | public function __construct(ProcessorInterface $processor = null) |
|
| 34 | { |
||
| 35 | 48 | $this->storage = new SplObjectStorage(); |
|
| 36 | 48 | $this->processor = $processor ?? new Processor(); |
|
| 37 | 48 | } |
|
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritdoc} |
||
| 41 | */ |
||
| 42 | 12 | public function pipe(TaskInterface $task): PipelineInterface |
|
| 43 | { |
||
| 44 | 12 | $this->storage->attach($task); |
|
| 45 | |||
| 46 | 12 | return $this; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * {@inheritdoc} |
||
| 51 | */ |
||
| 52 | 12 | public function process(WebDriver $driver): array |
|
| 61 | } |
||
| 62 | } |
||
| 63 |