public function has($type = null)
{
if ($this->count() === 0) {
return false;
}
if (is_null($type)) {
return true;
}
if (!$this->typeIsAvailable($type)) {
return false;
}
foreach ($this->notifications as $key => $message) {
if ($message->getType() == $type) {
return true;
}
}
return false;
}