AliasItem   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 9
c 1
b 0
f 0
dl 0
loc 38
ccs 13
cts 13
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 3 1
A __construct() 0 4 1
A unserialize() 0 3 1
A getAlias() 0 3 1
A getClassItem() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Borodulin\Container\Autowire\Item;
6
7
use Borodulin\Container\Autowire\AutowireItemInterface;
8
9
class AliasItem implements AutowireItemInterface
10
{
11
    /**
12
     * @var string
13
     */
14
    private $alias;
15
    /**
16
     * @var AutowireItemInterface|null
17
     */
18
    private $classItem;
19
20 15
    public function __construct(string $alias, AutowireItemInterface $classItem = null)
21
    {
22 15
        $this->alias = $alias;
23 15
        $this->classItem = $classItem;
24 15
    }
25
26 1
    public function serialize(): string
27
    {
28 1
        return serialize([$this->alias, $this->classItem]);
29
    }
30
31
    /**
32
     * @param string $serialized
33
     */
34 1
    public function unserialize($serialized): void
35
    {
36 1
        [$this->alias, $this->classItem] = unserialize($serialized);
37 1
    }
38
39 6
    public function getAlias(): string
40
    {
41 6
        return $this->alias;
42
    }
43
44 1
    public function getClassItem(): ?AutowireItemInterface
45
    {
46 1
        return $this->classItem;
47
    }
48
}
49