From 6f8abee0ae206eae9e704494061dfd2a0f60fe21 Mon Sep 17 00:00:00 2001 From: Gabeta Soro Date: Sat, 26 Dec 2020 11:31:48 +0000 Subject: [PATCH] wip --- src/GsmDetector.php | 16 ++++++++-------- tests/GsmDetectorTest.php | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/GsmDetector.php b/src/GsmDetector.php index 060ce2b..08f4657 100644 --- a/src/GsmDetector.php +++ b/src/GsmDetector.php @@ -15,9 +15,9 @@ class GsmDetector private static $mobileKeyName = "mobile"; - private static $mobilePrefixLength = 2; + private static $mobilePrefixDigits = 2; - private static $fixPrefixLength = 3; + private static $fixPrefixDigits = 3; /** * GsmDetector constructor. @@ -164,14 +164,14 @@ public static function setConfig(array $config) self::$config = $config; } - public static function setMobilePrefixLength(int $length) + public static function setMobilePrefixDigits(int $length) { - self::$mobilePrefixLength = $length; + self::$mobilePrefixDigits = $length; } - public static function setFixPrefixLength(int $length) + public static function setFixPrefixDigits(int $length) { - self::$fixPrefixLength = $length; + self::$fixPrefixDigits = $length; } /** @@ -220,7 +220,7 @@ private function getNumberPrefix($value, $prefixLength) private function hasValue($prefix, $value) { - return in_array($this->getNumberPrefix($value, self::$mobilePrefixLength), $prefix) || - in_array($this->getNumberPrefix($value, self::$fixPrefixLength), $prefix); + return in_array($this->getNumberPrefix($value, self::$mobilePrefixDigits), $prefix) || + in_array($this->getNumberPrefix($value, self::$fixPrefixDigits), $prefix); } } diff --git a/tests/GsmDetectorTest.php b/tests/GsmDetectorTest.php index 25e80c8..15da59e 100644 --- a/tests/GsmDetectorTest.php +++ b/tests/GsmDetectorTest.php @@ -29,7 +29,7 @@ public function test_is_gsm() $this->assertFalse($gsmDetector->isGsm('togocel', '26000000')); $this->assertFalse($gsmDetector->isGsm('orange', '29000000')); - GsmDetector::setFixPrefixLength(3); + GsmDetector::setFixPrefixDigits(3); $this->assertFalse($gsmDetector->isGsm('orange', '215000000')); } @@ -54,7 +54,7 @@ public function test_is_gsm_with_type() $this->assertFalse($gsmDetector->isGsmWithType('togocel', 'fix', '01000000')); $this->assertTrue($gsmDetector->isGsmWithType('orange','fix', '35000000')); - GsmDetector::setFixPrefixLength(3); + GsmDetector::setFixPrefixDigits(3); $this->assertTrue($gsmDetector->isGsmWithType('orange','fix', '21500000')); } @@ -81,7 +81,7 @@ public function test_is_gsm_name() $this->assertTrue($gsmDetector->isOrange('09000000')); $this->assertTrue($gsmDetector->isOrange('22000000')); - GsmDetector::setFixPrefixLength(3); + GsmDetector::setFixPrefixDigits(3); $this->assertTrue($gsmDetector->isOrange('21500000')); }