Code Duplication    Length = 22-22 lines in 2 locations

src/Dropbox/Dropbox.php 2 locations

@@ 1229-1250 (lines=22) @@
1226
     * @link https://www.dropbox.com/developers/documentation/http/documentation#files-download
1227
     *
1228
     */
1229
    public function download($path, $dropboxFile = null)
1230
    {
1231
        //Path cannot be null
1232
        if (is_null($path)) {
1233
            throw new DropboxClientException("Path cannot be null.");
1234
        }
1235
1236
        //Make Dropbox File if target is specified
1237
        $dropboxFile = $dropboxFile ? $this->makeDropboxFile($dropboxFile, null, null, DropboxFile::MODE_WRITE) : null;
1238
1239
        //Download File
1240
        $response = $this->postToContent('/files/download', ['path' => $path], null, $dropboxFile);
1241
1242
        //Get file metadata from response headers
1243
        $metadata = $this->getMetadataFromResponseHeaders($response);
1244
1245
        //File Contents
1246
        $contents = $dropboxFile ? $this->makeDropboxFile($dropboxFile) : $response->getBody();
1247
1248
        //Make and return a File model
1249
        return new File($metadata, $contents);
1250
    }
1251
1252
	/**
1253
	 * Download a folder as a zip file
@@ 1265-1286 (lines=22) @@
1262
	 * @link https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip
1263
	 *
1264
	 */
1265
	 public function downloadZip($path, $dropboxFile = null)
1266
	 {
1267
		 //Path cannot be null
1268
		 if (is_null($path)) {
1269
			 throw new DropboxClientException("Path cannot be null.");
1270
		 }
1271
1272
		 //Make Dropbox File if target is specified
1273
		 $dropboxFile = $dropboxFile ? $this->makeDropboxFile($dropboxFile, null, null, DropboxFile::MODE_WRITE) : null;
1274
1275
		 //Download File
1276
		 $response = $this->postToContent('/files/download_zip', ['path' => $path], null, $dropboxFile);
1277
1278
		 //Get file metadata from response headers
1279
		 $metadata = $this->getMetadataFromResponseHeaders($response);
1280
1281
		 //File Contents
1282
		 $contents = $dropboxFile ? $this->makeDropboxFile($dropboxFile) : $response->getBody();
1283
1284
		 //Make and return a File model
1285
		 return new File($metadata, $contents);
1286
	}
1287
1288
    /**
1289
     * Get Current Account