Skip to content

Commit

Permalink
add tel prefix length config
Browse files Browse the repository at this point in the history
  • Loading branch information
gabeta committed Dec 26, 2020
1 parent 4a9f3b0 commit 9309c9e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/GsmDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class GsmDetector

private static $mobileKeyName = "mobile";

private static $telPrefixLength = 2;

/**
* GsmDetector constructor.
* @param array|null $config
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -208,6 +215,6 @@ private static function validateConfigFormat($config)
*/
private function getNumberPrefix($value)
{
return substr($value, 0, 2);
return substr($value, 0, self::$telPrefixLength);
}
}

0 comments on commit 9309c9e

Please sign in to comment.