ThreadSafeClassLoader
Extends pmmp\thread\ThreadSafe
This autoloader can be used and updated from multiple threads. Useful if classes need to be dynamically added after threads have already been started.
This is used to facilitate loading plugin classes, enabling plugins to be loaded after the server has started.
Methods
__construct()
php
public function __construct()addPath()
php
public function addPath(string $namespacePrefix, string $path, bool $prepend = false) : voidappendOrPrependLookupEntry() protected
php
protected function appendOrPrependLookupEntry(\pmmp\thread\ThreadSafeArray $list, string $entry, bool $prepend) : voidfindClass()
php
public function findClass(string $name) : ?stringReturns the path for the class, if any
getAndRemoveLookupEntries() protected
php
protected function getAndRemoveLookupEntries(\pmmp\thread\ThreadSafeArray $list) : arrayloadClass()
php
public function loadClass(string $name) : boolCalled when there is a class to load
normalizePath() protected
php
protected function normalizePath(string $path) : stringregister()
php
public function register(bool $prepend = false) : bool