Horde_Notification_Handler::clear PHP Method

clear() public method

Clear any notification events that may exist in a listener.
public clear ( string $listener = null )
$listener string The name of the listener to flush. If null, clears all unattached events.
    public function clear($listener = null)
    {
        if (is_null($listener)) {
            $this->_storage->clear('_unattached');
        } elseif ($ob = $this->getListener($listener)) {
            $this->_storage->clear($ob->getName());
        }
    }

Usage Example

Example #1
0
 public function testMethodClearHasPostconditionThatAllUnattachedEventsHaveBeenClearedFromStorageIfNoListenerWasSpecified()
 {
     $storage = $this->getMock('Horde_Notification_Storage_Interface');
     $storage->expects($this->once())->method('clear')->with('_unattached');
     $handler = new Horde_Notification_Handler($storage);
     $handler->clear();
 }