Skip to content

Commit

Permalink
Rname engine implementation classes for PSR-4 autoloading (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan authored Dec 1, 2024
1 parent 6d053ee commit c0273ca
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 16 deletions.
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.

0 comments on commit c0273ca

Please sign in to comment.