src/MultiStringMatcher.php
/**
	 * Get the state transitions which the string-matching automaton
	 * shall make as it advances through input text.
	 *
	 * Constructs a directed tree with a root node which represents the
	 * initial state of the string-matching automaton and from which a
	 * path exists which spells out each search keyword.
	 */
Get the state transitions which the string-matching automaton
shall make as it advances through input text.

Constructs a directed tree with a root node which represents the
initial state of the string-matching automaton and from which a
path exists which spells out each search keyword.
Get the state transitions which the string - matching automaton shall make as it advances through input text . Constructs a directed tree with a root node which represents the initial state of the string - matching automaton and from which a path exists which spells out each search keyword .
protected function computeYesTransitions() {
		$this->yesTransitions = [ [] ];
		$this->outputs = [ [] ];
		foreach ( $this->searchKeywords as $keyword => $length ) {
			$state = 0;
			for ( $i = 0; $i < $length; $i++ ) {
				$ch = $keyword[$i];
				if ( !empty( $this->yesTransitions[$state][$ch] ) ) {
					$state = $this->yesTransitions[$state][$ch];
				} else {
					$this->yesTransitions[$state][$ch] = $this->numStates;
					$this->yesTransitions[] = [];
					$this->outputs[] = [];
					$state = $this->numStates++;
				}
			}
			$this->outputs[$state][] = $keyword;
		}
	}
protected function computeYesTransitions ( ) { $ this -> yesTransitions = [ [ ] ] ; $ this -> outputs = [ [ ] ] ; foreach ( $ this -> searchKeywords as $ keyword => $ length ) { $ state = 0 ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ ch = $ keyword [ $ i ] ; if ( ! empty ( $ this -> yesTransitions [ $ state ] [ $ ch ] ) ) { $ state = $ this -> yesTransitions [ $ state ] [ $ ch ] ; } else { $ this -> yesTransitions [ $ state ] [ $ ch ] = $ this -> numStates ; $ this -> yesTransitions [ ] = [ ] ; $ this -> outputs [ ] = [ ] ; $ state = $ this -> numStates ++ ; } } $ this -> outputs [ $ state ] [ ] = $ keyword ; } }
Get the state transitions which the string-matching automaton
 shall make as it advances through input text.
Get the state transitions which the string - matching automaton shall make as it advances through input text .