Code Duplication    Length = 24-24 lines in 2 locations

src/Client/Cosapi.php 2 locations

@@ 850-873 (lines=24) @@
847
     *
848
     * @return array|mixed.
849
     */
850
    public static function copyFile($bucket, $srcFpath, $dstFpath, $overwrite = false)
851
    {
852
        $srcFpath = self::normalizerPath($srcFpath);
853
        $dstFpath = self::normalizerPath($dstFpath);
854
855
        $url = self::generateResUrl($bucket, $srcFpath);
856
        $sign = Auth::createNonreusableSignature($bucket, $srcFpath);
857
        $data = [
858
            'op'            => 'copy',
859
            'dest_fileid'   => $dstFpath,
860
            'to_over_write' => $overwrite ? 1 : 0,
861
        ];
862
        $req = [
863
            'url'     => $url,
864
            'method'  => 'post',
865
            'timeout' => self::$timeout,
866
            'data'    => $data,
867
            'header'  => [
868
                'Authorization: '.$sign,
869
            ],
870
        ];
871
872
        return self::sendRequest($req);
873
    }
874
875
    /**
876
     * Move a file.
@@ 885-908 (lines=24) @@
882
     *
883
     * @return array
884
     */
885
    public static function moveFile($bucket, $srcFpath, $dstFpath, $overwrite = false)
886
    {
887
        $srcFpath = self::normalizerPath($srcFpath);
888
        $dstFpath = self::normalizerPath($dstFpath);
889
890
        $url = self::generateResUrl($bucket, $srcFpath);
891
        $sign = Auth::createNonreusableSignature($bucket, $srcFpath);
892
        $data = [
893
            'op'            => 'move',
894
            'dest_fileid'   => $dstFpath,
895
            'to_over_write' => $overwrite ? 1 : 0,
896
        ];
897
        $req = [
898
            'url'     => $url,
899
            'method'  => 'post',
900
            'timeout' => self::$timeout,
901
            'data'    => $data,
902
            'header'  => [
903
                'Authorization: '.$sign,
904
            ],
905
        ];
906
907
        return self::sendRequest($req);
908
    }
909
}
910