mirror of
https://github.com/php/doc-ja.git
synced 2026-03-28 00:52:12 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@321714 c90b9560-bf6c-de11-be94-00142212c4b1
137 lines
3.5 KiB
XML
137 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 8c6d47907a700e7d824c6b02108d631e5cc1091f Maintainer: takagi Status: ready -->
|
|
|
|
<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>プロパティを取得する</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>
|
|
プロパティを取得します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filter</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
オプションのフィルタで、取得したいプロパティの型を絞り込みます。
|
|
<link linkend="reflectionproperty.constants.modifiers">ReflectionProperty の定数</link>
|
|
で設定し、デフォルトではすべてのプロパティ型を取得します。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<classname>ReflectionProperty</classname> オブジェクトの配列を返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example xml:id="reflectionclass.getproperties.example.filter">
|
|
<title><function>ReflectionClass::getProperties</function> でのフィルタリングの例</title>
|
|
<para>
|
|
この例では、オプションのパラメータ <parameter>filter</parameter>
|
|
を使って private プロパティを読み飛ばします。
|
|
</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.modifiers">ReflectionProperty の修飾子定数</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
|
|
-->
|