Updated-simplified calling codes for German mobile carriers
This commit is contained in:
parent
2a12b62d40
commit
60bc3e6e99
|
|
@ -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;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user