X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FIrc%2Fextlib%2Fphergie%2FPhergie%2FPlugin%2FHandler.php;h=b2ef089b44cee0071f08126996dcda039216a138;hb=678911af249ddc5d2db8d182ce3fd0c748c05fd7;hp=4304bef99e3c7214817ffb95fb3bab588378fccc;hpb=c71319419bd00ee563fd87a6fe2f202293441d82;p=quix0rs-gnu-social.git diff --git a/plugins/Irc/extlib/phergie/Phergie/Plugin/Handler.php b/plugins/Irc/extlib/phergie/Phergie/Plugin/Handler.php index 4304bef99e..b2ef089b44 100755 --- a/plugins/Irc/extlib/phergie/Phergie/Plugin/Handler.php +++ b/plugins/Irc/extlib/phergie/Phergie/Plugin/Handler.php @@ -68,14 +68,6 @@ class Phergie_Plugin_Handler implements IteratorAggregate, Countable */ protected $events; - /** - * Iterator used for selectively proxying method calls to contained - * plugins - * - * @var Iterator - */ - protected $iterator; - /** * Constructor to initialize class properties and add the path for core * plugins. @@ -424,39 +416,26 @@ class Phergie_Plugin_Handler implements IteratorAggregate, Countable */ public function getIterator() { - if (empty($this->iterator)) { - $this->iterator = new Phergie_Plugin_Iterator( - new ArrayIterator($this->plugins) - ); - } - return $this->iterator; + return new ArrayIterator($this->plugins); } /** - * Sets the iterator for all currently loaded plugin instances. - * - * @param Iterator $iterator Plugin iterator - * - * @return Phergie_Plugin_Handler Provides a fluent interface - */ - public function setIterator(Iterator $iterator) - { - $this->iterator = $iterator; - return $this; - } - - /** - * Proxies method calls to all plugins containing the called method. + * Proxies method calls to all plugins containing the called method. An + * individual plugin may short-circuit this process by explicitly + * returning FALSE. * * @param string $name Name of the method called * @param array $args Arguments passed in the method call * - * @return void + * @return bool FALSE if a plugin short-circuits processing by returning + * FALSE, TRUE otherwise */ public function __call($name, array $args) { - foreach ($this->getIterator() as $plugin) { - call_user_func_array(array($plugin, $name), $args); + foreach ($this->plugins as $plugin) { + if (call_user_func_array(array($plugin, $name), $args) === false) { + return false; + } } return true; }