src/AsYouTypeFormatter.php
private function attemptToChooseFormattingPattern()
    {
        // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national
        // number (excluding national prefix) have been entered.
        if (mb_strlen($this->nationalNumber) >= self::$minLeadingDigitsLength) {
            $this->getAvailableFormats($this->nationalNumber);
            // See if the accrued digits can be formatted properly already.
            $formattedNumber = $this->attemptToFormatAccruedDigits();
            if (mb_strlen($formattedNumber) > 0) {
                return $formattedNumber;
            }
            return $this->maybeCreateNewTemplate() ? $this->inputAccruedNationalNumber() : $this->accruedInput;
        }

        return $this->appendNationalNumber($this->nationalNumber);
    }
private function attemptToChooseFormattingPattern()
    {
        // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national
        // number (excluding national prefix) have been entered.
        if (mb_strlen($this->nationalNumber) >= self::$minLeadingDigitsLength) {
            $this->getAvailableFormats($this->nationalNumber);
            // See if the accrued digits can be formatted properly already.
            $formattedNumber = $this->attemptToFormatAccruedDigits();
            if (mb_strlen($formattedNumber) > 0) {
                return $formattedNumber;
            }
            return $this->maybeCreateNewTemplate() ? $this->inputAccruedNationalNumber() : $this->accruedInput;
        }

        return $this->appendNationalNumber($this->nationalNumber);
    }
private function attemptToChooseFormattingPattern ( ) { // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national // number (excluding national prefix) have been entered. if ( mb_strlen ( $ this -> nationalNumber ) >= self :: $ minLeadingDigitsLength ) { $ this -> getAvailableFormats ( $ this -> nationalNumber ) ; // See if the accrued digits can be formatted properly already. $ formattedNumber = $ this -> attemptToFormatAccruedDigits ( ) ; if ( mb_strlen ( $ formattedNumber ) > 0 ) { return $ formattedNumber ; } return $ this -> maybeCreateNewTemplate ( ) ? $ this -> inputAccruedNationalNumber ( ) : $ this -> accruedInput ; } return $ this -> appendNationalNumber ( $ this -> nationalNumber ) ; }
Attempts to set the formatting template and returns a string which contains the formatted
version of the digits entered so far.
@return string
Attempts to set the formatting template and returns a string which contains the formatted version of the digits entered so far .