Code Duplication    Length = 14-15 lines in 2 locations

php/JodelAccount.php 2 locations

@@ 130-143 (lines=14) @@
127
        
128
        $location = new Location();
129
        
130
        if ($result->num_rows > 0)
131
        {
132
            // output data of each row
133
            while($row = $result->fetch_assoc())
134
            {
135
                $location->setLat($row['lat']);
136
                $location->setLng($row['lng']);
137
                $location->setCityName($row['name']);
138
            }
139
        }
140
        else
141
        {
142
            error_log("Error no Location found - getLocation");
143
        }
144
145
        if($location->getLat() == $lat && $location->getLng() == $lng && $location->getCityName() == $name)
146
        {
@@ 218-232 (lines=15) @@
215
        
216
        $location = new Location();
217
        
218
        if ($result->num_rows > 0)
219
        {
220
            // output data of each row
221
            while($row = $result->fetch_assoc())
222
            {
223
                $location->setLat($row['lat']);
224
                $location->setLng($row['lng']);
225
                $location->setCityName($row['name']);
226
            }
227
        }
228
        else
229
        {
230
            echo "Error: 0 results";
231
            error_log("Error no Location found - getLocation");
232
        }
233
234
        return $location;
235
    }