Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gabeta committed Dec 26, 2020
1 parent b8e3f7d commit 6f8abee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/GsmDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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);
}
}
6 changes: 3 additions & 3 deletions tests/GsmDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand All @@ -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'));
}
Expand All @@ -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'));
}
Expand Down

0 comments on commit 6f8abee

Please sign in to comment.