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

Yoast / wordpress-seo / 3209e85c9df308a2653f9e35788020dfea4d0d81

01 Apr 2026 07:09AM UTC coverage: 53.511% (-3.2%) from 56.662%
3209e85c9df308a2653f9e35788020dfea4d0d81

push

github

leonidasmi
Merge trunk

9081 of 16722 branches covered (54.31%)

Branch coverage included in aggregate %.

188 of 271 new or added lines in 30 files covered. (69.37%)

3 existing lines in 2 files now uncovered.

34583 of 64876 relevant lines covered (53.31%)

46367.1 hits per line

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

88.24
/src/plugins-tab/application/plugins-list-handler.php
1
<?php
2

3
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
4
namespace Yoast\WP\SEO\Plugins_Tab\Application;
5

6
use Yoast\WP\SEO\Plugins_Tab\Domain\Plugin_Detector;
7

8
/**
9
 * Handles the filtering logic for the Yoast plugins tab on the Plugins screen.
10
 */
11
class Plugins_List_Handler {
12

13
        /**
14
         * The plugin detector.
15
         *
16
         * @var Plugin_Detector
17
         */
18
        private $detector;
19

20
        /**
21
         * Constructs the handler.
22
         *
23
         * @param Plugin_Detector $detector The plugin detector.
24
         */
NEW
25
        public function __construct( Plugin_Detector $detector ) {
×
NEW
26
                $this->detector = $detector;
×
27
        }
28

29
        /**
30
         * Filters the plugins list to add a 'yoast' group when 2+ Yoast plugins are installed.
31
         *
32
         * @param array<string, array<string, array<string, string>>> $plugins The plugins list keyed by status.
33
         *
34
         * @return array<string, array<string, array<string, string>>> The filtered plugins list.
35
         */
36
        public function filter_plugins_list( $plugins ) {
8✔
37
                if ( ! \is_array( $plugins ) || ! isset( $plugins['all'] ) ) {
8✔
38
                        return $plugins;
2✔
39
                }
40

41
                $yoast_plugins = [];
6✔
42
                foreach ( $plugins['all'] as $plugin_file => $plugin_data ) {
6✔
43
                        if ( $this->detector->is_yoast_plugin( $plugin_data ) ) {
6✔
44
                                $yoast_plugins[ $plugin_file ] = $plugin_data;
4✔
45
                        }
46
                }
47

48
                if ( \count( $yoast_plugins ) < Plugin_Detector::MINIMUM_FOR_TAB ) {
6✔
49
                        return $plugins;
4✔
50
                }
51

52
                $plugins['yoast'] = $yoast_plugins;
2✔
53

54
                return $plugins;
2✔
55
        }
56

57
        /**
58
         * Returns the status text for the Yoast plugins tab.
59
         *
60
         * @param string $text  The current status text.
61
         * @param int    $count The number of plugins with this status.
62
         * @param string $type  The status type slug.
63
         *
64
         * @return string The status text.
65
         */
66
        public function get_status_text( $text, $count, $type ) {
4✔
67
                if ( $type !== 'yoast' ) {
4✔
68
                        return $text;
2✔
69
                }
70

71
                return \_nx( 'Yoast', 'Yoast', $count, 'plugin status', 'wordpress-seo' );
2✔
72
        }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc