public function prepareRequestPathForResourceMethod(
        $resourceMethod,
        $id,
        array $resourceMethodConfiguration
    ): string {
        $requestPathFormat = $this->calculateRequestPathFormat($resourceMethod, $resourceMethodConfiguration);

        switch ($resourceMethod) {
            case ResourceMethodEnum::GET_ALL:
            case ResourceMethodEnum::CREATE:
            case ResourceMethodEnum::UPDATE_DEFAULT:
                IdValidator::assertIsNull($id);
                $path = $requestPathFormat;
                break;

            case ResourceMethodEnum::GET_BY_IDS:
                IdValidator::assertIsValidIdArray($id);
                $path = sprintf($requestPathFormat, implode(',', $id));
                break;

            case ResourceMethodEnum::GET_ALL_FOR_FOLDER:
            case ResourceMethodEnum::GET_ALL_FOR_TASK:
            case ResourceMethodEnum::GET_ALL_FOR_CONTACT:
            case ResourceMethodEnum::GET_ALL_FOR_TIMELOG_CATEGORY:
            case ResourceMethodEnum::CREATE_FOR_FOLDER:
            case ResourceMethodEnum::CREATE_FOR_TASK:
            case ResourceMethodEnum::GET_BY_ID:
            case ResourceMethodEnum::UPDATE:
            case ResourceMethodEnum::DELETE:
            case ResourceMethodEnum::COPY:
            case ResourceMethodEnum::DOWNLOAD:
            case ResourceMethodEnum::DOWNLOAD_PREVIEW:
            case ResourceMethodEnum::GET_PUBLIC_URL:
            case ResourceMethodEnum::UPLOAD_FOR_FOLDER:
            case ResourceMethodEnum::UPLOAD_FOR_TASK:
                IdValidator::assertIsValidIdString($id);
                $path = sprintf($requestPathFormat, $id);
                break;

            default:
                throw new \InvalidArgumentException(sprintf('"%s" resource method not yet supported', $resourceMethod));
        }

        return $path;
    }
public function prepareRequestPathForResourceMethod(
        $resourceMethod,
        $id,
        array $resourceMethodConfiguration
    ): string {
        $requestPathFormat = $this->calculateRequestPathFormat($resourceMethod, $resourceMethodConfiguration);

        switch ($resourceMethod) {
            case ResourceMethodEnum::GET_ALL:
            case ResourceMethodEnum::CREATE:
            case ResourceMethodEnum::UPDATE_DEFAULT:
                IdValidator::assertIsNull($id);
                $path = $requestPathFormat;
                break;

            case ResourceMethodEnum::GET_BY_IDS:
                IdValidator::assertIsValidIdArray($id);
                $path = sprintf($requestPathFormat, implode(',', $id));
                break;

            case ResourceMethodEnum::GET_ALL_FOR_FOLDER:
            case ResourceMethodEnum::GET_ALL_FOR_TASK:
            case ResourceMethodEnum::GET_ALL_FOR_CONTACT:
            case ResourceMethodEnum::GET_ALL_FOR_TIMELOG_CATEGORY:
            case ResourceMethodEnum::CREATE_FOR_FOLDER:
            case ResourceMethodEnum::CREATE_FOR_TASK:
            case ResourceMethodEnum::GET_BY_ID:
            case ResourceMethodEnum::UPDATE:
            case ResourceMethodEnum::DELETE:
            case ResourceMethodEnum::COPY:
            case ResourceMethodEnum::DOWNLOAD:
            case ResourceMethodEnum::DOWNLOAD_PREVIEW:
            case ResourceMethodEnum::GET_PUBLIC_URL:
            case ResourceMethodEnum::UPLOAD_FOR_FOLDER:
            case ResourceMethodEnum::UPLOAD_FOR_TASK:
                IdValidator::assertIsValidIdString($id);
                $path = sprintf($requestPathFormat, $id);
                break;

            default:
                throw new \InvalidArgumentException(sprintf('"%s" resource method not yet supported', $resourceMethod));
        }

        return $path;
    }
public function prepareRequestPathForResourceMethod ( $ resourceMethod , $ id , array $ resourceMethodConfiguration ) : string { $ requestPathFormat = $ this -> calculateRequestPathFormat ( $ resourceMethod , $ resourceMethodConfiguration ) ; switch ( $ resourceMethod ) { case ResourceMethodEnum :: GET_ALL : case ResourceMethodEnum :: CREATE : case ResourceMethodEnum :: UPDATE_DEFAULT : IdValidator :: assertIsNull ( $ id ) ; $ path = $ requestPathFormat ; break ; case ResourceMethodEnum :: GET_BY_IDS : IdValidator :: assertIsValidIdArray ( $ id ) ; $ path = sprintf ( $ requestPathFormat , implode ( ',' , $ id ) ) ; break ; case ResourceMethodEnum :: GET_ALL_FOR_FOLDER : case ResourceMethodEnum :: GET_ALL_FOR_TASK : case ResourceMethodEnum :: GET_ALL_FOR_CONTACT : case ResourceMethodEnum :: GET_ALL_FOR_TIMELOG_CATEGORY : case ResourceMethodEnum :: CREATE_FOR_FOLDER : case ResourceMethodEnum :: CREATE_FOR_TASK : case ResourceMethodEnum :: GET_BY_ID : case ResourceMethodEnum :: UPDATE : case ResourceMethodEnum :: DELETE : case ResourceMethodEnum :: COPY : case ResourceMethodEnum :: DOWNLOAD : case ResourceMethodEnum :: DOWNLOAD_PREVIEW : case ResourceMethodEnum :: GET_PUBLIC_URL : case ResourceMethodEnum :: UPLOAD_FOR_FOLDER : case ResourceMethodEnum :: UPLOAD_FOR_TASK : IdValidator :: assertIsValidIdString ( $ id ) ; $ path = sprintf ( $ requestPathFormat , $ id ) ; break ; default : throw new \ InvalidArgumentException ( sprintf ( '"%s" resource method not yet supported' , $ resourceMethod ) ) ; } return $ path ; }
Combine ResourceMethodConfiguration, ResourceMethod and optional Id
to retrieve correct resource path for request.

@param string            $resourceMethod
@param string|array|null $id
@param array             $resourceMethodConfiguration

@SuppressWarnings(PHPMD.CyclomaticComplexity)

@throws \InvalidArgumentException

@return string
Combine ResourceMethodConfiguration ResourceMethod and optional Id to retrieve correct resource path for request .