Code Duplication    Length = 20-21 lines in 2 locations

examples/SafeBrowsing/index.php 1 location

@@ 50-69 (lines=20) @@
47
            throw new SafeBrowsingException('Empty Safe Browsing key');
48
        }
49
50
        if (isset($_GET['url']) && $_GET['url']) {
51
            $url = $_GET['url'];
52
53
            $key = $settings["safebrowsing"]["key"];
54
55
            $safeBrowsing = new SafeBrowsingClient($key);
56
57
            /**
58
             * Using "gethash" request
59
             */
60
            if ($safeBrowsing->searchUrl($url)) {
61
                ?>
62
                <div class="alert alert-danger">Найден полный хеш для "<?= htmlentities($url) ?>" в списке опасных сайтов</div>
63
            <?php
64
            } else {
65
                ?>
66
                <div class="alert alert-success"><?= htmlentities($url) ?> - не найден в списке опасных сайтов</div>
67
            <?php
68
            }
69
        }
70
        ?>
71
72
        <form method="get">

examples/SafeBrowsing/local-search.php 1 location

@@ 89-109 (lines=21) @@
86
            throw new SafeBrowsingException('Empty Safe Browsing key');
87
        }
88
89
        if (isset($_GET['url']) && $_GET['url']) {
90
            $url = $_GET['url'];
91
92
            $key = $settings["safebrowsing"]["key"];
93
94
            $safeBrowsing = new SafeBrowsingClient($key);
95
96
            /**
97
             * Using "gethash" request
98
             */
99
            //If exist local DB of prefixes
100
            if (localSearchUrl($url, $key)) {
101
                ?>
102
                <div class="alert alert-danger">Найден полный хеш для "<?= htmlentities($url) ?>" в списке опасных сайтов</div>
103
            <?php
104
            } else {
105
                ?>
106
                <div class="alert alert-success"><?= htmlentities($url) ?> - не найден в списке опасных сайтов</div>
107
            <?php
108
            }
109
        }
110
        ?>
111
112
        <form method="get">