Back to Input class

Method __get

public \Joomla\Input\Input
__get
(mixed $name)
Magic method to get an input object
Parameters
  • mixed $name Name of the input object to retrieve.
Returns
  • \Joomla\Input\Input The request input object
Since
  • 1.7.0
Deprecated
  • 5.0
Class: Input
Project: Joomla

Method __get - Source code

/**
 * Magic method to get an input object
 *
 * @param   mixed  $name  Name of the input object to retrieve.
 *
 * @return  \Joomla\Input\Input  The request input object
 *
 * @since   1.7.0
 * @deprecated  5.0  Use Joomla\Input\Input instead
 */
public function __get($name)
{
    if (isset($this->inputs[$name])) {
        return $this->inputs[$name];
    }
    $className = '\\Joomla\\CMS\\Input\\' . ucfirst($name);
    if (class_exists($className)) {
        $this->inputs[$name] = new $className(null, $this->options);
        return $this->inputs[$name];
    }
    $superGlobal = '_' . strtoupper($name);
    if (\in_array(strtoupper($name), self::$allowedGlobals, true) && isset($GLOBALS[$superGlobal])) {
        $this->inputs[$name] = new Input($GLOBALS[$superGlobal], $this->options);
        return $this->inputs[$name];
    }
    // Try using the parent class
    return parent::__get($name);
}