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

Yoast / wordpress-seo / 6987097851

25 Nov 2023 04:49AM UTC coverage: 49.206% (-0.1%) from 49.302%
6987097851

push

github

web-flow
Merge pull request #20878 from Yoast/JRF/ghactions-minor-tweak

GH Actions: update a few links in inline comments

15305 of 31104 relevant lines covered (49.21%)

4.03 hits per line

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

61.54
/src/surfaces/open-graph-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\Open_Graph;
7
use YoastSEO_Vendor\Symfony\Component\DependencyInjection\ContainerInterface;
8

9
/**
10
 * Class Open_Graph_Helpers_Surface.
11
 *
12
 * Surface for the indexables.
13
 *
14
 * @property Open_Graph\Image_Helper $image
15
 */
16
class Open_Graph_Helpers_Surface {
17

18
        /**
19
         * The DI container.
20
         *
21
         * @var ContainerInterface
22
         */
23
        private $container;
24

25
        /**
26
         * Loader constructor.
27
         *
28
         * @param ContainerInterface $container The dependency injection container.
29
         */
30
        public function __construct( ContainerInterface $container ) {
×
31
                $this->container = $container;
×
32
        }
33

34
        /**
35
         * Magic getter for getting helper classes.
36
         *
37
         * @param string $helper The helper to get.
38
         *
39
         * @return mixed The helper class.
40
         */
41
        public function __get( $helper ) {
12✔
42
                return $this->container->get( $this->get_helper_class( $helper ) );
12✔
43
        }
44

45
        /**
46
         * Magic isset for ensuring helper exists.
47
         *
48
         * @param string $helper The helper to get.
49
         *
50
         * @return bool Whether the helper exists.
51
         */
52
        public function __isset( $helper ) {
12✔
53
                return $this->container->has( $this->get_helper_class( $helper ) );
12✔
54
        }
55

56
        /**
57
         * Prevents setting dynamic properties and unsetting declared properties
58
         * from an inaccessible context.
59
         *
60
         * @param string $name  The property name.
61
         * @param mixed  $value The property value.
62
         *
63
         * @return void
64
         *
65
         * @throws Forbidden_Property_Mutation_Exception Set is never meant to be called.
66
         */
67
        public function __set( $name, $value ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- __set must have a name and value - PHPCS #3715.
6✔
68
                throw Forbidden_Property_Mutation_Exception::cannot_set_because_property_is_immutable( $name );
6✔
69
        }
70

71
        /**
72
         * Prevents unsetting dynamic properties and unsetting declared properties
73
         * from an inaccessible context.
74
         *
75
         * @param string $name The property name.
76
         *
77
         * @return void
78
         *
79
         * @throws Forbidden_Property_Mutation_Exception Unset is never meant to be called.
80
         */
81
        public function __unset( $name ) {
6✔
82
                throw Forbidden_Property_Mutation_Exception::cannot_unset_because_property_is_immutable( $name );
6✔
83
        }
84

85
        /**
86
         * Get the class name from a helper slug
87
         *
88
         * @param string $helper The name of the helper.
89
         *
90
         * @return string
91
         */
92
        protected function get_helper_class( $helper ) {
×
93
                $helper = \implode( '_', \array_map( 'ucfirst', \explode( '_', $helper ) ) );
×
94
                return "Yoast\WP\SEO\Helpers\Open_Graph\\{$helper}_Helper";
×
95
        }
96
}
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