1 | <?php declare(strict_types=1); |
||
8 | class Definition implements DefinitionInterface |
||
9 | { |
||
10 | use HasPropertiesTrait; |
||
11 | use HasCallsTrait; |
||
12 | |||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $class; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $arguments = []; |
||
22 | |||
23 | /** |
||
24 | * @var string[] |
||
25 | */ |
||
26 | protected $aliases = []; |
||
27 | |||
28 | /** |
||
29 | * @var string|null |
||
30 | */ |
||
31 | protected $constructMethod; |
||
32 | |||
33 | /** |
||
34 | * @var string|callable|null|array |
||
35 | */ |
||
36 | protected $factory; |
||
37 | |||
38 | /** |
||
39 | * @var bool |
||
40 | */ |
||
41 | protected $shared = true; |
||
42 | |||
43 | 73 | public function __construct(string $class) |
|
47 | |||
48 | /** |
||
49 | * @return string |
||
50 | */ |
||
51 | 43 | public function getClass(): string |
|
55 | |||
56 | /** |
||
57 | * @return array |
||
58 | */ |
||
59 | 37 | public function getArguments(): array |
|
63 | |||
64 | /** |
||
65 | * @param array $arguments |
||
66 | * @return Definition |
||
67 | */ |
||
68 | 14 | public function setArguments(array $arguments): Definition |
|
69 | { |
||
70 | 14 | $this->arguments = $arguments; |
|
71 | 14 | return $this; |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @return string[] |
||
76 | */ |
||
77 | 23 | public function getAliases(): array |
|
81 | |||
82 | /** |
||
83 | * @param string[] $aliases |
||
84 | * @return self |
||
85 | */ |
||
86 | 5 | public function addAliases(array $aliases): self |
|
93 | /** |
||
94 | * @param string $alias |
||
95 | * @return self |
||
96 | */ |
||
97 | 6 | public function addAlias(string $alias): self |
|
102 | |||
103 | /** |
||
104 | * @return string|null |
||
105 | */ |
||
106 | 34 | public function getConstructMethod(): ?string |
|
110 | |||
111 | /** |
||
112 | * @param string|null $constructMethod |
||
113 | */ |
||
114 | 6 | public function setConstructMethod(?string $constructMethod): void |
|
118 | |||
119 | /** |
||
120 | * @return callable|string|null|array |
||
121 | */ |
||
122 | 41 | public function getFactory() |
|
126 | |||
127 | /** |
||
128 | * @param callable|string|null|array $factory |
||
129 | */ |
||
130 | 13 | public function setFactory($factory): void |
|
134 | |||
135 | /** |
||
136 | * @return bool |
||
137 | */ |
||
138 | 10 | public function isShared(): bool |
|
142 | |||
143 | /** |
||
144 | * @param bool $shared |
||
145 | * @return Definition |
||
146 | */ |
||
147 | 4 | public function setShared(bool $shared = true): self |
|
152 | } |
||
153 |