-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2eb442
commit 28f4d5c
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/* | ||
* This file is part of the Shieldon package. | ||
* | ||
* (c) Terry L. <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Register to PSR-4 autoloader. | ||
* | ||
* @return void | ||
*/ | ||
function psr_http_register() | ||
{ | ||
spl_autoload_register('psr_http_autoload', true, false); | ||
} | ||
|
||
/** | ||
* PSR-4 autoloader. | ||
* | ||
* @param string $className | ||
* | ||
* @return void | ||
*/ | ||
function psr_http_autoload($className) | ||
{ | ||
$prefix = 'Shieldon\\'; | ||
$dir = __DIR__ . '/src'; | ||
|
||
if (0 === strpos($className, $prefix . 'Psr')) { | ||
$parts = explode('\\', substr($className, strlen($prefix))); | ||
$filepath = $dir . '/' . implode('/', $parts) . '.php'; | ||
|
||
echo $filepath . '<br >'; | ||
|
||
if (is_file($filepath)) { | ||
require $filepath; | ||
} | ||
} | ||
} | ||
|
||
psr_http_register(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters