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
|
|
|
|