Code Duplication    Length = 24-24 lines in 2 locations

src/Client/Cosapi.php 2 locations

@@ 772-795 (lines=24) @@
769
     *
770
     * @return array|mixed.
771
     */
772
    public static function copyFile($bucket, $srcFpath, $dstFpath, $overwrite = false)
773
    {
774
        $srcFpath = self::normalizerPath($srcFpath);
775
        $dstFpath = self::normalizerPath($dstFpath);
776
777
        $url = self::generateResUrl($bucket, $srcFpath);
778
        $sign = Auth::createNonreusableSignature($bucket, $srcFpath);
779
        $data = [
780
            'op'            => 'copy',
781
            'dest_fileid'   => $dstFpath,
782
            'to_over_write' => $overwrite ? 1 : 0,
783
        ];
784
        $req = [
785
            'url'     => $url,
786
            'method'  => 'post',
787
            'timeout' => self::$timeout,
788
            'data'    => $data,
789
            'header'  => [
790
                'Authorization: '.$sign,
791
            ],
792
        ];
793
794
        return self::sendRequest($req);
795
    }
796
797
    /**
798
     * Move a file.
@@ 807-830 (lines=24) @@
804
     *
805
     * @return array|mixed.
806
     */
807
    public static function moveFile($bucket, $srcFpath, $dstFpath, $overwrite = false)
808
    {
809
        $srcFpath = self::normalizerPath($srcFpath);
810
        $dstFpath = self::normalizerPath($dstFpath);
811
812
        $url = self::generateResUrl($bucket, $srcFpath);
813
        $sign = Auth::createNonreusableSignature($bucket, $srcFpath);
814
        $data = [
815
            'op'            => 'move',
816
            'dest_fileid'   => $dstFpath,
817
            'to_over_write' => $overwrite ? 1 : 0,
818
        ];
819
        $req = [
820
            'url'     => $url,
821
            'method'  => 'post',
822
            'timeout' => self::$timeout,
823
            'data'    => $data,
824
            'header'  => [
825
                'Authorization: '.$sign,
826
            ],
827
        ];
828
829
        return self::sendRequest($req);
830
    }
831
}
832