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

Yoast / wordpress-seo / 95c672152660bf66cab85494d1b0d81743f96f9e

03 Dec 2024 10:19AM UTC coverage: 54.277% (-0.4%) from 54.693%
95c672152660bf66cab85494d1b0d81743f96f9e

Pull #21888

github

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

Fix discrepancies in scores due to weird data
Pull Request #21888: Introduce the dashboard page

7603 of 13609 branches covered (55.87%)

Branch coverage included in aggregate %.

35 of 562 new or added lines in 54 files covered. (6.23%)

811 existing lines in 5 files now uncovered.

29773 of 55253 relevant lines covered (53.88%)

41537.56 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