= 1 ? $value : $default; } if (is_string($value) && preg_match('/^[1-9][0-9]{0,8}$/', $value) === 1) { return (int) $value; } if (is_float($value) && $value >= 1 && $value <= 999999999 && floor($value) === $value) { return (int) $value; } return $default; } /** * The limit to enforce: 0 (the limiter's "no limit") only when the scope is named in the explicit list, otherwise the valid * number or the default. * * @param mixed $value what the limit filter returned * @param mixed $disabled what the disable filter returned (expected: a list of scope names) */ public static function effective(string $scope, mixed $value, int $default, mixed $disabled): int { if (is_array($disabled) && in_array($scope, $disabled, true)) { return 0; } return self::valid($value, $default); } }