PHP 클래스 Kahlan\Jit\Interceptor

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

보호된 프로퍼티들

프로퍼티 타입 설명
$_add string Method name for adding a set of PSR-0 directories.
$_addPsr4 string Method name for adding a set of PSR-4 directories.
$_cachePath string Cache path. If false the caching is not enable.
$_exclude array Namespaces/classes which must not be patched.
$_findFile string Method name for finding files on original autoloader.
$_getPrefixes string Method name for adding a set of PSR-0 directories.
$_getPrefixesPsr4 string Method name for adding a set of PSR-4 directories.
$_include array Allowed namespaces/classes for being patched (if empty, mean all is allowed).
$_interceptor array Overrided loader reference.
$_loadClass string Method name for loading a class.
$_originalLoader array The patched loader reference.
$_patchers object The patchers container.
$_watched integer Additionnal watched files.
$_watchedTimestamp integer Most recent modification timestamps of the watched files.

공개 메소드들

메소드 설명
__call ( $method, $params ) : mixed Delegates call to original autoloader
__construct ( array $options = [] ) Constructs
allowed ( string $class ) : boolean Checks if a class is allowed to be patched.
cache ( string $file, string $content, $timestamp = null ) : string Cache helper.
cachePath ( ) : string Returns the cache path.
cached ( string $file ) : string | boolean Gets a cached file path.
clearCache ( ) Clear the cache.
composer ( ) : mixed Look for the composer autoloader.
findFile ( string $class ) : string | false Finds the path to the file where the class is defined.
findPath ( string $namespace, boolean $forceDir = false ) : string | null Returns the path of a namespace or fully namespaced class name.
getPrefixes ( ) : array Returns both PSR-0 & PSR-4 prefixes and related paths.
instance ( ) : object | null Returns the interceptor autoloader instance.
load ( $interceptor = null ) : boolean Loads an interceptor autoloader.
loadClass ( string $class ) : boolean | null Loads the given class or interface.
loadFile ( $filepath ) : boolean Loads a file.
loadFiles ( $files ) Manualy load files.
loader ( ) : array Returns the interceptor autoload function.
originalInstance ( ) : array Returns the patched autoloader instance.
originalLoader ( ) : array Returns the patched autoload function.
patch ( array $options = [] ) Patch the autoloader to be intercepted by the current autoloader.
patchable ( string $class ) : boolean Checks if a class can be patched or not.
patchers ( ) : mixed Returns the patchers container.
refreshWatched ( ) Refresh watched file timestamps
unpatch ( ) Restore the original autoloader behavior.
unwatch ( $files ) Unwatch a watched file
watch ( $files ) Sets some file to watch.
watched ( ) : The Returns watched files

보호된 메소드들

메소드 설명
_path ( string $path, boolean $forceDir ) : string | null Build full path according to a root path.

메소드 상세

__call() 공개 메소드

Delegates call to original autoloader
public __call ( $method, $params ) : mixed
$method The method name.
$params The parameters
리턴 mixed

__construct() 공개 메소드

Constructs
public __construct ( array $options = [] )
$options array Options for the constructor.

_path() 보호된 메소드

Build full path according to a root path.
protected _path ( string $path, boolean $forceDir ) : string | null
$path string A root path.
$forceDir boolean Only consider directories paths.
리턴 string | null Returns the found path or `null` if not path is found.

allowed() 공개 메소드

Checks if a class is allowed to be patched.
public allowed ( string $class ) : boolean
$class string The name of the class to check.
리턴 boolean Returns `true` if the class is allowed to be patched, `false` otherwise.

cache() 공개 메소드

Cache helper.
public cache ( string $file, string $content, $timestamp = null ) : string
$file string The source file path.
$content string The patched content to cache.
리턴 string The patched file path or the cache path if called with no params.

cachePath() 공개 메소드

Returns the cache path.
public cachePath ( ) : string
리턴 string

cached() 공개 메소드

Gets a cached file path.
public cached ( string $file ) : string | boolean
$file string The source file path.
리턴 string | boolean The cached file path or `false` if the cached file is not valid or is not cached.

clearCache() 공개 메소드

Clear the cache.
public clearCache ( )

composer() 공개 정적인 메소드

Look for the composer autoloader.
public static composer ( ) : mixed
리턴 mixed The founded composer autolaoder or `null` if not found.

findFile() 공개 메소드

Finds the path to the file where the class is defined.
public findFile ( string $class ) : string | false
$class string The name of the class
리턴 string | false The path if found, false otherwise

findPath() 공개 메소드

