CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • App
  • BasePlugin
  • ClassLoader
  • Configure
  • ObjectRegistry
  • Plugin
  • PluginCollection

Interfaces

  • ConsoleApplicationInterface
  • HttpApplicationInterface
  • PluginApplicationInterface
  • PluginInterface

Traits

  • ConventionsTrait
  • InstanceConfigTrait
  • StaticConfigTrait

Class PluginCollection

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.

Cake\Core\PluginCollection implements Iterator, Countable
Namespace: Cake\Core
Location: Core/PluginCollection.php

Properties summary

  • $loopDepth protected
    integer
    Loop depth
  • $names protected
    array
    Names of plugins
  • $plugins protected
    array
    Plugin list
  • $positions protected
    int[]
    Iterator position stack.

Method Summary

  • __construct() public
    Constructor
  • add() public
    Add a plugin to the collection
  • clear() public
    Remove all plugins from the collection
  • count() public
    Implementation of Countable.
  • current() public
    Part of Iterator Interface
  • get() public
    Get the a plugin by name
  • has() public
    Check whether the named plugin exists in the collection.
  • key() public
    Part of Iterator Interface
  • next() public
    Part of Iterator Interface
  • remove() public
    Remove a plugin from the collection if it exists.
  • rewind() public
    Part of Iterator Interface
  • valid() public
    Part of Iterator Interface
  • with() public
    Filter the plugins to those with the named hook enabled.

Method Detail

__construct() public ¶

__construct( array $plugins = [] )

Constructor

Parameters
array $plugins optional []
The map of plugins to add to the collection.

add() public ¶

add( Cake\Core\PluginInterface $plugin )

Add a plugin to the collection

Plugins will be keyed by their names.

Parameters
Cake\Core\PluginInterface $plugin
The plugin to load.
Returns

$this

clear() public ¶

clear( )

Remove all plugins from the collection

Returns

$this

count() public ¶

count( )

Implementation of Countable.

Get the number of plugins in the collection.

Returns
integer
Implementation of
Countable::count()

current() public ¶

current( )

Part of Iterator Interface

Returns
Cake\Core\PluginInterface
Implementation of
Iterator::current()

get() public ¶

get( string $name )

Get the a plugin by name

Parameters
string $name
The plugin to get.
Returns
Cake\Core\PluginInterface
The plugin.
Throws
Cake\Core\Exception\MissingPluginException
when unknown plugins are fetched.

has() public ¶

has( string $name )

Check whether the named plugin exists in the collection.

Parameters
string $name
The named plugin.
Returns
boolean

key() public ¶

key( )

Part of Iterator Interface

Returns
string
Implementation of
Iterator::key()

next() public ¶

next( )

Part of Iterator Interface

Implementation of
Iterator::next()

remove() public ¶

remove( string $name )

Remove a plugin from the collection if it exists.

Parameters
string $name
The named plugin.
Returns

$this

rewind() public ¶

rewind( )

Part of Iterator Interface

Implementation of
Iterator::rewind()

valid() public ¶

valid( )

Part of Iterator Interface

Returns
boolean
Implementation of
Iterator::valid()

with() public ¶

with( string $hook )

Filter the plugins to those with the named hook enabled.

Parameters
string $hook
The hook to filter plugins by
Returns
Generator
A generator containing matching plugins.
Throws
InvalidArgumentException
on invalid hooks

Properties detail

$loopDepth ¶

protected integer

Loop depth

-1

$names ¶

protected array

Names of plugins

[]

$plugins ¶

protected array

Plugin list

[]

$positions ¶

protected int[]

Iterator position stack.

[]
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs