public static function resolve(callable $provider, $type, $service, $version)
    {
        // Execute the provider and return the result, if there is one.
        $result = $provider($type, $service, $version);
        if (is_array($result)) {
            return $result;
        }
        
        // Throw an exception with a message depending on the inputs.
        if (!isset(self::$typeMap[$type])) {
            $msg = "The type must be one of: " . implode(', ', self::$typeMap);
        } elseif ($service) {
            $msg = "The {$service} service does not have version: {$version}.";
        } else {
            $msg = "You must specify a service name to retrieve its API data.";
        }

        throw new UnresolvedApiException($msg);
    }
public static function resolve(callable $provider, $type, $service, $version)
    {
        // Execute the provider and return the result, if there is one.
        $result = $provider($type, $service, $version);
        if (is_array($result)) {
            return $result;
        }
        
        // Throw an exception with a message depending on the inputs.
        if (!isset(self::$typeMap[$type])) {
            $msg = "The type must be one of: " . implode(', ', self::$typeMap);
        } elseif ($service) {
            $msg = "The {$service} service does not have version: {$version}.";
        } else {
            $msg = "You must specify a service name to retrieve its API data.";
        }

        throw new UnresolvedApiException($msg);
    }
public static function resolve ( callable $ provider , $ type , $ service , $ version ) { // Execute the provider and return the result, if there is one. $ result = $ provider ( $ type , $ service , $ version ) ; if ( is_array ( $ result ) ) { return $ result ; } // Throw an exception with a message depending on the inputs. if ( ! isset ( self :: $ typeMap [ $ type ] ) ) { $ msg = "The type must be one of: " . implode ( ', ' , self :: $ typeMap ) ; } elseif ( $ service ) { $ msg = "The {$service} service does not have version: {$version}." ; } else { $ msg = "You must specify a service name to retrieve its API data." ; } throw new UnresolvedApiException ( $ msg ) ; }
Resolves an API provider and ensures a non-null return value.

@param callable $provider Provider function to invoke.
@param string   $type     Type of data ('api', 'waiter', 'paginator').
@param string   $service  Service name.
@param string   $version  API version.

@return array
@throws UnresolvedApiException
Resolves an API provider and ensures a non - null return value .