public function replace( $old_token, $new_token )
	{
		$updated = false;

		$old_token = (string) $old_token;
		$new_token = (string) $new_token;

		$this->__validate( $old_token );
		$this->__validate( $new_token );

		if ( $index = array_search( $old_token, $this->tokens, true ) ) {
			$this->tokens[ $index ] = $new_token;
			$updated = true;
		}

		if ( $updated ) {
			$this->__update();
		}

		return $this;
	}
public function replace( $old_token, $new_token )
	{
		$updated = false;

		$old_token = (string) $old_token;
		$new_token = (string) $new_token;

		$this->__validate( $old_token );
		$this->__validate( $new_token );

		if ( $index = array_search( $old_token, $this->tokens, true ) ) {
			$this->tokens[ $index ] = $new_token;
			$updated = true;
		}

		if ( $updated ) {
			$this->__update();
		}

		return $this;
	}
public function replace ( $ old_token , $ new_token ) { $ updated = false ; $ old_token = ( string ) $ old_token ; $ new_token = ( string ) $ new_token ; $ this -> __validate ( $ old_token ) ; $ this -> __validate ( $ new_token ) ; if ( $ index = array_search ( $ old_token , $ this -> tokens , true ) ) { $ this -> tokens [ $ index ] = $ new_token ; $ updated = true ; } if ( $ updated ) { $ this -> __update ( ) ; } return $ this ; }
Replace an existing token for a new one.

If the $old_token does not exist, the new one will not be added.

This method is a shortcut for StringTokenList::remove( $old_token )
followed by StringTokenList::add( $new_token ).

@param string $old_token A case-sensitive string representing an existing token to remove.
@param string $new_token A case-sensitive string representing a new token to append.

@return $this
Replace an existing token for a new one .