◆ __construct()
- Parameters
-
Implements ClassLoader.
32 $this->parent = $parent;
33 $this->lookup = new \Threaded;
34 $this->classes = new \Threaded;
◆ addPath()
addPath |
( |
|
$path, |
|
|
|
$prepend = false |
|
) |
| |
Adds a path to the lookup list
- Parameters
-
Implements ClassLoader.
45 foreach($this->lookup as $p){
52 $this->
synchronized(
function($path){
54 $this->lookup[] = $path;
55 foreach($entries as $entry){
56 $this->lookup[] = $entry;
60 $this->lookup[] = $path;
◆ findClass()
Returns the path for the class, if any
- Parameters
-
- Returns
- string|null
Implements ClassLoader.
158 $components = explode(
"\\", $name);
160 $baseName = implode(DIRECTORY_SEPARATOR, $components);
163 foreach($this->lookup as $path){
164 if(PHP_INT_SIZE === 8 and file_exists($path . DIRECTORY_SEPARATOR . $baseName .
"__64bit.php")){
165 return $path . DIRECTORY_SEPARATOR . $baseName .
"__64bit.php";
166 }elseif(PHP_INT_SIZE === 4 and file_exists($path . DIRECTORY_SEPARATOR . $baseName .
"__32bit.php")){
167 return $path . DIRECTORY_SEPARATOR . $baseName .
"__32bit.php";
168 }elseif(file_exists($path . DIRECTORY_SEPARATOR . $baseName .
".php")){
169 return $path . DIRECTORY_SEPARATOR . $baseName .
".php";
◆ getAndRemoveLookupEntries()
getAndRemoveLookupEntries |
( |
| ) |
|
|
protected |
66 while($this->
count() > 0){
67 $entries[] = $this->
shift();
◆ getClasses()
Returns an array of the classes loaded
- Returns
- string[]
Implements ClassLoader.
92 foreach($this->classes as $class){
◆ getParent()
◆ loadClass()
Called when there is a class to load
- Parameters
-
- Returns
- bool
Implements ClassLoader.
129 if(!class_exists($name,
false) and !interface_exists($name,
false) and !trait_exists($name,
false)){
136 if(method_exists($name,
"onClassLoaded") and (
new ReflectionClass($name))->getMethod(
"onClassLoaded")->isStatic()){
137 $name::onClassLoaded();
140 $this->classes[] = $name;
◆ register()
register |
( |
|
$prepend = false | ) |
|
Attaches the ClassLoader to the PHP runtime
- Parameters
-
- Returns
- bool
Implements ClassLoader.
115 spl_autoload_register([$this,
"loadClass"],
true, $prepend);
◆ removePath()
Removes a path from the lookup list
- Parameters
-
Implements ClassLoader.
78 foreach($this->lookup as $i => $p){
80 unset($this->lookup[$i]);
The documentation for this class was generated from the following file:
- src/spl/BaseClassLoader.php