Yoast\WP\SEO\Surfaces

Twitter_Helpers_Surface{}Yoast 1.0

Class Twitter_Helpers_Surface.

Surface for the indexables.

Хуков нет.

Использование

$Twitter_Helpers_Surface = new Twitter_Helpers_Surface();
// use class methods

Методы

  1. public __construct( ContainerInterface $container )
  2. public __get( $helper )
  3. public __isset( $helper )
  4. protected get_helper_class( $helper )

Код Twitter_Helpers_Surface{} Yoast 19.2

class Twitter_Helpers_Surface {

	/**
	 * The DI container.
	 *
	 * @var ContainerInterface
	 */
	private $container;

	/**
	 * Loader constructor.
	 *
	 * @param ContainerInterface $container The dependency injection container.
	 */
	public function __construct( ContainerInterface $container ) {
		$this->container = $container;
	}

	/**
	 * Magic getter for getting helper classes.
	 *
	 * @param string $helper The helper to get.
	 *
	 * @return mixed The helper class.
	 */
	public function __get( $helper ) {
		return $this->container->get( $this->get_helper_class( $helper ) );
	}

	/**
	 * Magic isset for ensuring helper exists.
	 *
	 * @param string $helper The helper to get.
	 *
	 * @return bool The helper class.
	 */
	public function __isset( $helper ) {
		return $this->container->has( $this->get_helper_class( $helper ) );
	}

	/**
	 * Get the class name from a helper slug
	 *
	 * @param string $helper The name of the helper.
	 *
	 * @return string
	 */
	protected function get_helper_class( $helper ) {
		$helper = \implode( '_', \array_map( 'ucfirst', \explode( '_', $helper ) ) );
		return "Yoast\WP\SEO\Helpers\Twitter\\{$helper}_Helper";
	}
}