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

ForwardFactory::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 5
dl 0
loc 11
rs 10
c 1
b 1
f 0
cc 2
nc 2
nop 3
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