Completed
Push — master ( d6a739...5c77d4 )
by Théo
14:58 queued 12:36
created

Decoration::getDecorates()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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 string
26
     */
27
    private $decorates;
28
29
    /**
30
     * @var string
31
     */
32
    private $decorationInnerName;
33
34
    /**
35
     * @param ServiceInterface $service
36
     * @param string $decorates
37
     * @param string           $decorationInnerName
38
     */
39 6
    public function __construct(ServiceInterface $service, $decorates, $decorationInnerName = null)
40
    {
41 6
        $this->service = $service;
42 6
        $this->decorates = $decorates;
43 6
        $this->decorationInnerName = (null === $decorationInnerName) ?
44 4
            sprintf('%s.inner', $service->getName())
45 3
            : $decorationInnerName
46
        ;
47 6
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 6
    public function getName()
53
    {
54 6
        return $this->service->getName();
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60 6
    public function getClass()
61
    {
62 6
        return $this->service->getClass();
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68 6
    public function getArguments()
69
    {
70 6
        return $this->service->getArguments();
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76 6
    public function getAutowiringTypes()
77
    {
78 6
        return $this->service->getAutowiringTypes();
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84 6
    public function getTags()
85
    {
86 6
        return $this->service->getTags();
87
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92 6
    public function getDecorates()
93
    {
94 6
        return $this->decorates;
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100 6
    public function getDecorationInnerName()
101
    {
102 6
        return $this->decorationInnerName;
103
    }
104
}
105