From c0273cad4e3cbf4e27a332bb68fe234d6c79bcf0 Mon Sep 17 00:00:00 2001 From: Jim Mason Date: Sun, 1 Dec 2024 10:01:53 +0000 Subject: [PATCH] Rname engine implementation classes for PSR-4 autoloading (#490) --- engine/Engine.php | 16 ---------------- engine/impl/{Artwork.php => ArtworkImpl.php} | 0 engine/impl/{Chart.php => ChartImpl.php} | 0 engine/impl/{DJ.php => DJImpl.php} | 0 engine/impl/{Editor.php => EditorImpl.php} | 0 engine/impl/{Library.php => LibraryImpl.php} | 0 engine/impl/{Playlist.php => PlaylistImpl.php} | 0 engine/impl/{Review.php => ReviewImpl.php} | 0 engine/impl/{User.php => UserImpl.php} | 0 9 files changed, 16 deletions(-) rename engine/impl/{Artwork.php => ArtworkImpl.php} (100%) rename engine/impl/{Chart.php => ChartImpl.php} (100%) rename engine/impl/{DJ.php => DJImpl.php} (100%) rename engine/impl/{Editor.php => EditorImpl.php} (100%) rename engine/impl/{Library.php => LibraryImpl.php} (100%) rename engine/impl/{Playlist.php => PlaylistImpl.php} (100%) rename engine/impl/{Review.php => ReviewImpl.php} (100%) rename engine/impl/{User.php => UserImpl.php} (100%) diff --git a/engine/Engine.php b/engine/Engine.php index facc8959..8e726128 100644 --- a/engine/Engine.php +++ b/engine/Engine.php @@ -35,26 +35,10 @@ class Engine { private static array $apiCache = []; - /* - * install autoloader for the engine implementation classes - */ - private static function customAutoloader() { - spl_autoload_register(function($class) { - // search for file without Impl suffix in the 'impl' subdir - $prefix = str_replace("\\", "\\x5c", __NAMESPACE__."\\"); - if(preg_match("/{$prefix}(.+)Impl$/", $class, $matches) && - is_file($path = __DIR__."/impl/{$matches[1]}.php")) { - include $path; - } - }); - } - /** * start of day initialization */ public static function init() { - self::customAutoloader(); - // application configuration file self::$config = new Config('config'); diff --git a/engine/impl/Artwork.php b/engine/impl/ArtworkImpl.php similarity index 100% rename from engine/impl/Artwork.php rename to engine/impl/ArtworkImpl.php diff --git a/engine/impl/Chart.php b/engine/impl/ChartImpl.php similarity index 100% rename from engine/impl/Chart.php rename to engine/impl/ChartImpl.php diff --git a/engine/impl/DJ.php b/engine/impl/DJImpl.php similarity index 100% rename from engine/impl/DJ.php rename to engine/impl/DJImpl.php diff --git a/engine/impl/Editor.php b/engine/impl/EditorImpl.php similarity index 100% rename from engine/impl/Editor.php rename to engine/impl/EditorImpl.php diff --git a/engine/impl/Library.php b/engine/impl/LibraryImpl.php similarity index 100% rename from engine/impl/Library.php rename to engine/impl/LibraryImpl.php diff --git a/engine/impl/Playlist.php b/engine/impl/PlaylistImpl.php similarity index 100% rename from engine/impl/Playlist.php rename to engine/impl/PlaylistImpl.php diff --git a/engine/impl/Review.php b/engine/impl/ReviewImpl.php similarity index 100% rename from engine/impl/Review.php rename to engine/impl/ReviewImpl.php diff --git a/engine/impl/User.php b/engine/impl/UserImpl.php similarity index 100% rename from engine/impl/User.php rename to engine/impl/UserImpl.php