public function on($type, $callback)
    {
        if (!isset($this->callbacks[$type])) {
            $this->callbacks[$type] = [];
        }
        $this->callbacks[$type][] = $callback;
        return $this;
    }
public function on($type, $callback)
    {
        if (!isset($this->callbacks[$type])) {
            $this->callbacks[$type] = [];
        }
        $this->callbacks[$type][] = $callback;
        return $this;
    }
public function on ( $ type , $ callback ) { if ( ! isset ( $ this -> callbacks [ $ type ] ) ) { $ this -> callbacks [ $ type ] = [ ] ; } $ this -> callbacks [ $ type ] [ ] = $ callback ; return $ this ; }
Register event handler

@param string $type
@param \Closure|array|string $callback
@return $this
Register event handler