Skip to content

Commit

Permalink
Add detachObserver (#11037)
Browse files Browse the repository at this point in the history
* Add detachObserver

Adds ability to detach observers

* Simple CS fix
  • Loading branch information
alex7r authored and rdeutz committed Oct 29, 2016
1 parent 334d5a4 commit 94d5d43
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion libraries/joomla/observer/updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct(JObservableInterface $observable)

/**
* Adds an observer to the JObservableInterface instance updated by this
* This method can be called fron JObservableInterface::attachObserver
* This method can be called from JObservableInterface::attachObserver
*
* @param JObserverInterface $observer The observer object
*
Expand All @@ -59,6 +59,24 @@ public function attachObserver(JObserverInterface $observer)
$this->observers[get_class($observer)] = $observer;
}

/**
* Removes an observer from the JObservableInterface instance updated by this
* This method can be called from JObservableInterface::attachObserver
*
* @param String $observer The observer class name
*
* @return void
*
* @since 3.6.0
*/
public function detachObserver($observer)
{
if (isset($this->observers[$observer]))
{
unset($this->observers[$observer]);
}
}

/**
* Gets the instance of the observer of class $observerClass
*
Expand Down

0 comments on commit 94d5d43

Please sign in to comment.