src/AsYouTypeFormatter.php
public function attemptToFormatAccruedDigits()
    {
        foreach ($this->possibleFormats as $numberFormat) {
            $m = new Matcher($numberFormat->getPattern(), $this->nationalNumber);
            if ($m->matches()) {
                $nationalPrefixSeparatorsMatcher = new Matcher(self::$nationalPrefixSeparatorsPattern, $numberFormat->getNationalPrefixFormattingRule());
                $this->shouldAddSpaceAfterNationalPrefix = $nationalPrefixSeparatorsMatcher->find();
                $formattedNumber = $m->replaceAll($numberFormat->getFormat());
                return $this->appendNationalNumber($formattedNumber);
            }
        }
        return '';
    }
public function attemptToFormatAccruedDigits()
    {
        foreach ($this->possibleFormats as $numberFormat) {
            $m = new Matcher($numberFormat->getPattern(), $this->nationalNumber);
            if ($m->matches()) {
                $nationalPrefixSeparatorsMatcher = new Matcher(self::$nationalPrefixSeparatorsPattern, $numberFormat->getNationalPrefixFormattingRule());
                $this->shouldAddSpaceAfterNationalPrefix = $nationalPrefixSeparatorsMatcher->find();
                $formattedNumber = $m->replaceAll($numberFormat->getFormat());
                return $this->appendNationalNumber($formattedNumber);
            }
        }
        return '';
    }
public function attemptToFormatAccruedDigits ( ) { foreach ( $ this -> possibleFormats as $ numberFormat ) { $ m = new Matcher ( $ numberFormat -> getPattern ( ) , $ this -> nationalNumber ) ; if ( $ m -> matches ( ) ) { $ nationalPrefixSeparatorsMatcher = new Matcher ( self :: $ nationalPrefixSeparatorsPattern , $ numberFormat -> getNationalPrefixFormattingRule ( ) ) ; $ this -> shouldAddSpaceAfterNationalPrefix = $ nationalPrefixSeparatorsMatcher -> find ( ) ; $ formattedNumber = $ m -> replaceAll ( $ numberFormat -> getFormat ( ) ) ; return $ this -> appendNationalNumber ( $ formattedNumber ) ; } } return '' ; }
Checks to see if there is an exact pattern match for these digits. If so, we should use this
instead of any other formatting template whose leadingDigitsPattern also matches the input.
@return string
Checks to see if there is an exact pattern match for these digits . If so we should use this instead of any other formatting template whose leadingDigitsPattern also matches the input .