public function replace(string $old, string $new)
    {
        if ($old === $new) {
            return;
        }
        $this->tokenize();
        $i = array_search($old, $this->tokens);
        if ($i !== false) {
            $j = array_search($new, $this->tokens);
            if ($j === false) {
                $this->tokens[$i] = $new;
            } else {
                array_splice($this->tokens, $i, 1);
            }
            $this->setAttributeValue();
        }
    }
public function replace(string $old, string $new)
    {
        if ($old === $new) {
            return;
        }
        $this->tokenize();
        $i = array_search($old, $this->tokens);
        if ($i !== false) {
            $j = array_search($new, $this->tokens);
            if ($j === false) {
                $this->tokens[$i] = $new;
            } else {
                array_splice($this->tokens, $i, 1);
            }
            $this->setAttributeValue();
        }
    }
public function replace ( string $ old , string $ new ) { if ( $ old === $ new ) { return ; } $ this -> tokenize ( ) ; $ i = array_search ( $ old , $ this -> tokens ) ; if ( $ i !== false ) { $ j = array_search ( $ new , $ this -> tokens ) ; if ( $ j === false ) { $ this -> tokens [ $ i ] = $ new ; } else { array_splice ( $ this -> tokens , $ i , 1 ) ; } $ this -> setAttributeValue ( ) ; } }
Replaces an existing token with a new token.

@param string $old The token you want to replace.
@param string $new The token you want to replace $old with.
@return void
Replaces an existing token with a new token .