AliasFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of coisa/error-handler.
5
 *
6
 * (c) Felipe Sayão Lobato Abreu <[email protected]>
7
 *
8
 * This source file is subject to the license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
declare(strict_types=1);
13
14
namespace CoiSA\ErrorHandler\Container\Factory;
15
16
use Psr\Container\ContainerInterface;
17
18
/**
19
 * Class AliasFactory
20
 *
21
 * @package CoiSA\ErrorHandler\Container\Factory
22
 */
23
final class AliasFactory
24
{
25
    /**
26
     * @var string
27
     */
28
    private $alias;
29
30
    /**
31
     * AliasFactory constructor.
32
     *
33
     * @param string $alias
34
     */
35 9
    public function __construct(string $alias)
36
    {
37 9
        $this->alias = $alias;
38 9
    }
39
40
    /**
41
     * @param ContainerInterface $container
42
     *
43
     * @return mixed
44
     */
45 9
    public function __invoke(ContainerInterface $container)
46
    {
47 9
        return $container->get($this->alias);
48
    }
49
}
50