PHP Класс Webiny\Component\ClassLoader\ClassLoader

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
findClass ( string $class ) : string | boolean Tries to get the path to the class based on registered maps.
getClass ( string $class ) : boolean Tries to find the class file based on currently registered rules.
getClassFromCache ( string $class ) : boolean First tries to find the class in the cache. If the class is not found in the cache, then it tries to find it by using the registered maps.
getInstance ( ) Get an instance of ClassLoader.
registerCacheDriver ( CacheStorage $cache ) Sets a cache layer in front of the autoloader.
registerMap ( array $maps ) Register a namespace or PEAR map rule.
unregisterMap ( string $mapPrefix ) : boolean Removes the given map prefix from class loader.

Приватные методы

Метод Описание
__construct ( ) Base constructor.
registerAutoloader ( ) Registers SPL autoload function.

Описание методов

findClass() публичный Метод

Tries to get the path to the class based on registered maps.
public findClass ( string $class ) : string | boolean
$class string The name of the class
Результат string | boolean The path, if found, or false.

getClass() публичный Метод

Tries to find the class file based on currently registered rules.
public getClass ( string $class ) : boolean
$class string Name of the class you are trying to find.
Результат boolean True is returned if the class if found and loaded into memory.

getClassFromCache() публичный Метод

First tries to find the class in the cache. If the class is not found in the cache, then it tries to find it by using the registered maps.
public getClassFromCache ( string $class ) : boolean
$class string Name of the class you are trying to find.
Результат boolean True is retuned if the class if found and loaded into memory.

getInstance() публичный статический Метод

Get an instance of ClassLoader.
public static getInstance ( )

registerCacheDriver() публичный Метод

Unregister the old ClassLoader::getClass autoload method.
public registerCacheDriver ( CacheStorage $cache )
$cache Webiny\Component\Cache\CacheStorage Instance of the \Webiny\Component\Cache\Cache class.

registerMap() публичный Метод

NOTE: PEAR rules must end with an underline '_'.
public registerMap ( array $maps )
$maps array - Array of maps rules. An example rule is ['Webiny' => '/var/WebinyFramework/library']

unregisterMap() публичный Метод

Removes the given map prefix from class loader.
public unregisterMap ( string $mapPrefix ) : boolean
$mapPrefix string Map prefix that should be removed.
Результат boolean Returns true if the map prefix was found and removed, otherwise false.