Code Duplication    Length = 10-10 lines in 4 locations

code/BrowseCitiesPage.php 4 locations

@@ 166-175 (lines=10) @@
163
164
            //2 check if continent exists
165
            $ContinentID = $row["ContinentID"];
166
            if ($continentPage = DataObject::get_one("BrowseContinentsPage", 'HiddenDataID = '.$ContinentID)) {
167
                //debug::show("continent exists");
168
            } else {
169
                //create continent
170
                $continents = $abstractHelpPage->getDataFromTable("continents", "ContinentID = ".$ContinentID, null);
171
                foreach ($continents as $continentData) {
172
                    $continentPage = new BrowseContinentsPage();
173
                    $continentPage->CreateContinent($continentData, $worldPage);
174
                }
175
            }
176
177
            //3 check if country exists
178
            $CountryID = $row["CountryID"];
@@ 179-188 (lines=10) @@
176
177
            //3 check if country exists
178
            $CountryID = $row["CountryID"];
179
            if ($countryPage = DataObject::get_one("BrowseCountriesPage", 'HiddenDataID = '.$CountryID)) {
180
                //debug::show("country exists");
181
            } else {
182
                //create Country
183
                $countries = $abstractHelpPage->getDataFromTable("countries", "CountryID = ".$CountryID, null);
184
                foreach ($countries as $countryData) {
185
                    $countryPage = new BrowseCountriesPage();
186
                    $countryPage->CreateCountry($countryData, $continentPage);
187
                }
188
            }
189
190
            //4 check if region exists
191
            $RegionID = $row["RegionID"];
@@ 192-201 (lines=10) @@
189
190
            //4 check if region exists
191
            $RegionID = $row["RegionID"];
192
            if ($regionPage = DataObject::get_one("BrowseRegionsPage", 'HiddenDataID = '.$RegionID)) {
193
                //debug::show("region exists");
194
            } else {
195
                //create region
196
                $regions = $abstractHelpPage->getDataFromTable("regions", "RegionID = ".$RegionID, null);
197
                foreach ($regions as $regionData) {
198
                    $regionPage = new BrowseRegionsPage();
199
                    $regionPage->CreateRegion($regionData, $countryPage);
200
                }
201
            }
202
            if ($cityPage = DataObject::get_one("BrowseCitiesPage", 'HiddenDataID = '.$CityID)) {
203
                //debug::show("city exists");
204
            } else {
@@ 202-211 (lines=10) @@
199
                    $regionPage->CreateRegion($regionData, $countryPage);
200
                }
201
            }
202
            if ($cityPage = DataObject::get_one("BrowseCitiesPage", 'HiddenDataID = '.$CityID)) {
203
                //debug::show("city exists");
204
            } else {
205
                //create region
206
                $cities = $abstractHelpPage->getDataFromTable("cities", "CityID = ".$CityID, null);
207
                foreach ($cities as $city) {
208
                    $cityPage = new BrowseCitiesPage();
209
                    $cityPage->CreateCity($city, $regionPage);
210
                }
211
            }
212
        }
213
        return $cityPage;
214
    }