From: Gunnar Wrobel Date: Thu, 5 Nov 2009 06:08:01 +0000 (+0100) Subject: Do not pass the option array by reference. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7541e807ba8a06f7c56ff7ab3beffa022faa3c4e;p=horde.git Do not pass the option array by reference. --- diff --git a/framework/Notification/lib/Horde/Notification/Handler/Base.php b/framework/Notification/lib/Horde/Notification/Handler/Base.php index a905ad1d1..25b3c27ab 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Base.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Base.php @@ -185,7 +185,7 @@ implements Horde_Notification_Handler_Interface */ public function notify(array $options = array()) { - $this->setNotificationListeners($options); + $options = $this->setNotificationListeners($options); $this->notifyListeners($options); } @@ -196,7 +196,7 @@ implements Horde_Notification_Handler_Interface * @param array $options An array containing display options for the * listeners. */ - public function setNotificationListeners(array &$options) + public function setNotificationListeners(array $options) { if (!isset($options['listeners'])) { $options['listeners'] = $this->getListeners(); @@ -204,6 +204,7 @@ implements Horde_Notification_Handler_Interface $options['listeners'] = array($options['listeners']); } $options['listeners'] = array_map(array('Horde_String', 'lower'), $options['listeners']); + return $options; } /** diff --git a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php index 26d2e5a41..a704ae07f 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php @@ -126,7 +126,7 @@ implements Horde_Notification_Handler_Interface */ public function notify(array $options = array()) { - $this->_handler->setNotificationListeners($options); + $options = $this->_handler->setNotificationListeners($options); if (in_array('status', $options['listeners'])) { $this->_alarm->notify(Horde_Auth::getAuth()); @@ -142,9 +142,9 @@ implements Horde_Notification_Handler_Interface * @param array $options An array containing display options for the * listeners. */ - public function setNotificationListeners(array &$options) + public function setNotificationListeners(array $options) { - $this->_handler->setNotificationListeners($options); + return $this->_handler->setNotificationListeners($options); } /** diff --git a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php index 5054f5f7b..773bb21ae 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php @@ -130,9 +130,9 @@ implements Horde_Notification_Handler_Interface * @param array $options An array containing display options for the * listeners. */ - public function setNotificationListeners(array &$options) + public function setNotificationListeners(array $options) { - $this->_handler->setNotificationListeners($options); + return $this->_handler->setNotificationListeners($options); } /** diff --git a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php index adf7a3c56..4c9e14717 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php @@ -151,9 +151,9 @@ implements Horde_Notification_Handler_Interface * @param array $options An array containing display options for the * listeners. */ - public function setNotificationListeners(array &$options) + public function setNotificationListeners(array $options) { - $this->_handler->setNotificationListeners($options); + return $this->_handler->setNotificationListeners($options); } /** diff --git a/framework/Notification/lib/Horde/Notification/Handler/Interface.php b/framework/Notification/lib/Horde/Notification/Handler/Interface.php index c321284b2..229adfc36 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Interface.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Interface.php @@ -91,7 +91,7 @@ interface Horde_Notification_Handler_Interface * @param array $options An array containing display options for the * listeners. */ - public function setNotificationListeners(array &$options); + public function setNotificationListeners(array $options); /** * Passes the message stack to all listeners and asks them to diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php index 962e84e2c..fe23ff368 100644 --- a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php +++ b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php @@ -52,7 +52,8 @@ extends PHPUnit_Framework_TestCase ->with(''); $this->handler->expects($this->once()) ->method('setNotificationListeners') - ->with(array('listeners' => array('status'))); + ->with(array('listeners' => array('status'))) + ->will($this->returnValue(array('listeners' => array('status')))); $this->handler->expects($this->once()) ->method('notifyListeners') ->with(array('listeners' => array('status'))); @@ -103,7 +104,8 @@ extends PHPUnit_Framework_TestCase { $this->handler->expects($this->once()) ->method('setNotificationListeners') - ->with(array('listeners' => array('test'))); + ->with(array('listeners' => array('test'))) + ->will($this->returnValue(array('listeners' => array('test')))); $this->handler->expects($this->once()) ->method('notifyListeners') ->with(array('listeners' => array('test')));