• 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/infrastructure/content-types/content-types-collector.php
1
<?php
2

3
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4
namespace Yoast\WP\SEO\Dashboard\Infrastructure\Content_Types;
5

6
use Yoast\WP\SEO\Dashboard\Domain\Content_Types\Content_Type;
7
use Yoast\WP\SEO\Helpers\Post_Type_Helper;
8
/**
9
 * Class that collects post types and relevant information.
10
 */
11
class Content_Types_Collector {
12

13
        /**
14
         * The post type helper.
15
         *
16
         * @var Post_Type_Helper
17
         */
18
        private $post_type_helper;
19

20
        /**
21
         * The constructor.
22
         *
23
         * @param Post_Type_Helper $post_type_helper The post type helper.
24
         */
NEW
25
        public function __construct(
×
26
                Post_Type_Helper $post_type_helper
27
        ) {
NEW
28
                $this->post_type_helper = $post_type_helper;
×
29
        }
30

31
        /**
32
         * Returns the content types array.
33
         *
34
         * @return array<string,Content_Type> The content types array.
35
         */
NEW
36
        public function get_content_types(): array {
×
NEW
37
                $content_types = [];
×
NEW
38
                $post_types    = $this->post_type_helper->get_indexable_post_types();
×
39

NEW
40
                foreach ( $post_types as $post_type ) {
×
NEW
41
                        $post_type_object = \get_post_type_object( $post_type ); // @TODO: Refactor `Post_Type_Helper::get_indexable_post_types()` to be able to return objects. That way, we can remove this line.
×
42

NEW
43
                        $content_types[ $post_type_object->name ] = new Content_Type( $post_type_object->name, $post_type_object->label );
×
44
                }
45

NEW
46
                return $content_types;
×
47
        }
48
}
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