transparent-email/src/TransparentEmailFactory.php

43 lines
1.1 KiB
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\AppsGoogleCom;
use bkrukowski\TransparentEmail\Services\GmailCom;
use bkrukowski\TransparentEmail\Services\OutlookCom;
use bkrukowski\TransparentEmail\Services\TlenPl;
use bkrukowski\TransparentEmail\Services\Www33MailCom;
use bkrukowski\TransparentEmail\Services\YahooCom;
class TransparentEmailFactory
2016-09-23 22:29:25 +03:00
{
public static function createDefault() : TransparentEmailInterface
2016-09-23 22:29:25 +03:00
{
return new TransparentEmail(self::createServiceCollector());
}
private static function createServiceCollector() : ServiceCollectorInterface
{
$collector = new ServiceCollector();
foreach (self::getAllServicesClasses() as $servicesClass) {
$collector->addService(new $servicesClass());
2016-09-23 22:29:25 +03:00
}
return $collector;
2016-09-23 22:29:25 +03:00
}
private static function getAllServicesClasses() : array
2016-09-23 22:29:25 +03:00
{
return [
GmailCom::class,
OutlookCom::class,
YahooCom::class,
Www33MailCom::class,
TlenPl::class,
AppsGoogleCom::class,
];
}
}