public function bind($cmd, $handler)
{
$cmds = $cmd == '*' ? array_keys($this->commands) : array_map('trim', explode(' ', $cmd));
foreach ($cmds as $cmd) {
if ($cmd) {
if (!isset($this->listeners[$cmd])) {
$this->listeners[$cmd] = array();
}
if (is_callable($handler)) {
$this->listeners[$cmd][] = $handler;
}
}
}
return $this;
}