function patternSymbols($pattern) {
    // Convert the pattern to NumberPatternSymbol objects.
    $symbols = array();
    foreach ($this->str_split($pattern) as $position => $symbol) {
      $symbols[] = new NumberPatternSymbol($symbol, $position);
    }

    // Loop through the NumberPatternSymbol objects and mark escaped symbols.
    foreach ($symbols as $i => $symbol) {
      // Check if the previous character is an unused escape symbol for this
      // symbol.
      if (isset($symbols[$i - 1]) && $symbols[$i - 1]->symbol == self::SYMBOL_ESCAPE && !$symbols[$i - 1]->escaped && !$symbols[$i - 1]->escapes_other_symbol
      // Check if the next character is an escape symbol for this symbol.
      && isset($symbols[$i + 1]) && $symbols[$i + 1]->symbol == self::SYMBOL_ESCAPE && !$symbols[$i + 1]->escaped && !$symbols[$i + 1]->escapes_other_symbol) {
        $symbol->escaped = TRUE;
        $symbols[$i - 1]->escapes_other_symbol = TRUE;
        $symbols[$i + 1]->escapes_other_symbol = TRUE;
      }
    }

    // Find illegal escape symbols, such as escape symbols that do not escape
    // other symbols and are not escaped themselves.
    foreach ($symbols as $symbol) {
      if ($symbol->symbol == self::SYMBOL_ESCAPE && !$symbol->escaped && !$symbol->escapes_other_symbol) {
        throw new \RunTimeException("Invalid escape symbol (') in pattern " . $pattern . "at position $symbol->position.");
      }
    }

    // Remove escape symbols from the array, because we have transferred their
    // meaning to other symbols' NumberPatternSymbol objects.
    foreach ($symbols as $i => $symbol) {
      if ($symbol->escapes_other_symbol) {
        unset($symbols[$i]);
      }
    }

    // Reset the array keys so they make sense again.
    return array_values($symbols);
  }
function patternSymbols($pattern) {
    // Convert the pattern to NumberPatternSymbol objects.
    $symbols = array();
    foreach ($this->str_split($pattern) as $position => $symbol) {
      $symbols[] = new NumberPatternSymbol($symbol, $position);
    }

    // Loop through the NumberPatternSymbol objects and mark escaped symbols.
    foreach ($symbols as $i => $symbol) {
      // Check if the previous character is an unused escape symbol for this
      // symbol.
      if (isset($symbols[$i - 1]) && $symbols[$i - 1]->symbol == self::SYMBOL_ESCAPE && !$symbols[$i - 1]->escaped && !$symbols[$i - 1]->escapes_other_symbol
      // Check if the next character is an escape symbol for this symbol.
      && isset($symbols[$i + 1]) && $symbols[$i + 1]->symbol == self::SYMBOL_ESCAPE && !$symbols[$i + 1]->escaped && !$symbols[$i + 1]->escapes_other_symbol) {
        $symbol->escaped = TRUE;
        $symbols[$i - 1]->escapes_other_symbol = TRUE;
        $symbols[$i + 1]->escapes_other_symbol = TRUE;
      }
    }

    // Find illegal escape symbols, such as escape symbols that do not escape
    // other symbols and are not escaped themselves.
    foreach ($symbols as $symbol) {
      if ($symbol->symbol == self::SYMBOL_ESCAPE && !$symbol->escaped && !$symbol->escapes_other_symbol) {
        throw new \RunTimeException("Invalid escape symbol (') in pattern " . $pattern . "at position $symbol->position.");
      }
    }

    // Remove escape symbols from the array, because we have transferred their
    // meaning to other symbols' NumberPatternSymbol objects.
    foreach ($symbols as $i => $symbol) {
      if ($symbol->escapes_other_symbol) {
        unset($symbols[$i]);
      }
    }

    // Reset the array keys so they make sense again.
    return array_values($symbols);
  }
function patternSymbols ( $ pattern ) { // Convert the pattern to NumberPatternSymbol objects. $ symbols = array ( ) ; foreach ( $ this -> str_split ( $ pattern ) as $ position => $ symbol ) { $ symbols [ ] = new NumberPatternSymbol ( $ symbol , $ position ) ; } // Loop through the NumberPatternSymbol objects and mark escaped symbols. foreach ( $ symbols as $ i => $ symbol ) { // Check if the previous character is an unused escape symbol for this // symbol. if ( isset ( $ symbols [ $ i - 1 ] ) && $ symbols [ $ i - 1 ] -> symbol == self :: SYMBOL_ESCAPE && ! $ symbols [ $ i - 1 ] -> escaped && ! $ symbols [ $ i - 1 ] -> escapes_other_symbol // Check if the next character is an escape symbol for this symbol. && isset ( $ symbols [ $ i + 1 ] ) && $ symbols [ $ i + 1 ] -> symbol == self :: SYMBOL_ESCAPE && ! $ symbols [ $ i + 1 ] -> escaped && ! $ symbols [ $ i + 1 ] -> escapes_other_symbol ) { $ symbol -> escaped = TRUE ; $ symbols [ $ i - 1 ] -> escapes_other_symbol = TRUE ; $ symbols [ $ i + 1 ] -> escapes_other_symbol = TRUE ; } } // Find illegal escape symbols, such as escape symbols that do not escape // other symbols and are not escaped themselves. foreach ( $ symbols as $ symbol ) { if ( $ symbol -> symbol == self :: SYMBOL_ESCAPE && ! $ symbol -> escaped && ! $ symbol -> escapes_other_symbol ) { throw new \ RunTimeException ( "Invalid escape symbol (') in pattern " . $ pattern . "at position $symbol->position." ) ; } } // Remove escape symbols from the array, because we have transferred their // meaning to other symbols' NumberPatternSymbol objects. foreach ( $ symbols as $ i => $ symbol ) { if ( $ symbol -> escapes_other_symbol ) { unset ( $ symbols [ $ i ] ) ; } } // Reset the array keys so they make sense again. return array_values ( $ symbols ) ; }
Converts a number pattern to an array of NumberPatternSymbol objects.

@throws \RuntimeException

@param string $pattern

@return array
Converts a number pattern to an array of NumberPatternSymbol objects .