51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Enum;
|
|
|
|
enum CardBus: string {
|
|
case PCIE_10_16 = 'PCIe 1.0 x16';
|
|
case PCIE_11_16 = 'PCIe 1.1 x16';
|
|
case PCIE_20_16 = 'PCIe 2.0 x16';
|
|
case PCIE_30_8 = 'PCIe 3.0 x8';
|
|
case PCIE_30_16 = 'PCIe 3.0 x16';
|
|
case PCIE_40_4 = 'PCIe 4.0 x4';
|
|
case PCIE_40_8 = 'PCIe 4.0 x8';
|
|
case PCIE_40_16 = 'PCIe 4.0 x16';
|
|
|
|
case PCI_33 = 'PCI 33';
|
|
case PCI_33V_33 = '3.3V PCI 33';
|
|
|
|
case AGP_1X = 'AGP 1x';
|
|
case AGP_2X = 'AGP 2x';
|
|
case AGP_4X = 'AGP 4x';
|
|
case AGP_8X = 'AGP 8x';
|
|
|
|
case ISA_8 = '8-bit ISA';
|
|
case ISA_16 = '16-bit ISA';
|
|
case ISA_VLB = 'VLB';
|
|
|
|
public static function getGroups(): array
|
|
{
|
|
$filter = static fn (string $starts_with) =>
|
|
array_filter(self::cases(), fn (CardBus $case) =>
|
|
str_starts_with($case->name, $starts_with)
|
|
);
|
|
|
|
$pcie = $filter('PCIE_');
|
|
$agp = $filter('AGP_');
|
|
$pci = $filter('PCI_');
|
|
$isa = $filter('ISA_');
|
|
|
|
$pcie16 = array_filter($pcie, fn (CardBus $case) => str_ends_with($case->name, '_16'));
|
|
$pcieOther = array_udiff($pcie, $pcie16, fn ($a, $b) => $a->name <=> $b->name);
|
|
|
|
return [
|
|
'PCI Express x16' => $pcie16,
|
|
'PCI Express Other' => $pcieOther,
|
|
'AGP' => $agp,
|
|
'PCI' => $pci,
|
|
'ISA' => $isa,
|
|
];
|
|
}
|
|
}
|