@@ -225,16 +225,7 @@ public function loadClass(string $class)
225225 $ class = trim ($ class , '\\' );
226226 $ class = str_ireplace ('.php ' , '' , $ class );
227227
228- $ mapped_file = $ this ->loadInNamespace ($ class );
229-
230- // Nothing? One last chance by looking
231- // in common CodeIgniter folders.
232- if (! $ mapped_file )
233- {
234- $ mapped_file = $ this ->loadLegacy ($ class );
235- }
236-
237- return $ mapped_file ;
228+ return $ this ->loadInNamespace ($ class );
238229 }
239230
240231 //--------------------------------------------------------------------
@@ -287,45 +278,6 @@ protected function loadInNamespace(string $class)
287278
288279 //--------------------------------------------------------------------
289280
290- /**
291- * Attempts to load the class from common locations in previous
292- * version of CodeIgniter, namely 'app/Libraries', and
293- * 'app/Models'.
294- *
295- * @param string $class The class name. This typically should NOT have a namespace.
296- *
297- * @return mixed The mapped file name on success, or boolean false on failure
298- */
299- protected function loadLegacy (string $ class )
300- {
301- // If there is a namespace on this class, then
302- // we cannot load it from traditional locations.
303- if (strpos ($ class , '\\' ) !== false )
304- {
305- return false ;
306- }
307-
308- $ paths = [
309- APPPATH . 'Controllers/ ' ,
310- APPPATH . 'Libraries/ ' ,
311- APPPATH . 'Models/ ' ,
312- ];
313-
314- $ class = str_replace ('\\' , DIRECTORY_SEPARATOR , $ class ) . '.php ' ;
315-
316- foreach ($ paths as $ path )
317- {
318- if ($ file = $ this ->includeFile ($ path . $ class ))
319- {
320- return $ file ;
321- }
322- }
323-
324- return false ;
325- }
326-
327- //--------------------------------------------------------------------
328-
329281 /**
330282 * A central way to include a file. Split out primarily for testing purposes.
331283 *
0 commit comments