File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * @see https://github.com/php-fig/fig-standards/blob/a1a0674a742c9d07c5dd450209fb33b115ee7b40/accepted/PSR-4-autoloader-examples.md#closure-example
5
+ */
6
+ spl_autoload_register (static function (string $ class ): void {
7
+ $ prefix = 'phpweb \\' ;
8
+
9
+ $ directory = __DIR__ . '/src/ ' ;
10
+
11
+ $ length = strlen ($ prefix );
12
+
13
+ if (strncmp ($ prefix , $ class , $ length ) !== 0 ) {
14
+ return ;
15
+ }
16
+
17
+ $ relativeClass = substr (
18
+ $ class ,
19
+ $ length
20
+ );
21
+
22
+ $ file = $ directory . str_replace ('\\' , '/ ' , $ relativeClass ) . '.php ' ;
23
+
24
+ if (!file_exists ($ file )) {
25
+ return ;
26
+ }
27
+
28
+ require $ file ;
29
+ });
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ $PGI = array(); $SIDEBAR_DATA = '';
23
23
// User note display functions
24
24
// =============================================================================
25
25
26
- require_once __DIR__ . ' /../src/UserNotes/Sorter .php' ;
26
+ require_once __DIR__ . ' /../autoload .php' ;
27
27
use phpweb\UserNotes\Sorter;
28
28
29
29
// Print out all user notes for this manual page
You can’t perform that action at this time.
0 commit comments