Back to Joomla project (class list)

Class CMSObject - list of methods

Joomla Platform Object Class
This class allows for simple but smart objects with get and set methods and an internal error handler.

Direct known subclasses

Package: Joomla\CMS\Object
Copyright: (C) 2005 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Object/CMSObject.php
Project: Joomla

Method Summary

public
(mixed $properties = null)

Class constructor, overridden in descendant classes.
Parameters
  • mixed $properties Either and associative array or another object to set the initial properties of the object.
Since
  • 1.7.0
Show source code of this method: __construct Source Code

public string
()

Magic method to convert the object to a string gracefully.
Returns
  • string The classname.
Since
  • 1.7.0
Deprecated
  • 3.1.4
Show source code of this method: __toString Source Code

public mixed
(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
Show source code of this method: def Source Code

public mixed
(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()
Show source code of this method: get Source Code

public array
(mixed $public = true)

Returns an associative array of object properties.
Parameters
  • bool $public If true, returns only the public properties.
Returns
  • array
Since
  • 1.7.0
-
  • \Joomla\CMS\Object\CMSObject::get()
Show source code of this method: getProperties Source Code

public string
(mixed $i = null, mixed $toString = true)

Get the most recent error message.
Parameters
  • int $i Option error index.
  • bool $toString Indicates if Exception objects should return their error message.
Returns
  • string Error message
Since
  • 1.7.0
Deprecated
  • 3.1.4
Show source code of this method: getError Source Code

public array
()

Return all errors, if any.
Returns
  • array Array of error messages.
Since
  • 1.7.0
Deprecated
  • 3.1.4
Show source code of this method: getErrors Source Code

public mixed
(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
Show source code of this method: set Source Code

public bool
(mixed $properties)

Set the object properties based on a named array/hash.
Parameters
  • mixed $properties Either an associative array or another object.
Returns
  • bool
Since
  • 1.7.0
-
  • \Joomla\CMS\Object\CMSObject::set()
Show source code of this method: setProperties Source Code

public void
(mixed $error)

Add an error message.
Parameters
  • string $error Error message.
Returns
  • void
Since
  • 1.7.0
Deprecated
  • 3.1.4
Show source code of this method: setError Source Code

Properties Summary

protected array
$_errors
An array of error messages or Exception objects.
Since
  • 1.7.0
-
  • array

Tags Summary

Since
1.7.0
Deprecated
4.0.0
Use \stdClass or \Joomla\Registry\Registry instead.