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

Yoast / wordpress-seo / dec7c853399f4bc278ee30e5e85eb0d44b269b0f

15 Oct 2024 12:07PM UTC coverage: 49.393% (-5.2%) from 54.558%
dec7c853399f4bc278ee30e5e85eb0d44b269b0f

push

github

web-flow
Merge pull request #21707 from Yoast/1909-minor-237-new-dash-ftc-notice-should-not-be-shown-on-ftc-page

Remove notices on FTC tab

7539 of 13559 branches covered (55.6%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

4291 existing lines in 144 files now uncovered.

25662 of 53659 relevant lines covered (47.82%)

42477.44 hits per line

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

50.0
/src/surfaces/helpers-surface.php
1
<?php
2

3
namespace Yoast\WP\SEO\Surfaces;
4

5
use Yoast\WP\SEO\Exceptions\Forbidden_Property_Mutation_Exception;
6
use Yoast\WP\SEO\Helpers;
7
use YoastSEO_Vendor\Symfony\Component\DependencyInjection\ContainerInterface;
8

9
/**
10
 * Class Helpers_Surface.
11
 *
12
 * Surface for the indexables.
13
 *
14
 * @property Helpers\Asset_Helper                           $asset
15
 * @property Helpers\Author_Archive_Helper                  $author_archive
16
 * @property Helpers\Blocks_Helper                          $blocks
17
 * @property Helpers\Capability_Helper                      $capability
18
 * @property Helpers\Current_Page_Helper                    $current_page
19
 * @property Helpers\Date_Helper                            $date
20
 * @property Helpers\Environment_Helper                     $environment
21
 * @property Helpers\First_Time_Configuration_Notice_Helper $first_time_configuration_notice
22
 * @property Helpers\Home_Url_Helper                        $home_url
23
 * @property Helpers\Image_Helper                           $image
24
 * @property Helpers\Indexable_Helper                       $indexable
25
 * @property Helpers\Indexing_Helper                        $indexing
26
 * @property Helpers\Input_Helper                           $input
27
 * @property Helpers\Language_Helper                        $language
28
 * @property Helpers\Meta_Helper                            $meta
29
 * @property Helpers\Notification_Helper                    $notification
30
 * @property Helpers\Options_Helper                         $options
31
 * @property Helpers\Pagination_Helper                      $pagination
32
 * @property Helpers\Permalink_Helper                       $permalink
33
 * @property Helpers\Post_Helper                            $post
34
 * @property Helpers\Post_Type_Helper                       $post_type
35
 * @property Helpers\Primary_Term_Helper                    $primary_term
36
 * @property Helpers\Product_Helper                         $product
37
 * @property Helpers\Redirect_Helper                        $redirect
38
 * @property Helpers\Require_File_Helper                    $require_file
39
 * @property Helpers\Robots_Helper                          $robots
40
 * @property Helpers\Short_Link_Helper                      $short_link
41
 * @property Helpers\Site_Helper                            $site
42
 * @property Helpers\String_Helper                          $string
43
 * @property Helpers\Social_Profiles_Helper                 $social_profiles
44
 * @property Helpers\Taxonomy_Helper                        $taxonomy
45
 * @property Helpers\Url_Helper                             $url
46
 * @property Helpers\User_Helper                            $user
47
 * @property Helpers\Woocommerce_Helper                     $woocommerce
48
 * @property Helpers\Wordpress_Helper                       $wordpress
49
 */
50
class Helpers_Surface {
51

52
        /**
53
         * The DI container.
54
         *
55
         * @var ContainerInterface
56
         */
57
        private $container;
58

59
        /**
60
         * The open_graph helper namespace
61
         *
62
         * @var Open_Graph_Helpers_Surface
63
         */
64
        public $open_graph;
65

66
        /**
67
         * The schema helper namespace
68
         *
69
         * @var Schema_Helpers_Surface
70
         */
71
        public $schema;
72

73
        /**
74
         * The twitter helper namespace
75
         *
76
         * @var Twitter_Helpers_Surface
77
         */
78
        public $twitter;
79

80
        /**
81
         * Loader constructor.
82
         *
83
         * @param ContainerInterface         $container  The dependency injection container.
84
         * @param Open_Graph_Helpers_Surface $open_graph The OpenGraph helpers surface.
85
         * @param Schema_Helpers_Surface     $schema     The Schema helpers surface.
86
         * @param Twitter_Helpers_Surface    $twitter    The Twitter helpers surface.
87
         */
88
        public function __construct(
×
89
                ContainerInterface $container,
90
                Open_Graph_Helpers_Surface $open_graph,
91
                Schema_Helpers_Surface $schema,
92
                Twitter_Helpers_Surface $twitter
93
        ) {
94
                $this->container  = $container;
×
95
                $this->open_graph = $open_graph;
×
96
                $this->schema     = $schema;
×
97
                $this->twitter    = $twitter;
×
98
        }
99

100
        /**
101
         * Magic getter for getting helper classes.
102
         *
103
         * @param string $helper The helper to get.
104
         *
105
         * @return mixed The helper class.
106
         */
107
        public function __get( $helper ) {
12✔
108
                return $this->container->get( $this->get_helper_class( $helper ) );
12✔
109
        }
110

111
        /**
112
         * Magic isset for ensuring helper exists.
113
         *
114
         * @param string $helper The helper to get.
115
         *
116
         * @return bool Whether the helper exists.
117
         */
118
        public function __isset( $helper ) {
12✔
119
                return $this->container->has( $this->get_helper_class( $helper ) );
12✔
120
        }
121

122
        /**
123
         * Prevents setting dynamic properties and unsetting declared properties
124
         * from an inaccessible context.
125
         *
126
         * @param string $name  The property name.
127
         * @param mixed  $value The property value.
128
         *
129
         * @return void
130
         *
131
         * @throws Forbidden_Property_Mutation_Exception Set is never meant to be called.
132
         */
133
        public function __set( $name, $value ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- __set must have a name and value - PHPCS #3715.
6✔
134
                throw Forbidden_Property_Mutation_Exception::cannot_set_because_property_is_immutable( $name );
6✔
135
        }
136

137
        /**
138
         * Prevents unsetting dynamic properties and unsetting declared properties
139
         * from an inaccessible context.
140
         *
141
         * @param string $name The property name.
142
         *
143
         * @return void
144
         *
145
         * @throws Forbidden_Property_Mutation_Exception Unset is never meant to be called.
146
         */
147
        public function __unset( $name ) {
6✔
148
                throw Forbidden_Property_Mutation_Exception::cannot_unset_because_property_is_immutable( $name );
6✔
149
        }
150

151
        /**
152
         * Get the class name from a helper slug
153
         *
154
         * @param string $helper The name of the helper.
155
         *
156
         * @return string
157
         */
UNCOV
158
        protected function get_helper_class( $helper ) {
×
UNCOV
159
                $helper = \implode( '_', \array_map( 'ucfirst', \explode( '_', $helper ) ) );
×
160

UNCOV
161
                return "Yoast\WP\SEO\Helpers\\{$helper}_Helper";
×
162
        }
163
}
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