1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Gacela\Framework\Bootstrap\Setup; |
6
|
|
|
|
7
|
|
|
use Closure; |
8
|
|
|
use Gacela\Framework\Config\GacelaConfigBuilder\AppConfigBuilder; |
9
|
|
|
use Gacela\Framework\Config\GacelaConfigBuilder\BindingsBuilder; |
10
|
|
|
use Gacela\Framework\Config\GacelaConfigBuilder\SuffixTypesBuilder; |
11
|
|
|
|
12
|
|
|
final class GacelaConfigTransfer |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @param ?array<string, class-string|object|callable> $externalServices |
|
|
|
|
16
|
|
|
* @param ?list<string> $projectNamespaces |
17
|
|
|
* @param ?array<string,mixed> $configKeyValues |
18
|
|
|
* @param ?list<callable> $genericListeners |
19
|
|
|
* @param ?array<class-string,list<callable>> $specificListeners |
20
|
|
|
* @param ?list<class-string> $gacelaConfigsToExtend |
21
|
|
|
* @param ?list<class-string|callable> $plugins |
22
|
|
|
* @param ?array<string,list<Closure>> $servicesToExtend |
23
|
|
|
*/ |
24
|
|
|
public function __construct( |
25
|
|
|
private AppConfigBuilder $appConfigBuilder, |
26
|
|
|
private SuffixTypesBuilder $suffixTypesBuilder, |
27
|
|
|
private BindingsBuilder $bindingsBuilder, |
28
|
|
|
private ?array $externalServices, |
29
|
|
|
private ?bool $shouldResetInMemoryCache, |
30
|
|
|
private ?bool $fileCacheEnabled, |
31
|
|
|
private ?string $fileCacheDirectory, |
32
|
|
|
private ?array $projectNamespaces, |
33
|
|
|
private ?array $configKeyValues, |
34
|
|
|
private ?array $genericListeners, |
35
|
|
|
private ?array $specificListeners, |
36
|
|
|
private ?bool $areEventListenersEnabled, |
37
|
|
|
private ?array $gacelaConfigsToExtend, |
38
|
|
|
private ?array $plugins, |
39
|
|
|
private ?array $servicesToExtend, |
40
|
|
|
) { |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function getAppConfigBuilder(): AppConfigBuilder |
44
|
|
|
{ |
45
|
|
|
return $this->appConfigBuilder; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getSuffixTypesBuilder(): SuffixTypesBuilder |
49
|
|
|
{ |
50
|
|
|
return $this->suffixTypesBuilder; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getBindingsBuilder(): BindingsBuilder |
54
|
|
|
{ |
55
|
|
|
return $this->bindingsBuilder; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return ?array<string, class-string|object|callable> |
|
|
|
|
60
|
|
|
*/ |
61
|
|
|
public function getExternalServices(): ?array |
62
|
|
|
{ |
63
|
|
|
return $this->externalServices; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function getShouldResetInMemoryCache(): ?bool |
67
|
|
|
{ |
68
|
|
|
return $this->shouldResetInMemoryCache; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function getFileCacheEnabled(): ?bool |
72
|
|
|
{ |
73
|
|
|
return $this->fileCacheEnabled; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function getFileCacheDirectory(): ?string |
77
|
|
|
{ |
78
|
|
|
return $this->fileCacheDirectory; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return ?list<string> |
83
|
|
|
*/ |
84
|
|
|
public function getProjectNamespaces(): ?array |
85
|
|
|
{ |
86
|
|
|
return $this->projectNamespaces; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return ?array<string,mixed> |
91
|
|
|
*/ |
92
|
|
|
public function getConfigKeyValues(): ?array |
93
|
|
|
{ |
94
|
|
|
return $this->configKeyValues; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function getAreEventListenersEnabled(): ?bool |
98
|
|
|
{ |
99
|
|
|
return $this->areEventListenersEnabled; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return ?list<callable> |
104
|
|
|
*/ |
105
|
|
|
public function getGenericListeners(): ?array |
106
|
|
|
{ |
107
|
|
|
return $this->genericListeners; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return ?array<class-string,list<callable>> |
112
|
|
|
*/ |
113
|
|
|
public function getSpecificListeners(): ?array |
114
|
|
|
{ |
115
|
|
|
return $this->specificListeners; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return ?list<class-string> |
120
|
|
|
*/ |
121
|
|
|
public function getGacelaConfigsToExtend(): ?array |
122
|
|
|
{ |
123
|
|
|
return $this->gacelaConfigsToExtend; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return ?list<class-string|callable> |
128
|
|
|
*/ |
129
|
|
|
public function getPlugins(): ?array |
130
|
|
|
{ |
131
|
|
|
return $this->plugins; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return ?array<string,list<Closure>> |
136
|
|
|
*/ |
137
|
|
|
public function getServicesToExtend(): ?array |
138
|
|
|
{ |
139
|
|
|
return $this->servicesToExtend; |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|