public function subscribe($handler, $priority = Event::DEFAULT_CALLBACKS_PRIORITY)
    {
        $_priority = \is_int($priority) ? $priority : self::DEFAULT_CALLBACKS_PRIORITY;
        if (!($_priority >= self::DEFAULT_CALLBACKS_MAX_PRIORITY && $_priority <= self::DEFAULT_CALLBACKS_MIN_PRIORITY)) {
            $_priority = self::DEFAULT_CALLBACKS_PRIORITY;
        }
        if (\array_key_exists($_priority, $this->callbacks)) {
            foreach ($this->callbacks[$_priority] as $callback) {
                if ($callback == $handler) {
                    return $this;
                }
            }
        } else {
            $this->callbacks[$_priority] = [];
        }

        if (\is_string($handler) || \is_callable($handler) || $handler instanceof \Closure) {
            $this->callbacks[$_priority][] = $handler;
        } else if (\is_array($handler)) {
            if (\count($handler) == 2) {
                if ((\is_string($handler[0])         // static call, ['Page',  'handleClick'] --> Page::handleClick()
                        || \is_object($handler[0]))  // method call, [$object, 'handleClick'] --> $object->handleClick()
                        && (\is_string($handler[1]))
                ) {
                    $this->callbacks[$_priority][] = $handler;
                } else { // error, unknown $handler type...
                    throw new UnknownEventHandlerTypeException("Unknown Event handler type.");
                }
            } else { // error, unknown $handler type...
                throw new UnknownEventHandlerTypeException("Unknown Event handler type.");
            }
        } else { // error, unknown $handler type...
            throw new UnknownEventHandlerTypeException("Unknown Event handler type.");
        }

        return $this;
    }