Code Duplication    Length = 14-14 lines in 2 locations

src/Authorized.php 1 location

@@ 30-43 (lines=14) @@
27
        exit($editorSrc);
28
    }
29
30
    public function current()
31
    {
32
        $protocol = (!empty($_SERVER['HTTPS'])
33
            && $_SERVER['HTTPS'] !== 'off'
34
            || $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://';
35
36
        if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
37
            $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
38
        } else {
39
            $host = $_SERVER['HTTP_HOST'];
40
        }
41
42
        return $protocol . $host . '/';
43
    }
44
45
    /**
46
     * 使用授权码换取公众号的接口调用凭据和授权信息

src/OpenAuth.php 1 location

@@ 40-53 (lines=14) @@
37
     *
38
     * @return string
39
     */
40
    public static function current()
41
    {
42
        $protocol = (!empty($_SERVER['HTTPS'])
43
            && $_SERVER['HTTPS'] !== 'off'
44
            || $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://';
45
46
        if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
47
            $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
48
        } else {
49
            $host = $_SERVER['HTTP_HOST'];
50
        }
51
52
        return $protocol . $host . $_SERVER['REQUEST_URI'];
53
    }
54
55
    /**
56
     * 生成outh URL