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