2016-09-23 22:29:25 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace bkrukowski\TransparentEmail;
|
|
|
|
|
|
|
|
use bkrukowski\TransparentEmail\Services\AppsGoogleCom;
|
|
|
|
use bkrukowski\TransparentEmail\Services\GmailCom;
|
2020-02-17 17:00:23 +03:00
|
|
|
use bkrukowski\TransparentEmail\Services\MailRu;
|
2016-09-23 22:29:25 +03:00
|
|
|
use bkrukowski\TransparentEmail\Services\OutlookCom;
|
|
|
|
use bkrukowski\TransparentEmail\Services\TlenPl;
|
|
|
|
use bkrukowski\TransparentEmail\Services\Www33MailCom;
|
|
|
|
use bkrukowski\TransparentEmail\Services\YahooCom;
|
2020-02-14 12:31:31 +03:00
|
|
|
use bkrukowski\TransparentEmail\Services\YandexRu;
|
2016-09-23 22:29:25 +03:00
|
|
|
|
2016-10-14 21:19:38 +03:00
|
|
|
class TransparentEmailFactory
|
2016-09-23 22:29:25 +03:00
|
|
|
{
|
2016-10-26 21:13:11 +03:00
|
|
|
public function createDefault() : TransparentEmailInterface
|
2016-09-23 22:29:25 +03:00
|
|
|
{
|
2016-10-26 21:13:11 +03:00
|
|
|
return new TransparentEmail($this->createServiceCollector());
|
2016-10-14 21:19:38 +03:00
|
|
|
}
|
|
|
|
|
2016-10-26 21:13:11 +03:00
|
|
|
private function createServiceCollector() : ServiceCollectorInterface
|
2016-10-14 21:19:38 +03:00
|
|
|
{
|
|
|
|
$collector = new ServiceCollector();
|
|
|
|
|
2016-10-26 21:13:11 +03:00
|
|
|
foreach ($this->getAllServicesClasses() as $servicesClass) {
|
2016-10-14 21:19:38 +03:00
|
|
|
$collector->addService(new $servicesClass());
|
2016-09-23 22:29:25 +03:00
|
|
|
}
|
2016-10-14 21:19:38 +03:00
|
|
|
|
|
|
|
return $collector;
|
2016-09-23 22:29:25 +03:00
|
|
|
}
|
|
|
|
|
2016-10-26 21:13:11 +03:00
|
|
|
private function getAllServicesClasses() : array
|
2016-09-23 22:29:25 +03:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
GmailCom::class,
|
|
|
|
OutlookCom::class,
|
|
|
|
YahooCom::class,
|
|
|
|
Www33MailCom::class,
|
|
|
|
TlenPl::class,
|
|
|
|
AppsGoogleCom::class,
|
2020-02-14 12:31:31 +03:00
|
|
|
YandexRu::class,
|
2020-02-17 17:00:23 +03:00
|
|
|
MailRu::class,
|
2016-09-23 22:29:25 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|