public function off($name, $handler = null) { if ($handler === null) { unset($this->_handlers[$name]); return parent::off($name, $handler); } else { $removed = false; foreach ($this->_handlers[$name] as $i => $value) { if ($value === $handler) { $removed = parent::off($name, [$this, $i]) || $removed; unset($this->_handlers[$name][$i]); } } return $removed; } }
/** * Unbind event * @param Component $class * @param string $event */ public function unbind(Component $class, $event) { $class->off($event); }