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.
While its implementation supported nested iteration it does not support using continue or break inside loops.
$loopDepth protected integer$names protected array$plugins protected array$positions protected int[]__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\PluginInterfaceIterator::current() get( string $name )
Get the a plugin by name
$name Cake\Core\PluginInterfaceCake\Core\Exception\MissingPluginExceptionhas( 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–present 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.8/class-Cake.Core.PluginCollection.html