You are here

function crumbs_PluginSystem_PluginMethodIterator::__construct in Crumbs, the Breadcrumbs suite 7.2

Parameters

true[] $pluginMethods: Format: $[$plugin_key] = true

crumbs_PluginInterface[] $plugins:

string $method: One of 'findParent' and 'findTitle'.

Throws

Exception

File

lib/PluginSystem/PluginMethodIterator.php, line 44

Class

crumbs_PluginSystem_PluginMethodIterator

Code

function __construct($pluginMethods, $plugins, $method) {
  $this->plugins = $plugins;
  $this->pluginKeys = array_keys($pluginMethods);
  if ($method !== 'findParent' && $method !== 'findTitle') {
    throw new \Exception("Invalid plugin method '{$method}'.");
  }
  $this->pluginMethod = $method;

  // Set iterator start position.
  $this
    ->setFirstValidIteratorPosition(reset($this->pluginKeys));
}