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

Yoast / wordpress-seo / cd81e373121bc0e6c1ef8d2cc7ad97810aa651aa

03 Dec 2024 10:40AM UTC coverage: 54.094% (-0.6%) from 54.693%
cd81e373121bc0e6c1ef8d2cc7ad97810aa651aa

push

github

web-flow
Merge pull request #21888 from Yoast/feature/dash-phase-1

Introduce the dashboard page

7603 of 13697 branches covered (55.51%)

Branch coverage included in aggregate %.

36 of 709 new or added lines in 72 files covered. (5.08%)

790 existing lines in 3 files now uncovered.

29774 of 55400 relevant lines covered (53.74%)

41427.34 hits per line

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

0.0
/src/editors/application/analysis-features/enabled-analysis-features-repository.php
1
<?php
2

3
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4
namespace Yoast\WP\SEO\Editors\Application\Analysis_Features;
5

6
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature;
7
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature_Interface;
8
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Features_List;
9

10
/**
11
 * The repository to get all enabled features.
12
 *
13
 * @makePublic
14
 */
15
class Enabled_Analysis_Features_Repository {
16

17
        /**
18
         * All plugin features.
19
         *
20
         * @var Analysis_Feature_Interface[]
21
         */
22
        private $plugin_features;
23

24
        /**
25
         * The list of analysis features.
26
         *
27
         * @var Analysis_Features_List
28
         */
29
        private $enabled_analysis_features;
30

31
        /**
32
         * The constructor.
33
         *
34
         * @param Analysis_Feature_Interface ...$plugin_features All analysis objects.
35
         */
36
        public function __construct( Analysis_Feature_Interface ...$plugin_features ) {
×
37
                $this->enabled_analysis_features = new Analysis_Features_List();
×
38
                $this->plugin_features           = $plugin_features;
×
39
        }
40

41
        /**
42
         * Returns the analysis list.
43
         *
44
         * @return Analysis_Features_List The analysis list.
45
         */
46
        public function get_enabled_features(): Analysis_Features_List {
×
47
                if ( \count( $this->enabled_analysis_features->parse_to_legacy_array() ) === 0 ) {
×
48
                        foreach ( $this->plugin_features as $plugin_feature ) {
×
49
                                $analysis_feature = new Analysis_Feature( $plugin_feature->is_enabled(), $plugin_feature->get_name(), $plugin_feature->get_legacy_key() );
×
50
                                $this->enabled_analysis_features->add_feature( $analysis_feature );
×
51
                        }
52
                }
53

UNCOV
54
                return $this->enabled_analysis_features;
×
55
        }
56

57
        /**
58
         * Returns the analysis list for the given names.
59
         *
60
         * @param array<string> $feature_names The feature names to include.
61
         *
62
         * @return Analysis_Features_List The analysis list.
63
         */
NEW
64
        public function get_features_by_keys( array $feature_names ): Analysis_Features_List {
×
NEW
65
                $enabled_analysis_features = new Analysis_Features_List();
×
66

NEW
67
                foreach ( $this->plugin_features as $plugin_feature ) {
×
NEW
68
                        if ( \in_array( $plugin_feature->get_name(), $feature_names, true ) ) {
×
NEW
69
                                $analysis_feature = new Analysis_Feature( $plugin_feature->is_enabled(), $plugin_feature->get_name(), $plugin_feature->get_legacy_key() );
×
NEW
70
                                $enabled_analysis_features->add_feature( $analysis_feature );
×
71
                        }
72
                }
73

NEW
74
                return $enabled_analysis_features;
×
75
        }
76
}
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

© 2026 Coveralls, Inc