Code Duplication    Length = 14-15 lines in 2 locations

php/JodelAccount.php 2 locations

@@ 71-84 (lines=14) @@
68
        
69
        $location = new Location();
70
        
71
        if ($result->num_rows > 0)
72
        {
73
            // output data of each row
74
            while($row = $result->fetch_assoc())
75
            {
76
                $location->setLat($row['lat']);
77
                $location->setLng($row['lng']);
78
                $location->setCityName($row['name']);
79
            }
80
        }
81
        else
82
        {
83
            error_log("Error no Location found - getLocation");
84
        }
85
86
        if($location->getLat() == $lat && $location->getLng() == $lng && $location->getCityName() == $name)
87
        {
@@ 159-173 (lines=15) @@
156
        
157
        $location = new Location();
158
        
159
        if ($result->num_rows > 0)
160
        {
161
            // output data of each row
162
            while($row = $result->fetch_assoc())
163
            {
164
                $location->setLat($row['lat']);
165
                $location->setLng($row['lng']);
166
                $location->setCityName($row['name']);
167
            }
168
        }
169
        else
170
        {
171
            echo "Error: 0 results";
172
            error_log("Error no Location found - getLocation");
173
        }
174
175
        return $location;
176
    }