Adds to a list of plugins to exclude when iterating.
public addPluginFilter ( mixed $plugins ) : Phergie_Plugin_Iterator | ||
$plugins | mixed | String containing the short name of a single plugin to exclude or an array of short names of multiple plugins to exclude |
return | Phergie_Plugin_Iterator | Provides a fluent interface |
/** * Tests that all plugins are iterated after filters are cleared. * * @depends testIteratesPluginsWithNameFilters * @depends testIteratesPluginsWithMethodFilters */ public function testIteratesPluginsAfterClearingFilters() { $this->iterator->addPluginFilter('0'); $this->iterator->addMethodFilter('method1'); $this->iterator->clearFilters(); $expected = range(0, 4); $actual = array(); foreach ($this->iterator as $plugin) { $actual[] = $plugin->getName(); } $this->assertEquals($expected, $actual); }
/** * Applies a set of rules to a plugin handler iterator. * * @param Phergie_Plugin_Iterator $iterator Iterator to receive rules * @param array $rules Associate array containing * either a 'plugins' key pointing to an array containing plugin * short names to filter, a 'methods' key pointing to an array * containing method names to filter, or both * * @return void */ protected function applyRules(Phergie_Plugin_Iterator $iterator, array $rules) { if (!empty($rules['plugins'])) { $iterator->addPluginFilter($rules['plugins']); } if (!empty($rules['methods'])) { $iterator->addMethodFilter($rules['methods']); } }