-
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathautoload.php
More file actions
26 lines (21 loc) · 638 Bytes
/
autoload.php
File metadata and controls
26 lines (21 loc) · 638 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/**
* League.Period (https://period.thephpleague.com)
*
* (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
spl_autoload_register(function (string $className): void {
static $length = 14; //strlen($prefix)
$prefix = 'League\Period\\';
if (!str_starts_with($className, $prefix)) {
return;
}
$file = __DIR__.'/src/'.str_replace('\\', '/', substr($className, $length)).'.php';
if (is_readable($file)) {
require $file;
}
});