Back to HelperFactory class

Method getHelper

public \stdClass
getHelper
(string $name, array $config = [])
Returns a helper instance for the given name.
Parameters
  • string $name The name
  • array $config The config
Returns
  • \stdClass
Since
  • 4.0.0
Class: HelperFactory
Project: Joomla

Method getHelper - Source code

/**
 * Returns a helper instance for the given name.
 *
 * @param   string  $name    The name
 * @param   array   $config  The config
 *
 * @return  \stdClass
 *
 * @since   4.0.0
 */
public function getHelper(string $name, array $config = [])
{
    $className = '\\' . trim($this->namespace, '\\') . '\\' . $name;
    if (!class_exists($className)) {
        return null;
    }
    return new $className($config);
}