src/MultiStringMatcher.php
/**
	 * Map the current state and input character to the next state.
	 *
	 * @param int $currentState The current state of the string-matching
	 *  automaton.
	 * @param string $inputChar The character the string-matching
	 *  automaton is currently processing.
	 * @return int The state the automaton should transition to.
	 */
Map the current state and input character to the next state.
@param int $currentState The current state of the string-matching
automaton.
@param string $inputChar The character the string-matching
automaton is currently processing.
@return int The state the automaton should transition to.
Map the current state and input character to the next state . @param int $currentState The current state of the string - matching automaton . @param string $inputChar The character the string - matching automaton is currently processing . @return int The state the automaton should transition to .
public function nextState( $currentState, $inputChar ) {
		$initialState = $currentState;
		while ( true ) {
			$transitions =& $this->yesTransitions[$currentState];
			if ( isset( $transitions[$inputChar] ) ) {
				$nextState = $transitions[$inputChar];
				if ( $currentState !== $initialState ) {
					$this->yesTransitions[$initialState][$inputChar] = $nextState;
				}
				return $nextState;
			}
			if ( $currentState === 0 ) {
				return 0;
			}
			$currentState = $this->noTransitions[$currentState];
		}
	}
public function nextState ( $ currentState , $ inputChar ) { $ initialState = $ currentState ; while ( true ) { $ transitions = & $ this -> yesTransitions [ $ currentState ] ; if ( isset ( $ transitions [ $ inputChar ] ) ) { $ nextState = $ transitions [ $ inputChar ] ; if ( $ currentState !== $ initialState ) { $ this -> yesTransitions [ $ initialState ] [ $ inputChar ] = $ nextState ; } return $ nextState ; } if ( $ currentState === 0 ) { return 0 ; } $ currentState = $ this -> noTransitions [ $ currentState ] ; } }
Map the current state and input character to the next state.
Map the current state and input character to the next state .
// Avoid failure transitions next time. // Unreachable outside 'while'