public function clear($type = null)
    {
        if (is_null($type)) {
            $this->notifications = new Collection();
        } else {
            $notifications = new Collection();

            foreach ($this->notifications as $message) {
                if ($message->getType() != $type) {
                    $notifications->add($message);
                }
            }

            $this->notifications = $notifications;
        }

        return $this;
    }
public function clear($type = null)
    {
        if (is_null($type)) {
            $this->notifications = new Collection();
        } else {
            $notifications = new Collection();

            foreach ($this->notifications as $message) {
                if ($message->getType() != $type) {
                    $notifications->add($message);
                }
            }

            $this->notifications = $notifications;
        }

        return $this;
    }
public function clear ( $ type = null ) { if ( is_null ( $ type ) ) { $ this -> notifications = new Collection ( ) ; } else { $ notifications = new Collection ( ) ; foreach ( $ this -> notifications as $ message ) { if ( $ message -> getType ( ) != $ type ) { $ notifications -> add ( $ message ) ; } } $ this -> notifications = $ notifications ; } return $ this ; }
Clears message for a given type.

@param null $type
@return \Krucas\Notification\NotificationsBag
Clears message for a given type .