Code Duplication    Length = 24-24 lines in 2 locations

src/Client/Cosapi.php 2 locations

@@ 840-863 (lines=24) @@
837
     *
838
     * @return array|mixed.
839
     */
840
    public static function copyFile($bucket, $srcFpath, $dstFpath, $overwrite = false)
841
    {
842
        $srcFpath = self::normalizerPath($srcFpath);
843
        $dstFpath = self::normalizerPath($dstFpath);
844
845
        $url = self::generateResUrl($bucket, $srcFpath);
846
        $sign = Auth::createNonreusableSignature($bucket, $srcFpath);
847
        $data = [
848
            'op'            => 'copy',
849
            'dest_fileid'   => $dstFpath,
850
            'to_over_write' => $overwrite ? 1 : 0,
851
        ];
852
        $req = [
853
            'url'     => $url,
854
            'method'  => 'post',
855
            'timeout' => self::$timeout,
856
            'data'    => $data,
857
            'header'  => [
858
                'Authorization: '.$sign,
859
            ],
860
        ];
861
862
        return self::sendRequest($req);
863
    }
864
865
    /**
866
     * Move a file.
@@ 875-898 (lines=24) @@
872
     *
873
     * @return array
874
     */
875
    public static function moveFile($bucket, $srcFpath, $dstFpath, $overwrite = false)
876
    {
877
        $srcFpath = self::normalizerPath($srcFpath);
878
        $dstFpath = self::normalizerPath($dstFpath);
879
880
        $url = self::generateResUrl($bucket, $srcFpath);
881
        $sign = Auth::createNonreusableSignature($bucket, $srcFpath);
882
        $data = [
883
            'op'            => 'move',
884
            'dest_fileid'   => $dstFpath,
885
            'to_over_write' => $overwrite ? 1 : 0,
886
        ];
887
        $req = [
888
            'url'     => $url,
889
            'method'  => 'post',
890
            'timeout' => self::$timeout,
891
            'data'    => $data,
892
            'header'  => [
893
                'Authorization: '.$sign,
894
            ],
895
        ];
896
897
        return self::sendRequest($req);
898
    }
899
}
900