Plugin Collection
Holds onto plugin objects loaded into an application, and provides methods for iterating, and finding plugins based on criteria.
This class implements the Iterator interface to allow plugins to be iterated, handling the situation where a plugin's hook method (usually bootstrap) loads another plugin during iteration.
$names
protected array
$plugins
protected array
$position
protected integer
__construct( array $plugins [] )
Constructor
$plugins
optional [] add( Cake\Core\PluginInterface $plugin )
Add a plugin to the collection
Plugins will be keyed by their names.
Cake\Core\PluginInterface
$plugin
count( )
Implementation of Countable.
Get the number of plugins in the collection.
Countable::count()
current( )
Part of Iterator Interface
Cake\Core\PluginInterface
Iterator::current()
get( string $name )
Get the a plugin by name
$name
Cake\Core\PluginInterface
Cake\Core\Exception\MissingPluginException
has( string $name )
Check whether the named plugin exists in the collection.
$name
key( )
Part of Iterator Interface
Iterator::key()
remove( string $name )
Remove a plugin from the collection if it exists.
$name
valid( )
Part of Iterator Interface
Iterator::valid()
with( string $hook )
Filter the plugins to those with the named hook enabled.
$hook
© 2005–2018 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.6/class-Cake.Core.PluginCollection.html