transparent-email/src/ServiceCollector.php

28 lines
524 B
PHP
Raw Normal View History

2016-09-23 22:29:25 +03:00
<?php
declare(strict_types=1);
namespace bkrukowski\TransparentEmail;
use bkrukowski\TransparentEmail\Services\ServiceInterface;
class ServiceCollector implements ServiceCollectorInterface
{
private $services = [];
2024-01-22 17:05:11 +03:00
public function addService(ServiceInterface $service): void
2016-09-23 22:29:25 +03:00
{
$this->services[] = $service;
}
/**
2024-01-22 17:05:11 +03:00
* {@inheritdoc}
2016-09-23 22:29:25 +03:00
*/
2024-01-22 17:05:11 +03:00
public function getIterator(): \Traversable
2016-09-23 22:29:25 +03:00
{
foreach ($this->services as $service) {
yield $service;
}
}
2024-01-22 17:05:11 +03:00
}