public static function getInstance($method, CURLConfiguration $configuration = null, $resourcePath = null) {

        // Check the configuration.
        if (null === $configuration) {
            $configuration = new CURLConfiguration();
        }

        // Switch into $method.
        switch ($method) {

            case self::HTTP_METHOD_DELETE:
                return new CURLDeleteRequest($configuration, $resourcePath);

            case self::HTTP_METHOD_GET:
                return new CURLGetRequest($configuration, $resourcePath);

            case self::HTTP_METHOD_HEAD:
                return new CURLHeadRequest($configuration, $resourcePath);

            case self::HTTP_METHOD_OPTIONS:
                return new CURLOptionsRequest($configuration, $resourcePath);

            case self::HTTP_METHOD_PATCH:
                return new CURLPatchRequest($configuration, $resourcePath);

            case self::HTTP_METHOD_POST:
                return new CURLPostRequest($configuration, $resourcePath);

            case self::HTTP_METHOD_PUT:
                return new CURLPutRequest($configuration, $resourcePath);

            default:
                throw new InvalidHTTPMethodException($method);
        }
    }