Skip to content

Commit

Permalink
Reverting coupling the decorator with the event manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed May 18, 2016
1 parent c76c360 commit 907b24c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Event/EventManager.php
Expand Up @@ -14,7 +14,6 @@
*/
namespace Cake\Event;

use Cake\Event\Decorator\ConditionDecorator;
use InvalidArgumentException;

/**
Expand Down Expand Up @@ -158,14 +157,14 @@ public function on($eventKey = null, $options = [], $callable = null)
$argCount = func_num_args();
if ($argCount === 2) {
$this->_listeners[$eventKey][static::$defaultPriority][] = [
'callable' => is_callable($options) ? new ConditionDecorator($options) : $options,
'callable' => $options
];
return;
}
if ($argCount === 3) {
$priority = isset($options['priority']) ? $options['priority'] : static::$defaultPriority;
$this->_listeners[$eventKey][$priority][] = [
'callable' => is_callable($callable) ? new ConditionDecorator($callable, $options) : $callable
'callable' => $callable
];
return;
}
Expand Down

0 comments on commit 907b24c

Please sign in to comment.