/**
  * Sort on type then priority
  *
  * @param Yoast_Notification $a Compare with B.
  * @param Yoast_Notification $b Compare with A.
  *
  * @return int 1, 0 or -1 for sorting offset.
  */
 private function sort_notifications(Yoast_Notification $a, Yoast_Notification $b)
 {
     $a_type = $a->get_type();
     $b_type = $b->get_type();
     if ($a_type === $b_type) {
         return bccomp($b->get_priority(), $a->get_priority());
     }
     if ('error' === $a_type) {
         return -1;
     }
     if ('error' === $b_type) {
         return 1;
     }
     return 0;
 }
 /**
  * Sort on type then priority
  *
  * @param Yoast_Notification $a Compare with B.
  * @param Yoast_Notification $b Compare with A.
  *
  * @return int 1, 0 or -1 for sorting offset.
  */
 private function sort_notifications(Yoast_Notification $a, Yoast_Notification $b)
 {
     $a_type = $a->get_type();
     $b_type = $b->get_type();
     if ($a_type === $b_type) {
         return WPSEO_Utils::calc($b->get_priority(), 'compare', $a->get_priority());
     }
     if ('error' === $a_type) {
         return -1;
     }
     if ('error' === $b_type) {
         return 1;
     }
     return 0;
 }
Пример #3
0
 /**
  * Filter out any non-warnings
  *
  * @param Yoast_Notification $notification Notification to test.
  *
  * @return bool
  */
 private static function filter_warning_alerts(Yoast_Notification $notification)
 {
     return $notification->get_type() !== 'error';
 }