Uploadcare\Api::__setRequestType PHP Méthode

__setRequestType() private méthode

If request type is wrong an Exception will be thrown.
private __setRequestType ( $ch, string $type = 'GET' ) : void
$type string Request type. Options: get, post, put, delete.
Résultat void
    private function __setRequestType($ch, $type = 'GET')
    {
        $this->current_method = strtoupper($type);
        switch ($type) {
            case 'GET':
                break;
            case 'POST':
                curl_setopt($ch, CURLOPT_POST, true);
                break;
            case 'PUT':
                curl_setopt($ch, CURLOPT_PUT, true);
                break;
            case 'DELETE':
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
                break;
            case 'HEAD':
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
                curl_setopt($ch, CURLOPT_NOBODY, true);
                break;
            case 'OPTIONS':
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'OPTIONS');
                break;
            default:
                throw new \Exception('No request type is provided for request. Use post, put, delete, get or appropriate constants.');
        }
    }