API16

JObject/getProperties: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Returns an associative array of object properties. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JObject/getProperties|Edit Descr...
 
m preparing for archive only
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
Returns an associative array of object properties.
Returns an associative array of object properties.


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JObject/getProperties|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JObject/getProperties}}
 
 


===Syntax===
===Syntax===
Line 49: Line 47:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JObject/getProperties|Edit See Also]]<nowiki>]</nowiki>
 
</span>
{{SeeAlso:JObject/getProperties}}


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=getProperties
  category=getProperties
  category=JObject
  category=JObject
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>

Latest revision as of 01:56, 25 March 2017

Description

Returns an associative array of object properties.



Syntax

getProperties($public=true)
Parameter Name Default Value Description
$public true $public If true, returns only the public properties.

Returns

array

Defined in

libraries/joomla/base/object.php

Importing

jimport( 'joomla.base.object' );

Source Body

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;
}



Examples

Code Examples