Skip to content

Commit e1cb047

Browse files
committed
fix: Add more missing override methods
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent c02aafb commit e1cb047

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

lib/AppConfigOverwrite.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,32 @@ public function getValueBool(string $app, string $key, bool $default = false, bo
4848

4949
return parent::getValueBool($app, $key, $default, $lazy);
5050
}
51+
52+
#[\Override]
53+
public function getValueInt(string $app, string $key, int $default = 0, bool $lazy = false): int {
54+
if (isset($this->overWrite[$app]) && isset($this->overWrite[$app][$key])) {
55+
return (int)$this->overWrite[$app][$key];
56+
}
57+
58+
return parent::getValueInt($app, $key, $default, $lazy);
59+
}
60+
61+
#[\Override]
62+
public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float {
63+
if (isset($this->overWrite[$app]) && isset($this->overWrite[$app][$key])) {
64+
return (float)$this->overWrite[$app][$key];
65+
}
66+
67+
return parent::getValueFloat($app, $key, $default, $lazy);
68+
}
69+
70+
#[\Override]
71+
public function getValueArray(string $app, string $key, array $default = [], bool $lazy = false): array {
72+
if (isset($this->overWrite[$app]) && isset($this->overWrite[$app][$key])) {
73+
$value = json_decode($this->overWrite[$app][$key], true);
74+
return is_array($value) ? $value : $default;
75+
}
76+
77+
return parent::getValueArray($app, $key, $default, $lazy);
78+
}
5179
}

tests/stub.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ public function getValueString(string $app, string $key, string $default = '', b
139139

140140
public function getValueBool(string $app, string $key, bool $default = false, bool $lazy = false): bool {
141141
}
142+
143+
public function getValueInt(string $app, string $key, int $default = 0, bool $lazy = false): int {
144+
}
145+
146+
public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float {
147+
}
148+
149+
public function getValueArray(string $app, string $key, array $default = [], bool $lazy = false): array {
150+
}
142151
}
143152
}
144153

0 commit comments

Comments
 (0)