PHP Класс Phergie_Plugin_Handler, phergie

Автор: Phergie Development Team ([email protected])
Наследование: implements IteratorAggregate, implements Countable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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