public function unbind($cmd, $handler) { if (!empty($this->listeners[$cmd])) { foreach ($this->listeners[$cmd] as $i => $h) { if ($h === $handler) { unset($this->listeners[$cmd][$i]); return $this; } } } return $this; }