public function parse($token)
    {
        $parts = explode('.', $token);
        if (count($parts) !== 3) {
            throw new InvalidArgumentException('Token is invalid');
        }
        $this->token = $token;
        $this->header = json_decode(base64_decode($parts[0]), true);
        $this->payload = json_decode(base64_decode($parts[1]), true);
        $this->signature = $parts[2];
    }