Back to CMSObject class

Method getProperties

public array
getProperties
(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()
Class: CMSObject
Project: Joomla

Method getProperties - Source code

/**
 * Returns an associative array of object properties.
 *
 * @param   boolean  $public  If true, returns only the public properties.
 *
 * @return  array
 *
 * @since   1.7.0
 *
 * @see     CMSObject::get()
 */
public function getProperties($public = true)
{
    $vars = get_object_vars($this);
    if ($public) {
        foreach ($vars as $key => $value) {
            if ('_' == substr($key, 0, 1)) {
                unset($vars[$key]);
            }
        }
    }
    return $vars;
}