Passed
Push — master ( 240c83...03f39b )
by Mathias
06:41
created

ForwardFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
eloc 6
dl 0
loc 13
rs 10
c 1
b 1
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 2
1
<?php
2
3
/**
4
 * YAWIK
5
 *
6
 * @see       https://github.com/cross-solution/YAWIK for the canonical source repository
7
 * @copyright https://github.com/cross-solution/YAWIK/blob/master/COPYRIGHT
8
 * @license   https://github.com/cross-solution/YAWIK/blob/master/LICENSE
9
 */
10
11
declare(strict_types=1);
12
13
namespace Applications\Factory\Mail;
14
15
use Applications\Entity\Attachment;
16
use Applications\Mail\ApplicationCarbonCopy;
17
use Applications\Mail\Forward;
18
use Psr\Container\ContainerInterface;
19
20
/**
21
 * Factory for \Applications\Mail\Forward
22
 *
23
 * @author Mathias Gelhausen
24
 */
25
class ForwardFactory
26
{
27
    public function __invoke(
28
        ContainerInterface $container,
29
        string $requestedName,
30
        ?array $options = null
31
    ): Forward {
32
        $class = strpos($requestedName, 'Copy') === false ? Forward::class : ApplicationCarbonCopy::class;
33
34
        return new $class(
35
            $container->get('ViewHelperManager'),
36
            $container->get('repositories')->get(Attachment::class),
37
            $options
38
        );
39
    }
40
}
41