public function addEventHandler($name, $handler, array $params = []) {
        if (is_string($handler)) {
            $this->eventHandlers[$name] = [
                'handler' => $handler,
                'params' => $params,
            ];
        } else {
            $this->eventHandlers[$name] = $handler;
        }

        return $this;
    }
public function addEventHandler($name, $handler, array $params = []) {
        if (is_string($handler)) {
            $this->eventHandlers[$name] = [
                'handler' => $handler,
                'params' => $params,
            ];
        } else {
            $this->eventHandlers[$name] = $handler;
        }

        return $this;
    }
public function addEventHandler ( $ name , $ handler , array $ params = [ ] ) { if ( is_string ( $ handler ) ) { $ this -> eventHandlers [ $ name ] = [ 'handler' => $ handler , 'params' => $ params , ] ; } else { $ this -> eventHandlers [ $ name ] = $ handler ; } return $ this ; }
Register an event handler

@param string $name The name of the handler
@param mixed $handler The handler itself
@param array $params Parameters for the handler if $handler is a string
@return self
Register an event handler