Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793833
Autoloader.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1017 B
Referenced Files
None
Subscribers
None
Autoloader.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\OmniTools\Registration\PSR4
;
use
Keruald\OmniTools\Reflection\CodeFile
;
final
class
Autoloader
{
///
/// Private members
///
/**
* @var string
*/
private
$namespace
;
/**
* @var string The base path where files for this namespace are located
*/
private
$path
;
///
/// Constructor
///
public
function
__construct
(
string
$namespace
,
string
$path
)
{
$this
->
namespace
=
$namespace
;
$this
->
path
=
$path
;
}
///
/// Public methods
///
public
function
getSolver
(
string
$class
)
:
Solver
{
return
new
Solver
(
$this
->
namespace
,
$this
->
path
,
$class
);
}
public
function
register
()
:
void
{
spl_autoload_register
(
function
(
$class
)
{
$solver
=
$this
->
getSolver
(
$class
);
if
(!
$solver
->
canResolve
())
{
return
;
}
CodeFile
::
from
(
$solver
->
resolve
())->
tryInclude
();
});
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 22:47 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2437682
Default Alt Text
Autoloader.php (1017 B)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment