libphonenumber\Matcher::matches PHP Method

matches() public method

public matches ( ) : boolean
return boolean
    public function matches()
    {
        return $this->doMatch('matches');
    }

Usage Example

 /**
  * @dataProvider shortNumberRegionList
  */
 public function testCarrierSpecificShortNumbers($regionCode)
 {
     // Test the carrier-specific tag.
     $desc = $this->shortNumberInfo->getMetadataForRegion($regionCode)->getCarrierSpecific();
     if ($desc->hasExampleNumber()) {
         $exampleNumber = $desc->getExampleNumber();
         $carrierSpecificNumber = $this->phoneNumberUtil->parse($exampleNumber, $regionCode);
         $exampleNumberMatcher = new Matcher($desc->getPossibleNumberPattern(), $exampleNumber);
         if (!$exampleNumberMatcher->matches() || !$this->shortNumberInfo->isCarrierSpecific($carrierSpecificNumber)) {
             $this->fail("Carrier-specific test failed for " . $regionCode);
         }
     }
 }
All Usage Examples Of libphonenumber\Matcher::matches