protected function copy_file(\repository_googledocs\rest $client, $fileid, $name) {
        $fields = "id,name,mimeType,webContentLink,webViewLink,size,thumbnailLink,iconLink";
        $params = [
            'fileid' => $fileid,
            'fields' => $fields,
        ];
        // Keep the original name (don't put copy at the end of it).
        $copyinfo = [];
        if (!empty($name)) {
            $copyinfo = [ 'name' => $name ];
        }
        $fileinfo = $client->call('copy', $params, json_encode($copyinfo));
        if (empty($fileinfo->id)) {
            $details = 'Cannot copy file:' . $fileid;
            throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
        }
        return $fileinfo;
    }
protected function copy_file(\repository_googledocs\rest $client, $fileid, $name) {
        $fields = "id,name,mimeType,webContentLink,webViewLink,size,thumbnailLink,iconLink";
        $params = [
            'fileid' => $fileid,
            'fields' => $fields,
        ];
        // Keep the original name (don't put copy at the end of it).
        $copyinfo = [];
        if (!empty($name)) {
            $copyinfo = [ 'name' => $name ];
        }
        $fileinfo = $client->call('copy', $params, json_encode($copyinfo));
        if (empty($fileinfo->id)) {
            $details = 'Cannot copy file:' . $fileid;
            throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
        }
        return $fileinfo;
    }
protected function copy_file ( \ repository_googledocs \ rest $ client , $ fileid , $ name ) { $ fields = "id,name,mimeType,webContentLink,webViewLink,size,thumbnailLink,iconLink" ; $ params = [ 'fileid' => $ fileid , 'fields' => $ fields , ] ; // Keep the original name (don't put copy at the end of it). $ copyinfo = [ ] ; if ( ! empty ( $ name ) ) { $ copyinfo = [ 'name' => $ name ] ; } $ fileinfo = $ client -> call ( 'copy' , $ params , json_encode ( $ copyinfo ) ) ; if ( empty ( $ fileinfo -> id ) ) { $ details = 'Cannot copy file:' . $ fileid ; throw new repository_exception ( 'errorwhilecommunicatingwith' , 'repository' , '' , $ details ) ; } return $ fileinfo ; }
Copy a file and return the new file details. A side effect of the copy
is that the owner will be the account authenticated with this oauth client.

@param \repository_googledocs\rest $client Authenticated client.
@param string $fileid The file we are copying.
@param string $name The original filename (don't change it).

@return stdClass file details.
Copy a file and return the new file details . A side effect of the copy is that the owner will be the account authenticated with this oauth client .