• 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/capabilities/class-abstract-capability-manager.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin\Capabilities
6
 */
7

8
/**
9
 * Abstract Capability Manager shared code.
10
 */
11
abstract class WPSEO_Abstract_Capability_Manager implements WPSEO_Capability_Manager {
12

13
        /**
14
         * Registered capabilities.
15
         *
16
         * @var array
17
         */
18
        protected $capabilities = [];
19

20
        /**
21
         * Registers a capability.
22
         *
23
         * @param string $capability Capability to register.
24
         * @param array  $roles      Roles to add the capability to.
25
         * @param bool   $overwrite  Optional. Use add or overwrite as registration method.
26
         *
27
         * @return void
28
         */
29
        public function register( $capability, array $roles, $overwrite = false ) {
×
30
                if ( $overwrite || ! isset( $this->capabilities[ $capability ] ) ) {
×
31
                        $this->capabilities[ $capability ] = $roles;
×
32

33
                        return;
×
34
                }
35

36
                // Combine configurations.
37
                $this->capabilities[ $capability ] = array_merge( $roles, $this->capabilities[ $capability ] );
×
38

39
                // Remove doubles.
40
                $this->capabilities[ $capability ] = array_unique( $this->capabilities[ $capability ] );
×
41
        }
42

43
        /**
44
         * Returns the list of registered capabilitities.
45
         *
46
         * @return string[] Registered capabilities.
47
         */
48
        public function get_capabilities() {
×
49
                return array_keys( $this->capabilities );
×
50
        }
51

52
        /**
53
         * Returns a list of WP_Role roles.
54
         *
55
         * The string array of role names are converted to actual WP_Role objects.
56
         * These are needed to be able to use the API on them.
57
         *
58
         * @param array $roles Roles to retrieve the objects for.
59
         *
60
         * @return WP_Role[] List of WP_Role objects.
61
         */
62
        protected function get_wp_roles( array $roles ) {
×
63
                $wp_roles = array_map( 'get_role', $roles );
×
64

65
                return array_filter( $wp_roles );
×
66
        }
67

68
        /**
69
         * Filter capability roles.
70
         *
71
         * @param string $capability Capability to filter roles for.
72
         * @param array  $roles      List of roles which can be filtered.
73
         *
74
         * @return array Filtered list of roles for the capability.
75
         */
UNCOV
76
        protected function filter_roles( $capability, array $roles ) {
×
77
                /**
78
                 * Filter: Allow changing roles that a capability is added to.
79
                 *
80
                 * @param array $roles The default roles to be filtered.
81
                 */
UNCOV
82
                $filtered = apply_filters( $capability . '_roles', $roles );
×
83

84
                // Make sure we have the expected type.
UNCOV
85
                if ( ! is_array( $filtered ) ) {
×
86
                        return [];
×
87
                }
88

UNCOV
89
                return $filtered;
×
90
        }
91
}
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