Code Duplication    Length = 14-15 lines in 2 locations

php/JodelAccount.php 2 locations

@@ 117-130 (lines=14) @@
114
        
115
        $location = new Location();
116
        
117
        if ($result->num_rows > 0)
118
        {
119
            // output data of each row
120
            while($row = $result->fetch_assoc())
121
            {
122
                $location->setLat($row['lat']);
123
                $location->setLng($row['lng']);
124
                $location->setCityName($row['name']);
125
            }
126
        }
127
        else
128
        {
129
            error_log("Error no Location found - getLocation");
130
        }
131
132
        if($location->getCityName() == $city)
133
        {
@@ 205-219 (lines=15) @@
202
        
203
        $location = new Location();
204
        
205
        if ($result->num_rows > 0)
206
        {
207
            // output data of each row
208
            while($row = $result->fetch_assoc())
209
            {
210
                $location->setLat($row['lat']);
211
                $location->setLng($row['lng']);
212
                $location->setCityName($row['name']);
213
            }
214
        }
215
        else
216
        {
217
            echo "Error: 0 results";
218
            error_log("Error no Location found - getLocation");
219
        }
220
221
        return $location;
222
    }