private function prepareOptions(?array $get = null, ?array $post = null, ?array $files = null, ?array $headers = null): array
    {
        $options = [
            RequestOptions::QUERY => $get ?: [],
            RequestOptions::HEADERS => $headers ?: [],
        ];
        if (!empty($files)) {
            $elements = [];
            foreach ($post ?: [] as $key => $value) {
                $elements[] = ['name' => $key, 'contents' => (string) $value];
            }
            foreach ($files as $key => $file) {
                if ($file instanceof \SplFileInfo) {
                    $fileName = $file->getFilename();
                    $contents = $file->isFile() ? fopen($file->getRealPath(), 'r') : file_get_contents($file->getPathname());
                } else {
                    $fileName = $key;
                    $contents = $file;
                }
                $elements[] = ['name' => $key, 'contents' => $contents, 'filename' => $fileName];
            }
            $options[RequestOptions::MULTIPART] = $elements;
        } elseif (!empty($post)) {
            $options[RequestOptions::FORM_PARAMS] = $post;
        }

        return $options;
    }
private function prepareOptions(?array $get = null, ?array $post = null, ?array $files = null, ?array $headers = null): array
    {
        $options = [
            RequestOptions::QUERY => $get ?: [],
            RequestOptions::HEADERS => $headers ?: [],
        ];
        if (!empty($files)) {
            $elements = [];
            foreach ($post ?: [] as $key => $value) {
                $elements[] = ['name' => $key, 'contents' => (string) $value];
            }
            foreach ($files as $key => $file) {
                if ($file instanceof \SplFileInfo) {
                    $fileName = $file->getFilename();
                    $contents = $file->isFile() ? fopen($file->getRealPath(), 'r') : file_get_contents($file->getPathname());
                } else {
                    $fileName = $key;
                    $contents = $file;
                }
                $elements[] = ['name' => $key, 'contents' => $contents, 'filename' => $fileName];
            }
            $options[RequestOptions::MULTIPART] = $elements;
        } elseif (!empty($post)) {
            $options[RequestOptions::FORM_PARAMS] = $post;
        }

        return $options;
    }
@todo Fix load from uri
@todo Fix load from string

@param array|null $get
@param array|null $post
@param array|null $files
@param array|null $headers

@return array