Back to CMSObject class

Method set

public mixed
set
(mixed $property, mixed $value = null)
Modifies a property of the object, creating it if it does not already exist.
Parameters
  • string $property The name of the property.
  • mixed $value The value of the property to set.
Returns
  • mixed Previous value of the property.
Since
  • 1.7.0
Class: CMSObject
Project: Joomla

Method set - Source code

/**
 * Modifies a property of the object, creating it if it does not already exist.
 *
 * @param   string  $property  The name of the property.
 * @param   mixed   $value     The value of the property to set.
 *
 * @return  mixed  Previous value of the property.
 *
 * @since   1.7.0
 */
public function set($property, $value = null)
{
    $previous = $this->{$property} ?? null;
    $this->{$property} = $value;
    return $previous;
}