|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Stu\Module\Config\Model; |
|
4
|
|
|
|
|
5
|
|
|
use Override; |
|
|
|
|
|
|
6
|
|
|
use Noodlehaus\ConfigInterface; |
|
7
|
|
|
use Stu\Module\Config\StuConfigSettingEnum; |
|
8
|
|
|
|
|
9
|
|
|
class SettingsFactory implements SettingsFactoryInterface |
|
10
|
|
|
{ |
|
11
|
2 |
|
public function __construct(private ConfigInterface $config) {} |
|
12
|
|
|
|
|
13
|
4 |
|
#[Override] |
|
14
|
|
|
public function createSettings( |
|
15
|
|
|
StuConfigSettingEnum $type, |
|
16
|
|
|
?SettingsInterface $parent, |
|
17
|
|
|
SettingsCacheInterface $settingsCache |
|
18
|
|
|
): SettingsInterface { |
|
19
|
|
|
return match ($type) { |
|
20
|
4 |
|
StuConfigSettingEnum::ADMIN => new AdminSettings( |
|
21
|
4 |
|
$parent, |
|
22
|
4 |
|
$this->createSettingsCore($type, $parent), |
|
23
|
4 |
|
$settingsCache |
|
24
|
4 |
|
), |
|
25
|
4 |
|
StuConfigSettingEnum::CACHE => new CacheSettings( |
|
26
|
4 |
|
$parent, |
|
27
|
4 |
|
$this->createSettingsCore($type, $parent), |
|
28
|
4 |
|
$settingsCache |
|
29
|
4 |
|
), |
|
30
|
4 |
|
StuConfigSettingEnum::COLONY => new ColonySettings( |
|
31
|
4 |
|
$parent, |
|
32
|
4 |
|
$this->createSettingsCore($type, $parent), |
|
33
|
4 |
|
$settingsCache |
|
34
|
4 |
|
), |
|
35
|
3 |
|
StuConfigSettingEnum::DB => new DbSettings( |
|
36
|
3 |
|
$parent, |
|
37
|
3 |
|
$this->createSettingsCore($type, $parent), |
|
38
|
3 |
|
$settingsCache |
|
39
|
3 |
|
), |
|
40
|
3 |
|
StuConfigSettingEnum::DEBUG => new DebugSettings( |
|
41
|
3 |
|
$parent, |
|
42
|
3 |
|
$this->createSettingsCore($type, $parent), |
|
43
|
3 |
|
$settingsCache |
|
44
|
3 |
|
), |
|
45
|
3 |
|
StuConfigSettingEnum::LOGGING => new LoggingSettings( |
|
46
|
3 |
|
$parent, |
|
47
|
3 |
|
$this->createSettingsCore($type, $parent), |
|
48
|
3 |
|
$settingsCache |
|
49
|
3 |
|
), |
|
50
|
3 |
|
StuConfigSettingEnum::GAME => new GameSettings( |
|
51
|
3 |
|
$parent, |
|
52
|
3 |
|
$this->createSettingsCore($type, $parent), |
|
53
|
3 |
|
$settingsCache |
|
54
|
3 |
|
), |
|
55
|
3 |
|
StuConfigSettingEnum::MAP => new MapSettings( |
|
56
|
3 |
|
$parent, |
|
57
|
3 |
|
$this->createSettingsCore($type, $parent), |
|
58
|
3 |
|
$settingsCache |
|
59
|
3 |
|
), |
|
60
|
2 |
|
StuConfigSettingEnum::RESET => new ResetSettings( |
|
61
|
2 |
|
$parent, |
|
62
|
2 |
|
$this->createSettingsCore($type, $parent), |
|
63
|
2 |
|
$settingsCache |
|
64
|
2 |
|
), |
|
65
|
2 |
|
StuConfigSettingEnum::SQL_LOGGING => new SqlLoggingSettings( |
|
66
|
2 |
|
$parent, |
|
67
|
2 |
|
$this->createSettingsCore($type, $parent), |
|
68
|
2 |
|
$settingsCache |
|
69
|
2 |
|
), |
|
70
|
2 |
|
StuConfigSettingEnum::EMAIL => new EmailSettings( |
|
71
|
2 |
|
$parent, |
|
72
|
2 |
|
$this->createSettingsCore($type, $parent), |
|
73
|
2 |
|
$settingsCache |
|
74
|
2 |
|
), |
|
75
|
|
|
StuConfigSettingEnum::PIRATES => new PirateSettings( |
|
76
|
|
|
$parent, |
|
77
|
|
|
$this->createSettingsCore($type, $parent), |
|
78
|
|
|
$settingsCache |
|
79
|
|
|
), |
|
80
|
4 |
|
StuConfigSettingEnum::SECURITY => new SecuritySettings( |
|
81
|
4 |
|
$parent, |
|
82
|
4 |
|
$this->createSettingsCore($type, $parent), |
|
83
|
4 |
|
$settingsCache |
|
84
|
4 |
|
) |
|
85
|
|
|
}; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
4 |
|
private function createSettingsCore(StuConfigSettingEnum $type, ?SettingsInterface $parent): SettingsCoreInterface |
|
89
|
|
|
{ |
|
90
|
4 |
|
return new SettingsCore( |
|
91
|
4 |
|
$parent, |
|
92
|
4 |
|
$type->getConfigPath(), |
|
93
|
4 |
|
$this->config |
|
94
|
4 |
|
); |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths