src/ViKon/Parser/TokenList.php
public function addToken($name, $position) {
        $token = new Token($name, $position);
        $this->tokens[] = $token;

        // Autoclose opened tokens
        switch (substr($name, -4)) {
            case AbstractBlockRule::OPEN:
                $this->openedTokens[] = substr($name, 0, -5);
                break;
            case AbstractBlockRule::CLOSE:
                while (count($this->openedTokens) > 0) {
                    $lastOpenToken = array_pop($this->openedTokens);
                    $this->tokens[] = new Token($lastOpenToken . AbstractBlockRule::CLOSE, $position);
                    if ($lastOpenToken == substr($name, 0, -5)) {
                        break;
                    }
                }
                break;
        }

        return $token;
    }
public function addToken($name, $position) {
        $token = new Token($name, $position);
        $this->tokens[] = $token;

        // Autoclose opened tokens
        switch (substr($name, -4)) {
            case AbstractBlockRule::OPEN:
                $this->openedTokens[] = substr($name, 0, -5);
                break;
            case AbstractBlockRule::CLOSE:
                while (count($this->openedTokens) > 0) {
                    $lastOpenToken = array_pop($this->openedTokens);
                    $this->tokens[] = new Token($lastOpenToken . AbstractBlockRule::CLOSE, $position);
                    if ($lastOpenToken == substr($name, 0, -5)) {
                        break;
                    }
                }
                break;
        }

        return $token;
    }
public function addToken ( $ name , $ position ) { $ token = new Token ( $ name , $ position ) ; $ this -> tokens [ ] = $ token ; // Autoclose opened tokens switch ( substr ( $ name , - 4 ) ) { case AbstractBlockRule :: OPEN : $ this -> openedTokens [ ] = substr ( $ name , 0 , - 5 ) ; break ; case AbstractBlockRule :: CLOSE : while ( count ( $ this -> openedTokens ) > 0 ) { $ lastOpenToken = array_pop ( $ this -> openedTokens ) ; $ this -> tokens [ ] = new Token ( $ lastOpenToken . AbstractBlockRule :: CLOSE , $ position ) ; if ( $ lastOpenToken == substr ( $ name , 0 , - 5 ) ) { break ; } } break ; } return $ token ; }
Add token to token list

@param string $name     token name
@param int    $position token found at position

@return \ViKon\Parser\Token
Add token to token list