Code Duplication    Length = 14-15 lines in 2 locations

php/JodelAccount.php 2 locations

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