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

Yoast / wordpress-seo / dd6e866a9e6d253114633104d9e3858d807178ba

19 Jun 2024 10:03AM UTC coverage: 48.628% (-4.3%) from 52.936%
dd6e866a9e6d253114633104d9e3858d807178ba

push

github

web-flow
Merge pull request #21431 from Yoast/21429-update-copy-in-the-introduction-and-consent-modals

Updates the copy for the introduction and consent modals

7441 of 13454 branches covered (55.31%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 2 files covered. (0.0%)

3718 existing lines in 107 files now uncovered.

25100 of 53464 relevant lines covered (46.95%)

62392.47 hits per line

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

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

8
/**
9
 * Represents an implementation of the WPSEO_Endpoint interface to register one or multiple endpoints.
10
 */
11
class WPSEO_Endpoint_File_Size 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 endpoint to retrieve the file size.
22
         *
23
         * @var string
24
         */
25
        public const ENDPOINT_SINGULAR = 'file_size';
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 = 'manage_options';
33

34
        /**
35
         * The service provider.
36
         *
37
         * @var WPSEO_File_Size_Service
38
         */
39
        private $service;
40

41
        /**
42
         * Sets the service provider.
43
         *
44
         * @param WPSEO_File_Size_Service $service The service provider.
45
         */
46
        public function __construct( WPSEO_File_Size_Service $service ) {
×
47
                $this->service = $service;
×
48
        }
49

50
        /**
51
         * Registers the routes for the endpoints.
52
         *
53
         * @return void
54
         */
55
        public function register() {
×
UNCOV
56
                $route_args = [
×
57
                        'methods'             => 'GET',
×
UNCOV
58
                        'args'                => [
×
UNCOV
59
                                'url' => [
×
UNCOV
60
                                        'required'    => true,
×
UNCOV
61
                                        'type'        => 'string',
×
UNCOV
62
                                        'description' => 'The url to retrieve',
×
UNCOV
63
                                ],
×
UNCOV
64
                        ],
×
UNCOV
65
                        'callback'            => [
×
66
                                $this->service,
×
67
                                'get',
×
UNCOV
68
                        ],
×
UNCOV
69
                        'permission_callback' => [
×
70
                                $this,
×
71
                                'can_retrieve_data',
×
UNCOV
72
                        ],
×
UNCOV
73
                ];
×
74
                register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_SINGULAR, $route_args );
×
75
        }
76

77
        /**
78
         * Determines whether or not data can be retrieved for the registered endpoints.
79
         *
80
         * @return bool Whether or not data can be retrieved.
81
         */
82
        public function can_retrieve_data() {
×
83
                return current_user_can( self::CAPABILITY_RETRIEVE );
×
84
        }
85
}
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