public function addHandler(HandlerInterface $handler, $priority = 0)
    {
        if (filter_var($priority, FILTER_VALIDATE_INT) === false) {
            throw new InvalidArgumentException("Argument 'priority' should be an integer, got '$priority'");
        }

        if ($this->handlerAlreadyRegistered($handler)) {
            return;
        }

        $this->handlers[$priority][] = $handler;
    }