= $min && $val <= $max) $match = true; break; case 'terrestrial_control': $val = (float)($planet['terrestrial_control'] ?? 0); $min = $rule['min_control_value'] !== null ? (float)$rule['min_control_value'] : -1; $max = $rule['max_control_value'] !== null ? (float)$rule['max_control_value'] : 101; if ($val >= $min && $val <= $max) $match = true; break; case 'uncontrolled': $orb = (float)($planet['orbital_control'] ?? 0); $terr = (float)($planet['terrestrial_control'] ?? 0); if ($orb == 0 && $terr == 0) $match = true; break; } if ($match) { // Find status slug from id // We should probably pass the status slug in the rule too or join it. return $rule['status_slug']; } } return $planet['status']; }