Apple_Exporter\Component_Factory::get_component PHP Method

get_component() public static method

Get a component.
public static get_component ( string $shortname, string $html ) : Component
$shortname string
$html string
return Component
    public static function get_component($shortname, $html)
    {
        $class = self::$components[$shortname];
        if (is_null($class) || !class_exists($class)) {
            return null;
        }
        return new $class($html, self::$workspace, self::$settings, self::$styles, self::$layouts);
    }

Usage Example

 /**
  * Get a component from the shortname.
  *
  * @param string $shortname
  * @param string $html
  * @return Component
  * @access private
  */
 private function get_component_from_shortname($shortname, $html = null)
 {
     return Component_Factory::get_component($shortname, $html);
 }