public function handleToken(TokenInterface $token = null)
    {
        $token = $token ?: $this->getToken();
        $className = get_class($token);
        $tokenHandlers = $this->getOption('token_handlers');

        if (!isset($tokenHandlers[$className])) {
            $this->throwException(
                "Unexpected token `$className`, no token handler registered",
                0,
                $token
            );
        }

        $handler = $tokenHandlers[$className];
        $handler = $handler instanceof TokenHandlerInterface
            ? $handler
            : $this->getNamedHandler($handler);

        $handler->handleToken($token, $this);

        return $this;
    }