public function clear($namespace = null)
    {
        $this->getNotificationsFromContainer();

        if ($namespace) {
            if (isset($this->notifications[$namespace])) {
                unset($this->notifications[$namespace]);
                return true;
            }

            return false;
        }

        foreach ($this->notifications as $nm => $type) {
            unset($this->notifications[$nm]);
        }

        return true;
    }