PHP 클래스 Phergie_Plugin_Handler, phergie

저자: Phergie Development Team ([email protected])
상속: implements IteratorAggregate, implements Countable
파일 보기 프로젝트 열기: phergie/phergie 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$autoload boolean Flag indicating whether plugin classes should be instantiated on demand if they are requested but no instance currently exists
$config Phergie_Config Phergie_Config instance that should be passed in to any plugin instantiated within the handler
$events Phergie_Event_Handler Phergie_Event_Handler instance that should be passed in to any plugin instantiated within the handler
$iteratorClass string Name of the class to use for iterating over all currently loaded plugins
$iteratorCollection
$paths array Paths in which to search for plugin class files
$plugins array Current list of plugin instances

공개 메소드들

메소드 설명
__call ( string $name, array $args ) : void Proxies method calls to all plugins containing the called method.
__construct ( Phergie_Config $config, Phergie_Event_Handler $events ) : void Constructor to initialize class properties and add the path for core plugins.
__get ( string $name ) : Phergie_Plugin_Abstract Allows plugin instances to be accessed as properties of the handler.
__isset ( string $name ) : boolean Allows plugin instances to be detected as properties of the handler.
__unset ( string $name ) : void Allows plugin instances to be removed as properties of handler.
addPath ( string $path, string $prefix = '' ) : Phergie_Plugin_Handler Adds a path to search for plugin class files. Paths are searched in the reverse order in which they are added.
addPlugin ( string | Phergie_Plugin_Abstract $plugin, array $args = null ) : Phergie_Plugin_Abstract Adds a plugin instance to the handler.
addPlugins ( array $plugins ) : Phergie_Plugin_Handler Adds multiple plugin instances to the handler.
count ( ) : integer Returns the number of plugins contained within the handler.
getAutoload ( ) : boolean Returns the value of a flag used to determine whether plugins should be loaded automatically if they have not been explicitly loaded.
getIterator ( $new = true ) : ArrayIterator Returns an iterator for all currently loaded plugin instances.
getPlugin ( string $name ) : Phergie_Plugin_Abstract Returns the corresponding instance for a specified plugin, loading it if it is not already loaded and autoloading is enabled.
getPluginInfo ( string $plugin ) : array | boolean Returns metadata corresponding to a specified plugin.
getPlugins ( array $names = [] ) : array Returns the corresponding instances for multiple specified plugins, loading them if they are not already loaded and autoloading is enabled.
hasPlugin ( string $name ) : boolean Returns whether or not at least one instance of a specified plugin class is loaded.
removePlugin ( string | Phergie_Plugin_Abstract $plugin ) : Phergie_Plugin_Handler Removes a plugin instance from the handler.
setAutoload ( boolean $flag = true ) : Phergie_Plugin_Handler Sets a flag used to determine whether plugins should be loaded automatically if they have not been explicitly loaded.
setIteratorClass ( string $class ) : Phergie_Plugin_Handler Sets the iterator class used for all currently loaded plugin instances.

메소드 상세

__call() 공개 메소드

Proxies method calls to all plugins containing the called method.
public __call ( string $name, array $args ) : void
$name string Name of the method called
$args array Arguments passed in the method call
리턴 void

__construct() 공개 메소드

Constructor to initialize class properties and add the path for core plugins.
public __construct ( Phergie_Config $config, Phergie_Event_Handler $events ) : void
$config Phergie_Config configuration to pass to any instantiated plugin
$events Phergie_Event_Handler event handler to pass to any instantiated plugin
리턴 void

__get() 공개 메소드

Allows plugin instances to be accessed as properties of the handler.
public __get ( string $name ) : Phergie_Plugin_Abstract
$name string Short name of the plugin
리턴 Phergie_Plugin_Abstract Requested plugin instance

__isset() 공개 메소드

Allows plugin instances to be detected as properties of the handler.
public __isset ( string $name ) : boolean
$name string Short name of the plugin
리턴 boolean TRUE if the plugin is loaded, FALSE otherwise

__unset() 공개 메소드

Allows plugin instances to be removed as properties of handler.
public __unset ( string $name ) : void
$name string Short name of the plugin
리턴 void

addPath() 공개 메소드

Adds a path to search for plugin class files. Paths are searched in the reverse order in which they are added.
public addPath ( string $path, string $prefix = '' ) : Phergie_Plugin_Handler
$path string Filesystem directory path
$prefix string Optional class name prefix corresponding to the path
리턴 Phergie_Plugin_Handler Provides a fluent interface

