Code Duplication    Length = 13-13 lines in 5 locations

src/API.php 5 locations

@@ 50-62 (lines=13) @@
47
        }
48
        return false;
49
    }
50
    public function nearestPostcodesFromLongLat($longitude, $latitude)
51
    {
52
        $jsonurl = "https://api.postcodes.io/postcodes?lon=".$longitude."&lat=".$latitude;
53
        $json = $this->request($jsonurl);
54
55
        $decoded = json_decode($json);
56
        if ($decoded->status == 200) {
57
            return $decoded->result;
58
        } else {
59
            return false;
60
        }
61
        return false;
62
    }
63
    public function bulkReverseGeocoding($geolocations)
64
    {
65
        $data_string = json_encode(array('geolocations' => $geolocations));
@@ 124-136 (lines=13) @@
121
    }
122
123
124
    public function nearest($postcode)
125
    {
126
        $jsonurl = "https://api.postcodes.io/postcodes/".$postcode."/nearest";
127
        $json = $this->request($jsonurl);
128
129
        $decoded = json_decode($json);
130
        if ($decoded->status == 200) {
131
            return $decoded->result;
132
        } else {
133
            return false;
134
        }
135
        return false;
136
    }
137
138
139
    public function partial($postcode)
@@ 139-151 (lines=13) @@
136
    }
137
138
139
    public function partial($postcode)
140
    {
141
        $jsonurl = "https://api.postcodes.io/postcodes/".$postcode."/autocomplete";
142
        $json = $this->request($jsonurl);
143
144
        $decoded = json_decode($json);
145
        if ($decoded->status == 200) {
146
            return $decoded->result;
147
        } else {
148
            return false;
149
        }
150
        return false;
151
    }
152
153
154
    public function query($postcode)
@@ 199-211 (lines=13) @@
196
    }
197
198
199
    public function nearestOutwardCode($code)
200
    {
201
        $jsonurl = "https://api.postcodes.io/outcodes/".$code."/nearest";
202
        $json = $this->request($jsonurl);
203
204
        $decoded = json_decode($json);
205
        if ($decoded->status == 200) {
206
            return $decoded->result;
207
        } else {
208
            return false;
209
        }
210
        return false;
211
    }
212
213
214
    public function nearestOutwardCodeFromLongLat($longitude, $latitude)
@@ 214-226 (lines=13) @@
211
    }
212
213
214
    public function nearestOutwardCodeFromLongLat($longitude, $latitude)
215
    {
216
        $jsonurl = "https://api.postcodes.io/outcodes?lon=".$longitude."&lat=".$latitude;
217
        $json = $this->request($jsonurl);
218
219
        $decoded = json_decode($json);
220
        if ($decoded->status == 200) {
221
            return $decoded->result;
222
        } else {
223
            return false;
224
        }
225
        return false;
226
    }
227
228
229
    public function distance($postcode1, $postcode2, $unit)