| | if ($line === '') continue; |
| | |
| | - if (str_starts_with($line, '-')) { |
| | - $hidden[substr($line, 1)] = true; |
| | + // Use substr instead of str_starts_with for PHP < 8.0 compatibility |
| | + if (substr($line, 0, 1) === '-') { |
| | + // Store hidden names in lowercase for case-insensitive comparison |
| | + $hidden[strtolower(substr($line, 1))] = true; |
| | } else { |
| | - $weights[$line] = $rank++; |
| | + $weights[strtolower($line)] = $rank++; |
| | } |
| | } |
| | |
| | - // Filter hidden repositories |
| | + // Filter hidden repositories (case-insensitive) |
| | $repos = array_filter($repos, function($r) use ($hidden) { |
| | - return !isset($hidden[$r['name']]); |
| | + return !isset($hidden[strtolower($r['name'])]); |
| | }); |
| | |
| | - // Sort based on weights |
| | + // Sort based on weights (case-insensitive) |
| | usort($repos, function($a, $b) use ($weights) { |
| | - $wa = $weights[$a['name']] ?? PHP_INT_MAX; |
| | - $wb = $weights[$b['name']] ?? PHP_INT_MAX; |
| | + $nameA = strtolower($a['name']); |
| | + $nameB = strtolower($b['name']); |
| | + |
| | + $wa = isset($weights[$nameA]) ? $weights[$nameA] : PHP_INT_MAX; |
| | + $wb = isset($weights[$nameB]) ? $weights[$nameB] : PHP_INT_MAX; |
| | |
| | if ($wa === $wb) { |