addPlugin() 공개 메소드

Adds a plugin instance to the handler.
public addPlugin ( string | Phergie_Plugin_Abstract $plugin, array $args = null ) : Phergie_Plugin_Abstract
$plugin string | Phergie_Plugin_Abstract Short name of the plugin class or a plugin object
$args array Optional array of arguments to pass to the plugin constructor if a short name is passed for $plugin
리턴 Phergie_Plugin_Abstract New plugin instance

addPlugins() 공개 메소드

Adds multiple plugin instances to the handler.
public addPlugins ( array $plugins ) : Phergie_Plugin_Handler
$plugins array List of elements where each is of the form 'ShortPluginName' or array('ShortPluginName', array($arg1, ..., $argN))
리턴 Phergie_Plugin_Handler Provides a fluent interface

count() 공개 메소드

Returns the number of plugins contained within the handler.
public count ( ) : integer
리턴 integer Plugin count

getAutoload() 공개 메소드

Returns the value of a flag used to determine whether plugins should be loaded automatically if they have not been explicitly loaded.
public getAutoload ( ) : boolean
리턴 boolean TRUE if autoloading is enabled, FALSE otherwise

getIterator() 공개 메소드

Returns an iterator for all currently loaded plugin instances.
public getIterator ( $new = true ) : ArrayIterator
리턴 ArrayIterator

getPlugin() 공개 메소드

Returns the corresponding instance for a specified plugin, loading it if it is not already loaded and autoloading is enabled.
public getPlugin ( string $name ) : Phergie_Plugin_Abstract
$name string Short name of the plugin class
리턴 Phergie_Plugin_Abstract Plugin instance

getPluginInfo() 공개 메소드

Returns metadata corresponding to a specified plugin.
public getPluginInfo ( string $plugin ) : array | boolean
$plugin string Short name of the plugin class
리턴 array | boolean Associative array containing the path to the class file and its containing directory as well as the full class name

getPlugins() 공개 메소드

Returns the corresponding instances for multiple specified plugins, loading them if they are not already loaded and autoloading is enabled.
public getPlugins ( array $names = [] ) : array
$names array Optional list of short names of the plugin classes to which the returned plugin list will be limited, defaults to all presently loaded plugins
리턴 array Associative array mapping lowercased plugin class short names to corresponding plugin instances

hasPlugin() 공개 메소드

Returns whether or not at least one instance of a specified plugin class is loaded.
public hasPlugin ( string $name ) : boolean
$name string Short name of the plugin class
리턴 boolean TRUE if an instance exists, FALSE otherwise

removePlugin() 공개 메소드

Removes a plugin instance from the handler.
public removePlugin ( string | Phergie_Plugin_Abstract $plugin ) : Phergie_Plugin_Handler
$plugin string | Phergie_Plugin_Abstract Short name of the plugin class or a plugin object
리턴 Phergie_Plugin_Handler Provides a fluent interface

setAutoload() 공개 메소드

Sets a flag used to determine whether plugins should be loaded automatically if they have not been explicitly loaded.
public setAutoload ( boolean $flag = true ) : Phergie_Plugin_Handler
$flag boolean TRUE to have plugins autoload (default), FALSE otherwise
리턴 Phergie_Plugin_Handler Provides a fluent interface.

setIteratorClass() 공개 메소드

Sets the iterator class used for all currently loaded plugin instances.
public setIteratorClass ( string $class ) : Phergie_Plugin_Handler
$class string Name of a class that extends FilterIterator
리턴 Phergie_Plugin_Handler Provides a fluent API

프로퍼티 상세

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

Flag indicating whether plugin classes should be instantiated on demand if they are requested but no instance currently exists
protected bool $autoload
리턴 boolean

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

Phergie_Config instance that should be passed in to any plugin instantiated within the handler
protected Phergie_Config $config
리턴 Phergie_Config

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

Phergie_Event_Handler instance that should be passed in to any plugin instantiated within the handler
protected Phergie_Event_Handler $events
리턴 Phergie_Event_Handler

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

Name of the class to use for iterating over all currently loaded plugins
protected string $iteratorClass
리턴 string

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

protected $iteratorCollection

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

Paths in which to search for plugin class files
protected array $paths
리턴 array

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

Current list of plugin instances
protected array $plugins
리턴 array