Code Duplication    Length = 7-7 lines in 2 locations

src/API/MediaApi.php 2 locations

@@ 111-117 (lines=7) @@
108
        $file_tail = explode("/", $rest['type']);
109
110
        /* 判断是不是阿里云服务器 */
111
        if ($rest['header']['Server'] == 'AliyunOSS') {
112
            $imgType      = substr($url, strrpos($url, '.') + 1);
113
            $file_type    = $type . '/' . $imgType;
114
            $file_tail[1] = $imgType;
115
        } else {
116
            $file_type = $rest['type'];
117
        }
118
119
        $this->setPostQueryStr('type', $type);
120
@@ 322-328 (lines=7) @@
319
        $file_tail = explode("/", $rest['type']);
320
321
        /* 判断是不是阿里云服务器 */
322
        if ($rest['header']['Server'] == 'AliyunOSS') {
323
            $imgType      = substr($url, strrpos($url, '.') + 1);
324
            $file_type    = 'image/' . $imgType;
325
            $file_tail[1] = $imgType;
326
        } else {
327
            $file_type = $rest['type'];
328
        }
329
330
        $name      = 'media';
331
        $file_name = md5(uniqid(rand(1000, 9999))) . '.' . $file_tail[1]; // 设置上传文件名