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

Yoast / wordpress-seo / ede6fd7c0b60c6046f5ca05162944c7a397d5d8b

20 Nov 2024 03:11PM UTC coverage: 54.21% (-2.9%) from 57.113%
ede6fd7c0b60c6046f5ca05162944c7a397d5d8b

Pull #21847

github

web-flow
Merge 428b097d7 into 74d330cc7
Pull Request #21847: Create API endpoints for SEO and readability scores

7593 of 13666 branches covered (55.56%)

Branch coverage included in aggregate %.

0 of 303 new or added lines in 24 files covered. (0.0%)

29764 of 55246 relevant lines covered (53.88%)

41542.83 hits per line

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

0.0
/src/dashboard/user-interface/scores/seo-scores-route.php
1
<?php
2
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
namespace Yoast\WP\SEO\Dashboard\User_Interface\Scores;
4

5
use Yoast\WP\SEO\Conditionals\No_Conditionals;
6
use Yoast\WP\SEO\Dashboard\Application\Scores\SEO_Scores\SEO_Scores_Repository;
7
use Yoast\WP\SEO\Dashboard\Domain\Content_Types\Content_Type;
8
use Yoast\WP\SEO\Dashboard\Domain\Taxonomies\Taxonomy;
9
use Yoast\WP\SEO\Routes\Route_Interface;
10

11
/**
12
 * Registers a route to get SEO scores.
13
 */
14
class SEO_Scores_Route implements Route_Interface {
15

16
        use Scores_Route_Trait;
17
        use No_Conditionals;
18

19
        /**
20
         * Represents the prefix.
21
         *
22
         * @var string
23
         */
24
        public const ROUTE_PREFIX = '/seo_scores';
25

26
        /**
27
         * The SEO Scores repository.
28
         *
29
         * @var SEO_Scores_Repository
30
         */
31
        private $seo_scores_repository;
32

33
        /**
34
         * Constructs the class.
35
         *
36
         * @param SEO_Scores_Repository $seo_scores_repository The SEO Scores repository.
37
         */
NEW
38
        public function __construct(
×
39
                SEO_Scores_Repository $seo_scores_repository
40
        ) {
NEW
41
                $this->seo_scores_repository = $seo_scores_repository;
×
42
        }
43

44
        /**
45
         * Returns the SEO scores of a content type.
46
         *
47
         * @param Content_Type  $content_type The content type.
48
         * @param Taxonomy|null $taxonomy     The taxonomy of the term we're filtering for.
49
         * @param int|null      $term_id      The ID of the term we're filtering for.
50
         *
51
         * @return array<array<string, string|int|array<string, string>>> The SEO scores.
52
         */
NEW
53
        public function calculate_scores( Content_Type $content_type, ?Taxonomy $taxonomy, ?int $term_id ) {
×
NEW
54
                return $this->seo_scores_repository->get_seo_scores( $content_type, $taxonomy, $term_id );
×
55
        }
56
}
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