Code Duplication    Length = 18-18 lines in 2 locations

src/Dropbox/Dropbox.php 2 locations

@@ 562-579 (lines=18) @@
559
     * @link https://www.dropbox.com/developers/documentation/http/documentation#files-delete
560
     *
561
     */
562
    public function delete($path)
563
    {
564
        //Path cannot be null
565
        if (is_null($path)) {
566
            throw new DropboxClientException("Path cannot be null.");
567
        }
568
569
        //Delete
570
        $response = $this->postToAPI('/files/delete_v2', ['path' => $path]);
571
        $body = $response->getDecodedBody();
572
573
        //Response doesn't have Metadata
574
        if (!isset($body['metadata']) || !is_array($body['metadata'])) {
575
            throw new DropboxClientException("Invalid Response.");
576
        }
577
578
        return new DeletedMetadata($body['metadata']);
579
    }
580
581
    /**
582
     * Move a file or folder to a different location
@@ 764-781 (lines=18) @@
761
     * @link https://www.dropbox.com/developers/documentation/http/documentation#files-save_url
762
     *
763
     */
764
    public function saveUrl($path, $url)
765
    {
766
        //Path and URL cannot be null
767
        if (is_null($path) || is_null($url)) {
768
            throw new DropboxClientException("Path and URL cannot be null.");
769
        }
770
771
        //Save URL
772
        $response = $this->postToAPI('/files/save_url', ['path' => $path, 'url' => $url]);
773
        $body = $response->getDecodedBody();
774
775
        if (!isset($body['async_job_id'])) {
776
            throw new DropboxClientException("Could not retrieve Async Job ID.");
777
        }
778
779
        //Return the Async Job ID
780
        return $body['async_job_id'];
781
    }
782
783
    /**
784
     * Save a specified URL into a file in user's Dropbox