Skip to content

Commit

Permalink
refactor: don't call array_key_exists() twice
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Apr 19, 2024
1 parent e6ef70c commit 8d51433
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions system/Security/CheckPhpIni.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ public static function checkIni(): array
$ini = ini_get_all();

foreach ($items as $key => $values) {
$hasKeyInIni = array_key_exists($key, $ini);
$output[$key] = [
'global' => array_key_exists($key, $ini) ? $ini[$key]['global_value'] : 'disabled',
'current' => array_key_exists($key, $ini) ? $ini[$key]['local_value'] : 'disabled',
'global' => $hasKeyInIni ? $ini[$key]['global_value'] : 'disabled',
'current' => $hasKeyInIni ? $ini[$key]['local_value'] : 'disabled',
'recommended' => $values['recommended'] ?? '',
'remark' => $values['remark'] ?? '',
];
Expand Down

0 comments on commit 8d51433

Please sign in to comment.