mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-26 22:08:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@298817 c90b9560-bf6c-de11-be94-00142212c4b1
135 lines
3.2 KiB
XML
135 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="reflectionclass.getproperties" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>ReflectionClass::getProperties</refname>
|
|
<refpurpose>Gets properties</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>array</type><methodname>ReflectionClass::getProperties</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>filter</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Retrieves reflected properties.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filter</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The optional filter, for filtering desired property types. It's configured using
|
|
the <link linkend="reflectionproperty.constants">ReflectionProperty constants</link>,
|
|
and defaults to all property types.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
An array of <classname>ReflectionProperty</classname> objects.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example xml:id="reflectionclass.getproperties.example.filter">
|
|
<title><function>ReflectionClass::getProperties</function> filtering example</title>
|
|
<para>
|
|
This example demonstrates usage of the optional <parameter>filter</parameter>
|
|
parameter, where it essentially skips private properties.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
class Foo {
|
|
public $foo = 1;
|
|
protected $bar = 2;
|
|
private $baz = 3;
|
|
}
|
|
|
|
$foo = new Foo();
|
|
|
|
$reflect = new ReflectionClass($foo);
|
|
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);
|
|
|
|
foreach ($props as $prop) {
|
|
print $prop->getName() . "\n";
|
|
}
|
|
|
|
var_dump($props);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
foo
|
|
bar
|
|
array(2) {
|
|
[0]=>
|
|
object(ReflectionProperty)#3 (2) {
|
|
["name"]=>
|
|
string(3) "foo"
|
|
["class"]=>
|
|
string(3) "Foo"
|
|
}
|
|
[1]=>
|
|
object(ReflectionProperty)#4 (2) {
|
|
["name"]=>
|
|
string(3) "bar"
|
|
["class"]=>
|
|
string(3) "Foo"
|
|
}
|
|
}
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>ReflectionClass::getProperty</methodname></member>
|
|
<member><classname>ReflectionProperty</classname></member>
|
|
<member><link linkend="reflectionproperty.constants">ReflectionProperty constants</link></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|