EmailBuilderFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 19
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
1
<?php
2
declare(strict_types=1);
3
4
namespace AcMailer\Model;
5
6
use AcMailer\Exception\ServiceNotCreatedException;
7
use Psr\Container\ContainerExceptionInterface;
8
use Psr\Container\ContainerInterface;
9
use Psr\Container\NotFoundExceptionInterface;
10
11
class EmailBuilderFactory
12
{
13
    /**
14
     * @param ContainerInterface $container
15
     * @return EmailBuilder
16
     * @throws ServiceNotCreatedException
17
     * @throws ContainerExceptionInterface
18
     * @throws NotFoundExceptionInterface
19
     */
20
    public function __invoke(ContainerInterface $container)
21
    {
22
        if (! $container->has('config')) {
23
            throw new ServiceNotCreatedException('Cannot find a config array in the container');
24
        }
25
        $config = $container->get('config');
26
27
        return new EmailBuilder($config['acmailer_options']['emails'] ?? []);
28
    }
29
}
30