From 9309c9eeee02d9c0c250635e5a50e2f8d27f5943 Mon Sep 17 00:00:00 2001 From: Gabeta Soro Date: Sat, 26 Dec 2020 10:03:04 +0000 Subject: [PATCH] add tel prefix length config --- src/GsmDetector.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GsmDetector.php b/src/GsmDetector.php index 49269f2..8972c44 100644 --- a/src/GsmDetector.php +++ b/src/GsmDetector.php @@ -15,6 +15,8 @@ class GsmDetector private static $mobileKeyName = "mobile"; + private static $telPrefixLength = 2; + /** * GsmDetector constructor. * @param array|null $config @@ -167,6 +169,11 @@ public static function setConfig(array $config) self::$config = $config; } + public static function setTelPrefixLength(int $length) + { + self::$telPrefixLength = $length; + } + /** * @param array $config * @return bool @@ -208,6 +215,6 @@ private static function validateConfigFormat($config) */ private function getNumberPrefix($value) { - return substr($value, 0, 2); + return substr($value, 0, self::$telPrefixLength); } }