コード例 #1
0
 /**
  * @param string $nationalNumber
  * @param PhoneNumberDesc $numberDesc
  * @return bool
  */
 public function isNumberPossibleForDesc($nationalNumber, PhoneNumberDesc $numberDesc)
 {
     $possibleNumberPatternMatcher = new Matcher($numberDesc->getPossibleNumberPattern(), $nationalNumber);
     return $possibleNumberPatternMatcher->matches();
 }
コード例 #2
0
ファイル: PhoneNumberDesc.php プロジェクト: kidaa30/Swevers
 /**
  * @param PhoneNumberDesc $other
  * @return PhoneNumberDesc
  */
 public function mergeFrom(PhoneNumberDesc $other)
 {
     if ($other->hasNationalNumberPattern()) {
         $this->setNationalNumberPattern($other->getNationalNumberPattern());
     }
     if ($other->hasPossibleNumberPattern()) {
         $this->setPossibleNumberPattern($other->getPossibleNumberPattern());
     }
     if ($other->hasExampleNumber()) {
         $this->setExampleNumber($other->getExampleNumber());
     }
     return $this;
 }
コード例 #3
0
 private function isNumberMatchingDesc($nationalNumber, PhoneNumberDesc $numberDesc)
 {
     $possibleNumberPatternMatcher = preg_match('/^(' . str_replace(array(PHP_EOL, ' '), '', $numberDesc->getPossibleNumberPattern()) . ')$/', $nationalNumber);
     $nationalNumberPatternMatcher = preg_match('/^(' . str_replace(array(PHP_EOL, ' '), '', $numberDesc->getNationalNumberPattern()) . ')$/', $nationalNumber);
     return $possibleNumberPatternMatcher && $nationalNumberPatternMatcher;
 }
コード例 #4
0
 private function isNumberMatchingDesc($nationalNumber, PhoneNumberDesc $numberDesc)
 {
     $possibleNumberPatternMatcher = preg_match('/^(' . $numberDesc->getPossibleNumberPattern() . ')$/x', $nationalNumber);
     $nationalNumberPatternMatcher = preg_match('/^' . $numberDesc->getNationalNumberPattern() . '$/x', $nationalNumber);
     return $possibleNumberPatternMatcher && $nationalNumberPatternMatcher;
 }
コード例 #5
0
 private function isNumberMatchingDesc($nationalNumber, PhoneNumberDesc $numberDesc)
 {
     if (DIRECTORY_SEPARATOR == '\\') {
         // For Windows
         $possibleNumberPatternMatcher = preg_match('/^(' . str_replace(array("\n", "\r", ' '), '', $numberDesc->getPossibleNumberPattern()) . ')$/', $nationalNumber);
         $nationalNumberPatternMatcher = preg_match('/^(' . str_replace(array("\n", "\r", ' '), '', $numberDesc->getNationalNumberPattern()) . ')$/', $nationalNumber);
     } else {
         // For Linux
         $possibleNumberPatternMatcher = preg_match('/^(' . str_replace(array(PHP_EOL, ' '), '', $numberDesc->getPossibleNumberPattern()) . ')$/', $nationalNumber);
         $nationalNumberPatternMatcher = preg_match('/^(' . str_replace(array(PHP_EOL, ' '), '', $numberDesc->getNationalNumberPattern()) . ')$/', $nationalNumber);
     }
     return $possibleNumberPatternMatcher && $nationalNumberPatternMatcher;
 }