From 12fbb1f3b66763060b929b83147b19e964e63ced Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 28 Apr 2022 17:28:05 +1000 Subject: Added M.2 interface for wifi and 3g cards - issue: https://h-node.org/issues/view/en/402/1/fb95964401f38fb9b925efbb75c2de56 - also added return types to functions (phpstan advice) - and removed an unused array. --- Application/Include/hardware.php | 59 ++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/Application/Include/hardware.php b/Application/Include/hardware.php index 06dbf15..36ad2dd 100644 --- a/Application/Include/hardware.php +++ b/Application/Include/hardware.php @@ -54,7 +54,7 @@ class Hardware "model" => "/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/\,\']+$/", ); - public static function translate($string) + public static function translate($string): string { if (array_key_exists($string,self::$translations)) { @@ -139,12 +139,12 @@ class Hardware 'host-controller' => 'compatibility', ); - public static function getTypes() + public static function getTypes(): string { return implode(',',array_keys(self::$typeToController)); } - public static function getControllerFromType($type) + public static function getControllerFromType($type): ?string { if (array_key_exists($type,self::$typeToController)) { @@ -153,7 +153,7 @@ class Hardware return null; } - public static function getWorksFieldFromType($type) + public static function getWorksFieldFromType($type): ?string { if (array_key_exists($type,self::$typeToWorksField)) { @@ -163,7 +163,7 @@ class Hardware } //get the type from the controller - public static function getTypeFromController($controller) + public static function getTypeFromController($controller): ?array { $temp = array_flip(self::$typeToController); if (array_key_exists($controller,$temp)) @@ -173,7 +173,7 @@ class Hardware return null; } - public static function getTypeFromClass($class) + public static function getTypeFromClass($class): ?array { if (array_key_exists($class,self::$deviceClasses)) { @@ -182,7 +182,7 @@ class Hardware return null; } - public static function getIconFromType($type) + public static function getIconFromType($type): ?string { if (array_key_exists($type,self::$icons)) { @@ -191,7 +191,7 @@ class Hardware return null; } - public static function getIconFromController($controller) + public static function getIconFromController($controller): ?string { if ($type = self::getTypeFromController($controller)) { @@ -200,7 +200,7 @@ class Hardware return null; } - public static function getIconFromClass($class) + public static function getIconFromClass($class): ?string { if (array_key_exists($class,self::$deviceClasses)) { @@ -210,7 +210,7 @@ class Hardware } //get the list of the allowed years of commercialization - public static function getCommYears() + public static function getCommYears(): string { $currentYear = (int)date("Y"); $allowed = 'not-specified'; @@ -239,7 +239,7 @@ class Printer extends Hardware public static $subtype = "not-specified,laser,inkjet,other"; - public static function compatibilityList() + public static function compatibilityList(): string { return implode(',',array_values(self::$compatibility)); } @@ -259,23 +259,12 @@ class Wifi extends Hardware "ExpressCard" => "ExpressCard", "Ethernet" => "Ethernet", "PCMCIA/PC-Card" => "PC-Card", - ); - - public static $interfaceReverse = array( - "not-specified" => "not-specified", - "USB" => "USB", - "PCI" => "PCI", - "PCI-E" => "PCI-E", - "mini-PCI" => "mini-PCI", - "mini-PCI-E" => "mini-PCI-E", - "ExpressCard" => "ExpressCard", - "Ethernet" => "Ethernet", - "PC-Card" => "PCMCIA/PC-Card", + "M.2" => "M.2", ); public static $wifiSelect = 'yes,no'; - public static function interfaceList() + public static function interfaceList(): string { return implode(',',array_values(self::$interface)); } @@ -298,7 +287,7 @@ class Videocard extends Hardware public static $interface = "not-specified,PCI,AGP,PCI-E,ISA,MCA,VLB"; - public static function videoList() + public static function videoList(): string { return implode(',',array_values(self::$videoSelect)); } @@ -438,47 +427,47 @@ class Notebooks extends Hardware 'there-is-no-webcam' => 'there is no webcam', ); - public static function videoList() + public static function videoList(): string { return implode(',',array_values(self::$videoSelect)); } - public static function wifiList() + public static function wifiList(): string { return implode(',',array_values(self::$wifiSelect)); } - public static function webcamList() + public static function webcamList(): string { return implode(',',array_values(self::$webcamSelect)); } - public static function vendorsList() + public static function vendorsList(): string { return implode(',',array_values(self::$vendors)); } - public static function compatibilityList() + public static function compatibilityList(): string { return implode(',',array_values(self::$compatibility)); } - public static function architectureList() + public static function architectureList(): string { return implode(',',array_values(self::$architectureSelect)); } - public static function biosList() + public static function biosList(): string { return implode(',',array_values(self::$biosSelect)); } - public static function preventWifiList() + public static function preventWifiList(): string { return implode(',',array_values(self::$preventWifiSelect)); } - public static function installableList() + public static function installableList(): string { return implode(',',array_values(self::$installableSelect)); } @@ -568,7 +557,7 @@ class Hostcontrollers extends Acquisitioncards "HECI Controller" => "heci-controller", ); - public static function subtypeList() + public static function subtypeList(): string { return implode(',',array_values(self::$subtype)); } -- cgit v1.2.3