Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor engine implementation classes for PSR-4 autoloading #490

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions engine/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.