mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-15 14:16:28 +00:00
simplify the getCpuVendorInfo method
This commit is contained in:
1 parent
ea584902ec
commit
9c79e2bfbc
1 file changed
+7
-8
@@ -290,21 +290,21 @@ class ByHetzner extends Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 @@ class ByHetzner extends Component
|
|||||||
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;
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user