PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 19.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v19.0
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / surfaces / open-graph-helpers-surface.php

open-graph-helpers-surface.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 19.0, at src/surfaces/open-graph-helpers-surface.php

69 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Surfaces;
4
5 use Yoast\WP\SEO\Helpers\Open_Graph;
6 use YoastSEO_Vendor\Symfony\Component\DependencyInjection\ContainerInterface;
7
8 /**
9 * Class Open_Graph_Helpers_Surface.
10 *
11 * Surface for the indexables.
12 *
13 * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded -- 4 words is fine.
14 *
15 * @property Open_Graph\Image_Helper $image
16 */
17 class Open_Graph_Helpers_Surface {
18
19 /**
20 * The DI container.
21 *
22 * @var ContainerInterface
23 */
24 private $container;
25
26 /**
27 * Loader constructor.
28 *
29 * @param ContainerInterface $container The dependency injection container.
30 */
31 public function __construct( ContainerInterface $container ) {
32 $this->container = $container;
33 }
34
35 /**
36 * Magic getter for getting helper classes.
37 *
38 * @param string $helper The helper to get.
39 *
40 * @return mixed The helper class.
41 */
42 public function __get( $helper ) {
43 return $this->container->get( $this->get_helper_class( $helper ) );
44 }
45
46 /**
47 * Magic isset for ensuring helper exists.
48 *
49 * @param string $helper The helper to get.
50 *
51 * @return bool The helper class.
52 */
53 public function __isset( $helper ) {
54 return $this->container->has( $this->get_helper_class( $helper ) );
55 }
56
57 /**
58 * Get the class name from a helper slug
59 *
60 * @param string $helper The name of the helper.
61 *
62 * @return string
63 */
64 protected function get_helper_class( $helper ) {
65 $helper = \implode( '_', \array_map( 'ucfirst', \explode( '_', $helper ) ) );
66 return "Yoast\WP\SEO\Helpers\Open_Graph\\{$helper}_Helper";
67 }
68 }
69