protected function segments(string $token): array
    {
        $segments = explode('.', $token);

        if (3 !== count($segments)) {
            throw new Exception("Malformed jwt received.");
        }

        return $segments;
    }
protected function segments(string $token): array
    {
        $segments = explode('.', $token);

        if (3 !== count($segments)) {
            throw new Exception("Malformed jwt received.");
        }

        return $segments;
    }
protected function segments ( string $ token ) : array { $ segments = explode ( '.' , $ token ) ; if ( 3 !== count ( $ segments ) ) { throw new Exception ( "Malformed jwt received." ) ; } return $ segments ; }
Verify the number of segments to assert a valid token

@param string $token
@return array
@throws Exception
Verify the number of segments to assert a valid token