private static function removeOldestNotificationsIfThereAreTooMany()
{
if (!self::isSessionEnabled()) {
return;
}
$maxNotificationsInSession = 30;
$session = static::getSession();
while (count($session->notifications) >= $maxNotificationsInSession) {
array_shift($session->notifications);
}
}