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

Yoast / wordpress-seo / 615786458254e8e87dcdd132597eb2957de8c974

12 Mar 2025 09:34AM UTC coverage: 53.429% (-1.3%) from 54.688%
615786458254e8e87dcdd132597eb2957de8c974

push

github

web-flow
Merge pull request #22093 from Yoast/475-site-kit-setup-widget---dont-show-steps-to-the-right-of-current-step-as-completed

475 site kit setup widget   dont show steps to the right of current step as completed and update copy

7925 of 13994 branches covered (56.63%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

1568 existing lines in 42 files now uncovered.

30525 of 57971 relevant lines covered (52.66%)

41102.05 hits per line

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

0.0
/admin/endpoints/class-endpoint-statistics.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin\Statistics
6
 */
7

8
/**
9
 * Represents an implementation of the WPSEO_Endpoint interface to register one or multiple endpoints.
10
 */
11
class WPSEO_Endpoint_Statistics implements WPSEO_Endpoint {
12

13
        /**
14
         * The namespace of the REST route.
15
         *
16
         * @var string
17
         */
18
        public const REST_NAMESPACE = 'yoast/v1';
19

20
        /**
21
         * The route of the statistics endpoint.
22
         *
23
         * @var string
24
         */
25
        public const ENDPOINT_RETRIEVE = 'statistics';
26

27
        /**
28
         * The name of the capability needed to retrieve data using the endpoints.
29
         *
30
         * @var string
31
         */
32
        public const CAPABILITY_RETRIEVE = 'read';
33

34
        /**
35
         * Service to use.
36
         *
37
         * @var WPSEO_Statistics_Service
38
         */
39
        protected $service;
40

41
        /**
42
         * Constructs the WPSEO_Endpoint_Statistics class and sets the service to use.
43
         *
44
         * @param WPSEO_Statistics_Service $service Service to use.
45
         */
46
        public function __construct( WPSEO_Statistics_Service $service ) {
×
47
                $this->service = $service;
×
48
        }
49

50
        /**
51
         * Registers the REST routes that are available on the endpoint.
52
         *
53
         * @return void
54
         */
55
        public function register() {
×
56
                // Register fetch config.
UNCOV
57
                $route_args = [
×
58
                        'methods'             => 'GET',
×
59
                        'callback'            => [ $this->service, 'get_statistics' ],
×
60
                        'permission_callback' => [ $this, 'can_retrieve_data' ],
×
UNCOV
61
                ];
×
62
                register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_RETRIEVE, $route_args );
×
63
        }
64

65
        /**
66
         * Determines whether or not data can be retrieved for the registered endpoints.
67
         *
68
         * @return bool Whether or not data can be retrieved.
69
         */
70
        public function can_retrieve_data() {
×
71
                return current_user_can( self::CAPABILITY_RETRIEVE );
×
72
        }
73
}
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