public function createToken($className)
    {
        if (!is_subclass_of($className, TokenInterface::class)) {
            $this->throwException(
                "$className is not a valid token sub-class"
            );
        }

        return new $className(
            $this->createCurrentSourceLocation(),
            $this->level,
            str_repeat($this->getIndentStyle(), $this->getIndentWidth())
        );
    }
public function createToken($className)
    {
        if (!is_subclass_of($className, TokenInterface::class)) {
            $this->throwException(
                "$className is not a valid token sub-class"
            );
        }

        return new $className(
            $this->createCurrentSourceLocation(),
            $this->level,
            str_repeat($this->getIndentStyle(), $this->getIndentWidth())
        );
    }
public function createToken ( $ className ) { if ( ! is_subclass_of ( $ className , TokenInterface :: class ) ) { $ this -> throwException ( "$className is not a valid token sub-class" ) ; } return new $ className ( $ this -> createCurrentSourceLocation ( ) , $ this -> level , str_repeat ( $ this -> getIndentStyle ( ) , $ this -> getIndentWidth ( ) ) ) ; }
Creates a new instance of a token.

The token automatically receives line/offset/level information through this method.

@param string $className the class name of the token

@return TokenInterface the token
Creates a new instance of a token .