From 012db8d8f40e677da51a2998995b3e5f9892b4fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Mon, 6 Jan 2014 18:32:36 +0100 Subject: [PATCH] register multiple commands at once --- application/core/Commands/CommandManager.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/application/core/Commands/CommandManager.php b/application/core/Commands/CommandManager.php index 7bcad52a..6921b670 100644 --- a/application/core/Commands/CommandManager.php +++ b/application/core/Commands/CommandManager.php @@ -41,6 +41,15 @@ class CommandManager implements CallbackListener { * @return bool */ public function registerCommandListener($commandName, CommandListener $listener, $method, $adminCommand = false) { + if (is_array($commandName)) { + $success = true; + foreach ($commandName as $command) { + if (!$this->registerCommandListener($command, $listener, $method, $adminCommand)) { + $success = false; + } + } + return $success; + } $command = strtolower($commandName); if (!method_exists($listener, $method)) { trigger_error("Given listener can't handle command '{$command}' (no method '{$method}')!");