Code Duplication    Length = 22-22 lines in 2 locations

src/Dropbox/Dropbox.php 2 locations

@@ 1262-1283 (lines=22) @@
1259
     * @link https://www.dropbox.com/developers/documentation/http/documentation#files-download
1260
     *
1261
     */
1262
    public function download($path, $dropboxFile = null)
1263
    {
1264
        //Path cannot be null
1265
        if (is_null($path)) {
1266
            throw new DropboxClientException("Path cannot be null.");
1267
        }
1268
1269
        //Make Dropbox File if target is specified
1270
        $dropboxFile = $dropboxFile ? $this->makeDropboxFile($dropboxFile, null, null, DropboxFile::MODE_WRITE) : null;
1271
1272
        //Download File
1273
        $response = $this->postToContent('/files/download', ['path' => $path], null, $dropboxFile);
1274
1275
        //Get file metadata from response headers
1276
        $metadata = $this->getMetadataFromResponseHeaders($response);
1277
1278
        //File Contents
1279
        $contents = $dropboxFile ? $this->makeDropboxFile($dropboxFile) : $response->getBody();
1280
1281
        //Make and return a File model
1282
        return new File($metadata, $contents);
1283
    }
1284
1285
	/**
1286
	 * Download a folder as a zip file
@@ 1298-1319 (lines=22) @@
1295
	 * @link https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip
1296
	 *
1297
	 */
1298
	 public function downloadZip($path, $dropboxFile = null)
1299
	 {
1300
		 //Path cannot be null
1301
		 if (is_null($path)) {
1302
			 throw new DropboxClientException("Path cannot be null.");
1303
		 }
1304
1305
		 //Make Dropbox File if target is specified
1306
		 $dropboxFile = $dropboxFile ? $this->makeDropboxFile($dropboxFile, null, null, DropboxFile::MODE_WRITE) : null;
1307
1308
		 //Download File
1309
		 $response = $this->postToContent('/files/download_zip', ['path' => $path], null, $dropboxFile);
1310
1311
		 //Get file metadata from response headers
1312
		 $metadata = $this->getMetadataFromResponseHeaders($response);
1313
1314
		 //File Contents
1315
		 $contents = $dropboxFile ? $this->makeDropboxFile($dropboxFile) : $response->getBody();
1316
1317
		 //Make and return a File model
1318
		 return new File($metadata, $contents);
1319
	}
1320
1321
    /**
1322
     * Get Current Account