Code Duplication    Length = 18-18 lines in 2 locations

src/Dropbox/Dropbox.php 2 locations

@@ 514-531 (lines=18) @@
511
     * @link https://www.dropbox.com/developers/documentation/http/documentation#files-delete
512
     *
513
     */
514
    public function delete($path)
515
    {
516
        //Path cannot be null
517
        if (is_null($path)) {
518
            throw new DropboxClientException("Path cannot be null.");
519
        }
520
521
        //Delete
522
        $response = $this->postToAPI('/files/delete_v2', ['path' => $path]);
523
        $body = $response->getDecodedBody();
524
525
        //Response doesn't have Metadata
526
        if (!isset($body['metadata']) || !is_array($body['metadata'])) {
527
            throw new DropboxClientException("Invalid Response.");
528
        }
529
530
        return new DeletedMetadata($body['metadata']);
531
    }
532
533
    /**
534
     * Move a file or folder to a different location
@@ 715-732 (lines=18) @@
712
     * @link https://www.dropbox.com/developers/documentation/http/documentation#files-save_url
713
     *
714
     */
715
    public function saveUrl($path, $url)
716
    {
717
        //Path and URL cannot be null
718
        if (is_null($path) || is_null($url)) {
719
            throw new DropboxClientException("Path and URL cannot be null.");
720
        }
721
722
        //Save URL
723
        $response = $this->postToAPI('/files/save_url', ['path' => $path, 'url' => $url]);
724
        $body = $response->getDecodedBody();
725
726
        if (!isset($body['async_job_id'])) {
727
            throw new DropboxClientException("Could not retrieve Async Job ID.");
728
        }
729
730
        //Return the Async Job ID
731
        return $body['async_job_id'];
732
    }
733
734
    /**
735
     * Save a specified URL into a file in user's Dropbox