refactor
This commit is contained in:
@@ -32,18 +32,13 @@ class DataModel
|
||||
{
|
||||
$result = [];
|
||||
foreach ($this->data as $k => $v) {
|
||||
if ($this->searchByPrefix($prefix, $k)) {
|
||||
if (str_starts_with($k, $prefix)) {
|
||||
$result[str_replace($prefix, '', $k)] = $v;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function searchByPrefix(string $prefix, string $string): bool
|
||||
{
|
||||
return substr($string, 0, strlen($prefix)) === $prefix;
|
||||
}
|
||||
|
||||
public function getBonuses(): array
|
||||
{
|
||||
return $this->getPrefixed('add_');
|
||||
|
||||
Reference in New Issue
Block a user