diff --git a/src/Event/Decorator/BaseDecorator.php b/src/Event/Decorator/AbstractDecorator.php similarity index 88% rename from src/Event/Decorator/BaseDecorator.php rename to src/Event/Decorator/AbstractDecorator.php index 1492c1996b3..74d907ba2ae 100644 --- a/src/Event/Decorator/BaseDecorator.php +++ b/src/Event/Decorator/AbstractDecorator.php @@ -14,7 +14,7 @@ */ namespace Cake\Event\Decorator; -class BaseDecorator +abstract class AbstractDecorator { /** @@ -51,18 +51,19 @@ public function __construct(callable $callable, array $options = []) */ public function __invoke() { - return $this->call($this->_callable, func_get_args()); + return $this->_call($this->_callable, func_get_args()); } /** - * Calls a callable with the passed arguments. + * Calls the decorated callable with the passed arguments. * * @param callable $callable The callable. * @param array $args Arguments for the callable. * @return mixed */ - public function call(callable $callable, $args) + protected function _call($args) { + $callable = $this->_callable; switch (count($args)) { case 0: return $callable(); diff --git a/src/Event/Decorator/ConditionDecorator.php b/src/Event/Decorator/ConditionDecorator.php index 2bdbb9bb93b..6f995bc053c 100644 --- a/src/Event/Decorator/ConditionDecorator.php +++ b/src/Event/Decorator/ConditionDecorator.php @@ -20,7 +20,7 @@ /** * Event Condition Decorator */ -class ConditionDecorator extends BaseDecorator +class ConditionDecorator extends AbstractDecorator { /** @@ -33,7 +33,7 @@ public function __invoke() if (!$this->canTrigger($args[0])) { return false; } - return call_user_func_array('parent::__invoke', $args); + return $this->_call($args); } /** diff --git a/src/Event/Decorator/SubjectFilterDecorator.php b/src/Event/Decorator/SubjectFilterDecorator.php index a38a0afe15a..be76b512c7a 100644 --- a/src/Event/Decorator/SubjectFilterDecorator.php +++ b/src/Event/Decorator/SubjectFilterDecorator.php @@ -20,7 +20,7 @@ /** * Event Subject Filter Decorator */ -class SubjectFilterDecorator extends BaseDecorator +class SubjectFilterDecorator extends AbstractDecorator { /** @@ -33,7 +33,7 @@ public function __invoke() if (!$this->canTrigger($args[0])) { return false; } - return call_user_func_array('parent::__invoke', $args); + return $this->_call($args); } /**