simplify the getCpuVendorInfo method
This commit is contained in:
parent
ea584902ec
commit
9c79e2bfbc
1 changed files with 7 additions and 8 deletions
|
|
@ -290,21 +290,21 @@ private function loadHetznerData(string $token)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCpuVendorInfo(array $serverType): array
|
private function getCpuVendorInfo(array $serverType): string|null
|
||||||
{
|
{
|
||||||
$name = strtolower($serverType['name'] ?? '');
|
$name = strtolower($serverType['name'] ?? '');
|
||||||
|
|
||||||
if (str_starts_with($name, 'ccx')) {
|
if (str_starts_with($name, 'ccx')) {
|
||||||
return ['vendor_info' => 'AMD Milan EPYC™'];
|
return 'AMD Milan EPYC™';
|
||||||
} elseif (str_starts_with($name, 'cpx')) {
|
} elseif (str_starts_with($name, 'cpx')) {
|
||||||
return ['vendor_info' => 'AMD EPYC™'];
|
return 'AMD EPYC™';
|
||||||
} elseif (str_starts_with($name, 'cx')) {
|
} elseif (str_starts_with($name, 'cx')) {
|
||||||
return ['vendor_info' => 'Intel® Xeon®'];
|
return 'Intel® Xeon®';
|
||||||
} elseif (str_starts_with($name, 'cax')) {
|
} elseif (str_starts_with($name, 'cax')) {
|
||||||
return ['vendor_info' => 'Ampere® Altra®'];
|
return 'Ampere® Altra®';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['vendor_info' => null];
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAvailableServerTypesProperty()
|
public function getAvailableServerTypesProperty()
|
||||||
|
|
@ -329,8 +329,7 @@ public function getAvailableServerTypesProperty()
|
||||||
return in_array($this->selected_location, $locationNames);
|
return in_array($this->selected_location, $locationNames);
|
||||||
})
|
})
|
||||||
->map(function ($serverType) {
|
->map(function ($serverType) {
|
||||||
$cpuInfo = $this->getCpuVendorInfo($serverType);
|
$serverType['cpu_vendor_info'] = $this->getCpuVendorInfo($serverType);
|
||||||
$serverType['cpu_vendor_info'] = $cpuInfo['vendor_info'];
|
|
||||||
|
|
||||||
return $serverType;
|
return $serverType;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue