PHP 클래스 Webiny\Component\ClassLoader\ClassLoader

파일 보기 프로젝트 열기: Webiny/Framework 1 사용 예제들

공개 메소드들

메소드 설명
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.