• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 99ff5821fbe8444b259463501ff00132570d3061

25 Mar 2025 09:23AM UTC coverage: 52.446% (+3.7%) from 48.71%
99ff5821fbe8444b259463501ff00132570d3061

Pull #21958

github

web-flow
Merge d493347a3 into facbdded4
Pull Request #21958: Improve function words list for Farsi

7990 of 14101 branches covered (56.66%)

Branch coverage included in aggregate %.

20 of 20 new or added lines in 1 file covered. (100.0%)

1567 existing lines in 41 files now uncovered.

29816 of 57984 relevant lines covered (51.42%)

41124.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/helpers/notification-helper.php
1
<?php
2

3
namespace Yoast\WP\SEO\Helpers;
4

5
use Yoast_Notification;
6
use Yoast_Notification_Center;
7

8
/**
9
 * A helper object for notifications.
10
 */
11
class Notification_Helper {
12

13
        /**
14
         * Restores a notification (wrapper function).
15
         *
16
         * @codeCoverageIgnore
17
         *
18
         * @param Yoast_Notification $notification The notification to restore.
19
         *
20
         * @return bool True if restored, false otherwise.
21
         */
22
        public function restore_notification( Yoast_Notification $notification ) {
23
                return Yoast_Notification_Center::restore_notification( $notification );
24
        }
25

26
        /**
27
         * Return the notifications sorted on type and priority. (wrapper function)
28
         *
29
         * @codeCoverageIgnore
30
         *
31
         * @return Yoast_Notification[] Sorted Notifications
32
         */
33
        public function get_sorted_notifications() {
34
                $notification_center = Yoast_Notification_Center::get();
35

36
                return $notification_center->get_sorted_notifications();
37
        }
38

39
        /**
40
         * Check if the user has dismissed a notification. (wrapper function)
41
         *
42
         * @param Yoast_Notification $notification The notification to check for dismissal.
43
         * @param int|null           $user_id      User ID to check on.
44
         *
45
         * @codeCoverageIgnore
46
         *
47
         * @return bool
48
         */
49
        private function is_notification_dismissed( Yoast_Notification $notification, $user_id = null ) {
50
                return Yoast_Notification_Center::is_notification_dismissed( $notification, $user_id );
51
        }
52

53
        /**
54
         * Parses all the notifications to an array with just id, message, nonce, type and dismissed.
55
         *
56
         * @return array<string,string|bool>
57
         */
58
        public function get_alerts(): array {
×
59
                $all_notifications = $this->get_sorted_notifications();
×
60

61
                return \array_map(
62
                        function ( $notification ) {
UNCOV
63
                                return [
×
64
                                        'id'        => $notification->get_id(),
×
65
                                        'message'   => $notification->get_message(),
×
66
                                        'nonce'     => $notification->get_nonce(),
×
67
                                        'type'      => $notification->get_type(),
×
68
                                        'dismissed' => $this->is_notification_dismissed( $notification ),
UNCOV
69
                                ];
×
70
                        },
71
                        $all_notifications
72
                );
73
        }
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc