From 60bc3e6e99704061f45addc03427303f33494d1f Mon Sep 17 00:00:00 2001 From: Marko Jovanovic Date: Wed, 29 Oct 2025 11:31:37 +0100 Subject: [PATCH] Updated-simplified calling codes for German mobile carriers --- src/Command/CleanMobileCommand.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Command/CleanMobileCommand.php b/src/Command/CleanMobileCommand.php index 0b14179..26dae5d 100644 --- a/src/Command/CleanMobileCommand.php +++ b/src/Command/CleanMobileCommand.php @@ -138,16 +138,18 @@ final class CleanMobileCommand extends Command } // Extract the 3‑digit network prefix and the subscriber part - $prefix = substr($e164, 4, 3); // after 0049 - $subscriber = substr($e164, 7); + $prefix = substr($e164, 4, 2); // after 0049 + $subscriber = substr($e164, 6); // Prefix must be one of the known mobile prefixes if (!in_array($prefix, $germanMobilePrefixes, true)) { return false; } - // Subscriber must be 6‑10 digits long and consist only of digits - return preg_match('/^\d{6,10}$/', $subscriber) === 1; + // Subscriber must be 6‑11 digits long and consist only of digits + // (technically 6-10, but for simplification we consider first two as prefix, + // and the last digit of the prefix belongs to the subscriber) + return preg_match('/^\d{6,11}$/', $subscriber) === 1; }; // -------------------------------------------------------------