Completed
Push — master ( b31906...e560b1 )
by Théo
13:58
created

Decoration::getDecoration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the LaravelYaml package.
5
 *
6
 * (c) Théo FIDRY <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Fidry\LaravelYaml\DependencyInjection\Definition;
13
14
/**
15
 * @author Théo FIDRY <[email protected]>
16
 */
17
final class Decoration implements DecorationInterface
18
{
19
    /**
20
     * @var ServiceInterface
21
     */
22
    private $service;
23
24
    /**
25
     * @var array<string, string>
26
     */
27
    private $decoration;
28
29
    /**
30
     * @param ServiceInterface $service
31
     * @param string $decorates
32
     * @param string           $decorationInnerName
33
     */
34
    public function __construct(ServiceInterface $service, $decorates, $decorationInnerName = null)
35
    {
36
        $this->service = $service;
37
38
        if (null === $decorationInnerName) {
39
            $decorationInnerName = sprintf('%s.inner', $decorates);
40
        }
41
        $this->decoration = [$decorates, $decorationInnerName];
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getName()
48
    {
49
        return $this->getDecoration()[0];
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function getClass()
56
    {
57
        return $this->service->getClass();
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function getArguments()
64
    {
65
        return $this->service->getArguments();
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function getAutowiringTypes()
72
    {
73
        return $this->service->getAutowiringTypes();
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79
    public function getTags()
80
    {
81
        return $this->service->getTags();
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     */
87
    public function getDecoration()
88
    {
89
        return $this->decoration;
90
    }
91
}
92