Skip to content

Commit

Permalink
fix: use property_exists instead of array_key_exists (continued)
Browse files Browse the repository at this point in the history
  • Loading branch information
darcywong00 committed Nov 29, 2024
1 parent 7ffa897 commit 7c70c90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions _includes/includes/ui/keyboard-details.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function get_tier_from_request($tier = 'stable') {

protected static function map_license($s) {
$license_map = ['mit' => 'MIT'];
return array_key_exists($s, $license_map) ? $license_map[$s] : $s;
return property_exists($license_map, $s) ? $license_map[$s] : $s;
}

protected static function download_box($platform) {
Expand Down Expand Up @@ -205,7 +205,7 @@ protected static function LoadData() {
self::$keyboardPlatforms = "<span class='platforms'>";
$vars = get_object_vars(self::$keyboard->platformSupport);
foreach ($vars as $var => $value) {
if ($value != 'none' && array_key_exists($var, $platformTitles)) {
if ($value != 'none' && property_exists($platformTitles, $var)) {
self::$keyboardPlatforms .= "<span class='platform-$var'>{$platformTitles[$var]}</span>";
}
}
Expand Down
6 changes: 3 additions & 3 deletions _includes/includes/ui/legacy-keyboard-details.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function get_tier_from_request($tier = 'stable') {

protected static function map_license($s) {
$license_map = ['mit' => 'MIT'];
return array_key_exists($s, $license_map) ? $license_map[$s] : $s;
return property_exists($license_map, $s) ? $license_map[$s] : $s;
}

protected static function download_box($url, $title, $description, $class, $linktitle, $platform, $mode='standalone') {
Expand Down Expand Up @@ -323,7 +323,7 @@ protected static function LoadData() {
self::$keyboardPlatforms = '';
$vars = get_object_vars(self::$keyboard->platformSupport);
foreach ($vars as $var => $value) {
if ($value != 'none' && array_key_exists($var, $platformTitles)) {
if ($value != 'none' && property_exists($platformTitles, $var)) {
self::$keyboardPlatforms .= (self::$keyboardPlatforms == '' ? '' : ', ') . $platformTitles[$var];
}
}
Expand Down Expand Up @@ -441,7 +441,7 @@ protected static function WriteDownloadBoxes() {
"Android" => "self::WriteAndroidBoxes"
);

$text = (isset($pageDevice) && array_key_exists($pageDevice, $deviceboxfuncs)) ? $deviceboxfuncs[$pageDevice] : '';
$text = (isset($pageDevice) && property_exists($deviceboxfuncs, $pageDevice)) ? $deviceboxfuncs[$pageDevice] : '';
$webtext = self::WriteWebBoxes();

if ($text) {
Expand Down

0 comments on commit 7c70c90

Please sign in to comment.