/**
  * Add notification to the cookie
  *
  * @param Yoast_Notification $notification Notification object instance.
  */
 public function add_notification(Yoast_Notification $notification)
 {
     $notification_id = $notification->get_id();
     // Empty notifications are always added.
     if ($notification_id !== '') {
         // If notification ID exists in notifications, don't add again.
         if (null !== $this->get_notification_by_id($notification_id)) {
             return;
         }
     }
     // Add to list.
     $this->notifications[] = $notification;
 }
 /**
  * Remove notification after it has been displayed
  *
  * @param Yoast_Notification $notification Notification to remove.
  * @param bool               $resolve Resolve as fixed.
  */
 public function remove_notification(Yoast_Notification $notification, $resolve = true)
 {
     $index = false;
     // Match persistent Notifications by ID, non persistent by item in the array.
     if ($notification->is_persistent()) {
         foreach ($this->notifications as $current_index => $present_notification) {
             if ($present_notification->get_id() === $notification->get_id()) {
                 $index = $current_index;
                 break;
             }
         }
     } else {
         $index = array_search($notification, $this->notifications, true);
     }
     if (false === $index) {
         return;
     }
     if ($notification->is_persistent() && $resolve) {
         $this->resolved++;
         $this->clear_dismissal($notification);
     }
     unset($this->notifications[$index]);
     $this->notifications = array_values($this->notifications);
 }
 /**
  * Dismiss the notification
  *
  * @param Yoast_Notification $notification Notification to dismiss.
  * @param string             $meta_value   Value to save in the dismissal.
  *
  * @return bool
  */
 private static function dismiss_notification(Yoast_Notification $notification, $meta_value = 'seen')
 {
     $user_id = get_current_user_id();
     // Set about version when dismissing about notification.
     if ($notification->get_id() === 'wpseo-dismiss-about') {
         setcookie('wpseo_seen_about_version_' . $user_id, WPSEO_VERSION, $_SERVER['REQUEST_TIME'] + YEAR_IN_SECONDS);
         return false !== update_user_meta($user_id, 'wpseo_seen_about_version', WPSEO_VERSION);
     }
     // Dismiss notification.
     return false !== update_user_meta(get_current_user_id(), $notification->get_dismissal_key(), $meta_value);
 }