collection-crud/src/Enum/CardBus.php

100 lines
2.4 KiB
PHP
Raw Permalink Normal View History

2022-10-13 22:26:33 -04:00
<?php declare(strict_types=1);
namespace App\Enum;
2022-11-17 15:32:57 -05:00
enum CardBus: string {
2024-05-28 18:44:29 -04:00
// PCIe 1.0
case PCIE_10_1 = 'PCIe 1.0 x1';
case PCIE_10_4 = 'PCIe 1.0 x4';
case PCIE_10_8 = 'PCIe 1.0 x8';
case PCIE_10_16 = 'PCIe 1.0 x16';
2024-05-28 18:44:29 -04:00
// PCIe 1.1
case PCIE_11_1 = 'PCIe 1.1 x1';
case PCIE_11_4 = 'PCIe 1.1 x4';
case PCIE_11_8 = 'PCIe 1.1 x8';
case PCIE_11_16 = 'PCIe 1.1 x16';
2024-05-28 18:44:29 -04:00
// PCIe 2.0
case PCIE_20_1 = 'PCIe 2.0 x1';
case PCIE_20_4 = 'PCIe 2.0 x4';
case PCIE_20_8 = 'PCIe 2.0 x8';
case PCIE_20_16 = 'PCIe 2.0 x16';
2024-05-28 18:44:29 -04:00
// PCIe 3.0
case PCIE_30_1 = 'PCIe 3.0 x1';
case PCIE_30_4 = 'PCIe 3.0 x4';
case PCIE_30_8 = 'PCIe 3.0 x8';
case PCIE_30_16 = 'PCIe 3.0 x16';
2024-05-28 18:44:29 -04:00
// PCIe 4.0
case PCIE_40_1 = 'PCIe 4.0 x1';
case PCIE_40_4 = 'PCIe 4.0 x4';
case PCIE_40_8 = 'PCIe 4.0 x8';
case PCIE_40_16 = 'PCIe 4.0 x16';
2024-05-28 18:44:29 -04:00
// PCIe 5.0
case PCIE_50_1 = 'PCIe 5.0 x1';
2024-03-20 15:51:36 -04:00
case PCIE_50_4 = 'PCIe 5.0 x4';
case PCIE_50_8 = 'PCIe 5.0 x8';
case PCIE_50_16 = 'PCIe 5.0 x16';
2024-05-28 18:44:29 -04:00
// Future standards
/*
// PCIe 6.0
case PCIE_60_1 = 'PCIe 6.0 x1';
case PCIE_60_4 = 'PCIe 6.0 x4';
case PCIE_60_8 = 'PCIe 6.0 x8';
case PCIE_60_16 = 'PCIe 6.0 x16';
// PCIe 7.0
case PCIE_70_1 = 'PCIe 7.0 x1';
case PCIE_70_4 = 'PCIe 7.0 x4';
case PCIE_70_8 = 'PCIe 7.0 x8';
case PCIE_70_16 = 'PCIe 7.0 x16';
*/
2024-05-28 18:44:29 -04:00
// PCI
case PCI_33 = 'PCI 33';
case PCI_33V_33 = '3.3V PCI 33';
2024-05-28 18:44:29 -04:00
// AGP
case AGP_1X = 'AGP 1x';
case AGP_2X = 'AGP 2x';
case AGP_4X = 'AGP 4x';
case AGP_8X = 'AGP 8x';
2024-05-28 18:44:29 -04:00
// Etc.
case ISA_8 = '8-bit ISA';
case ISA_16 = '16-bit ISA';
case ISA_VLB = 'VLB';
public static function getGroups(): array
{
2023-07-21 10:35:15 -04:00
$filter = static fn (string $starts_with) => array_filter(
self::cases(),
static fn (CardBus $case) => str_starts_with($case->name, $starts_with)
);
$pcie = $filter('PCIE_');
$agp = $filter('AGP_');
$pci = $filter('PCI_');
$isa = $filter('ISA_');
2023-07-21 10:35:15 -04:00
$pcie16 = array_filter($pcie, static fn (CardBus $case) => str_ends_with($case->name, '_16'));
2024-05-28 18:44:29 -04:00
$pcie8 = array_filter($pcie, static fn (CardBus $case) => str_ends_with($case->name, '_8'));
$pcie4 = array_filter($pcie, static fn (CardBus $case) => str_ends_with($case->name, '_4'));
$pcie1 = array_filter($pcie, static fn (CardBus $case) => str_ends_with($case->name, '_1'));
return [
2024-05-28 18:44:29 -04:00
'PCIe x16' => $pcie16,
'PCIe x8' => $pcie8,
'PCIe x4' => $pcie4,
'PCIe x1' => $pcie1,
'AGP' => $agp,
'PCI' => $pci,
'ISA' => $isa,
];
}
2022-10-13 22:26:33 -04:00
}