Skip to content

Commit 425e434

Browse files
committed
Autoloader update
1 parent b61487f commit 425e434

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

debian/autoload.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* Autoloader for Debian package context (EaseHtml Widgets).
4+
*
5+
* This file is intended for use in the Debian package build or test environment.
6+
* It loads classes from /usr/share/php/EaseHtml/Widgets/ and subdirectories.
7+
*/
8+
9+
declare(strict_types=1);
10+
11+
// PSR-4 autoloader for 'Ease\\Html\\Widgets' namespace in /usr/share/php/EaseHtml/Widgets/
12+
spl_autoload_register(function ($class) {
13+
if (str_starts_with($class, 'Ease\\Html\\Widgets\\')) {
14+
$path = __DIR__ . '/Widgets/' . substr(str_replace('\\', '/', $class), strlen('Ease\\Html\\Widgets\\')) . '.php';
15+
if (file_exists($path)) {
16+
require_once $path;
17+
}
18+
}
19+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
src/Ease/Html/Widgets/*.php /usr/share/php/EaseHtmlWidgets/Widgets
22
debian/tmp/composer.json /usr/share/php/EaseHtmlWidgets
3+
debian/autoload.php /usr/share/php/EaseHtmlWidgets

0 commit comments

Comments
 (0)