Krucas\Notification\NotificationsBag::getMessagesForRender PHP Method

getMessagesForRender() protected method

Resolves which messages should be returned for rendering.
protected getMessagesForRender ( null $type = null ) : Krucas\Notification\Collection
$type null
return Krucas\Notification\Collection
    protected function getMessagesForRender($type = null)
    {
        if (is_null($type)) {
            if (count($this->groupForRender) > 0) {
                $messages = array();
                foreach ($this->groupForRender as $typeToRender) {
                    $messages = array_merge($messages, $this->get($typeToRender)->all());
                }
                return new Collection($messages);
            }
            return $this->all();
        }
        return $this->get($type);
    }