From 4b6fff36e1f5d07e5fa59dcd24c00a42a58a386a Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Sun, 6 Mar 2022 16:37:11 +0100 Subject: [PATCH] Move throttle range sizes to class constants Change-Id: Iac436578f94022762b7f67959af894261c59fc66 --- includes/Consequences/Consequence/Throttle.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/Consequences/Consequence/Throttle.php b/includes/Consequences/Consequence/Throttle.php index dfd23bf50..115bfd7f5 100644 --- a/includes/Consequences/Consequence/Throttle.php +++ b/includes/Consequences/Consequence/Throttle.php @@ -36,6 +36,9 @@ class Throttle extends Consequence implements ConsequencesDisablerConsequence { /** @var bool|null */ private $hitThrottle; + private const IPV4_RANGE = '16'; + private const IPV6_RANGE = '64'; + /** * @param Parameters $parameters * @param array $throttleParams @@ -180,7 +183,7 @@ class Throttle extends Consequence implements ConsequencesDisablerConsequence { $identifier = $user->getId(); break; case 'range': - $range = IPUtils::isIPv6( $this->requestIP ) ? 64 : 16; + $range = IPUtils::isIPv6( $this->requestIP ) ? self::IPV6_RANGE : self::IPV4_RANGE; $identifier = IPUtils::sanitizeRange( "{$this->requestIP}/$range" ); break; case 'creationdate':