Back to CMSObject class

Method get

public mixed
get
(mixed $property, mixed $default = null)
Returns a property of the object or the default value if the property is not set.
Parameters
  • string $property The name of the property.
  • mixed $default The default value.
Returns
  • mixed The value of the property.
Since
  • 1.7.0
-
  • \Joomla\CMS\Object\CMSObject::getProperties()
Class: CMSObject
Project: Joomla

Method get - Source code

/**
 * Returns a property of the object or the default value if the property is not set.
 *
 * @param   string  $property  The name of the property.
 * @param   mixed   $default   The default value.
 *
 * @return  mixed    The value of the property.
 *
 * @since   1.7.0
 *
 * @see     CMSObject::getProperties()
 */
public function get($property, $default = null)
{
    if (isset($this->{$property})) {
        return $this->{$property};
    }
    return $default;
}