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 / twitter-helpers-surface.php

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

67 lines 1.4 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\Twitter;
6 use YoastSEO_Vendor\Symfony\Component\DependencyInjection\ContainerInterface;
7
8 /**
9 * Class Twitter_Helpers_Surface.
10 *
11 * Surface for the indexables.
12 *
13 * @property Twitter\Image_Helper $image
14 */
15 class Twitter_Helpers_Surface {
16
17 /**
18 * The DI container.
19 *
20 * @var ContainerInterface
21 */
22 private $container;
23
24 /**
25 * Loader constructor.
26 *
27 * @param ContainerInterface $container The dependency injection container.
28 */
29 public function __construct( ContainerInterface $container ) {
30 $this->container = $container;
31 }
32
33 /**
34 * Magic getter for getting helper classes.
35 *
36 * @param string $helper The helper to get.
37 *
38 * @return mixed The helper class.
39 */
40 public function __get( $helper ) {
41 return $this->container->get( $this->get_helper_class( $helper ) );
42 }
43
44 /**
45 * Magic isset for ensuring helper exists.
46 *
47 * @param string $helper The helper to get.
48 *
49 * @return bool The helper class.
50 */
51 public function __isset( $helper ) {
52 return $this->container->has( $this->get_helper_class( $helper ) );
53 }
54
55 /**
56 * Get the class name from a helper slug
57 *
58 * @param string $helper The name of the helper.
59 *
60 * @return string
61 */
62 protected function get_helper_class( $helper ) {
63 $helper = \implode( '_', \array_map( 'ucfirst', \explode( '_', $helper ) ) );
64 return "Yoast\WP\SEO\Helpers\Twitter\\{$helper}_Helper";
65 }
66 }
67