Back to CMSObject class

Method def

public mixed
def
(mixed $property, mixed $default = null)
Sets a default value if not already assigned
Parameters
  • string $property The name of the property.
  • mixed $default The default value.
Returns
  • mixed
Since
  • 1.7.0
Class: CMSObject
Project: Joomla

Method def - Source code

/**
 * Sets a default value if not already assigned
 *
 * @param   string  $property  The name of the property.
 * @param   mixed   $default   The default value.
 *
 * @return  mixed
 *
 * @since   1.7.0
 */
public function def($property, $default = null)
{
    $value = $this->get($property, $default);
    return $this->set($property, $value);
}