Returns the path of a namespace or fully namespaced class name.
public findPath ( string $namespace, boolean $forceDir = false ) : string | null
$namespace string A namespace.
$forceDir boolean Only consider directories paths.
리턴 string | null Returns the found path or `null` if not path is found.

getPrefixes() 공개 메소드

Returns both PSR-0 & PSR-4 prefixes and related paths.
public getPrefixes ( ) : array
리턴 array

instance() 공개 정적인 메소드

Returns the interceptor autoloader instance.
public static instance ( ) : object | null
리턴 object | null

load() 공개 정적인 메소드

Loads an interceptor autoloader.
public static load ( $interceptor = null ) : boolean
리턴 boolean Returns `true` on success, `false` otherwise.

loadClass() 공개 메소드

Loads the given class or interface.
public loadClass ( string $class ) : boolean | null
$class string The name of the class.
리턴 boolean | null Returns `true` if loaded, `null` otherwise.

loadFile() 공개 메소드

Loads a file.
public loadFile ( $filepath ) : boolean
리턴 boolean Returns `true` if loaded, null otherwise.

loadFiles() 공개 메소드

Manualy load files.
public loadFiles ( $files )

loader() 공개 메소드

Returns the interceptor autoload function.
public loader ( ) : array
리턴 array

originalInstance() 공개 메소드

Returns the patched autoloader instance.
public originalInstance ( ) : array
리턴 array

originalLoader() 공개 메소드

Returns the patched autoload function.
public originalLoader ( ) : array
리턴 array

patch() 공개 정적인 메소드

Patch the autoloader to be intercepted by the current autoloader.
public static patch ( array $options = [] )
$options array Options for the interceptor autoloader.

patchable() 공개 메소드

Checks if a class can be patched or not.
public patchable ( string $class ) : boolean
$class string The name of the class to check.
리턴 boolean Returns `true` if the class need to be patched, `false` otherwise.

patchers() 공개 메소드

Returns the patchers container.
public patchers ( ) : mixed
리턴 mixed

refreshWatched() 공개 메소드

Refresh watched file timestamps
public refreshWatched ( )

unpatch() 공개 정적인 메소드

Restore the original autoloader behavior.
public static unpatch ( )

unwatch() 공개 메소드

Unwatch a watched file
public unwatch ( $files )
$files The array of file paths to unwatch.

watch() 공개 메소드

When a watched file is modified, any cached file are invalidated.
public watch ( $files )
$files The array of file paths to watch.

watched() 공개 메소드

Returns watched files
public watched ( ) : The
리턴 The array of wateched file paths.

프로퍼티 상세

$_add 보호되어 있는 프로퍼티

Method name for adding a set of PSR-0 directories.
protected string $_add
리턴 string

$_addPsr4 보호되어 있는 프로퍼티

Method name for adding a set of PSR-4 directories.
protected string $_addPsr4
리턴 string

$_cachePath 보호되어 있는 프로퍼티

Cache path. If false the caching is not enable.
protected string $_cachePath
리턴 string

$_exclude 보호되어 있는 프로퍼티

Namespaces/classes which must not be patched.
protected array $_exclude
리턴 array

$_findFile 보호되어 있는 프로퍼티

Method name for finding files on original autoloader.
protected string $_findFile
리턴 string

$_getPrefixes 보호되어 있는 프로퍼티

Method name for adding a set of PSR-0 directories.
protected string $_getPrefixes
리턴 string

$_getPrefixesPsr4 보호되어 있는 프로퍼티

Method name for adding a set of PSR-4 directories.
protected string $_getPrefixesPsr4
리턴 string

$_include 보호되어 있는 프로퍼티

Allowed namespaces/classes for being patched (if empty, mean all is allowed).
protected array $_include
리턴 array

$_interceptor 보호되어 있는 정적으로 프로퍼티

Overrided loader reference.
protected static array $_interceptor
리턴 array

$_loadClass 보호되어 있는 프로퍼티

Method name for loading a class.
protected string $_loadClass
리턴 string

$_originalLoader 보호되어 있는 프로퍼티

The patched loader reference.
protected array $_originalLoader
리턴 array

$_patchers 보호되어 있는 프로퍼티

The patchers container.
protected object $_patchers
리턴 object

$_watched 보호되어 있는 프로퍼티

Additionnal watched files.
protected int $_watched
리턴 integer

$_watchedTimestamp 보호되어 있는 프로퍼티

Most recent modification timestamps of the watched files.
protected int $_watchedTimestamp
리턴 integer