ReflectionClass::getProperties
プロパティを取得する
&reftitle.description;
public arrayReflectionClass::getProperties
intnullfilter&null;
プロパティを取得します。
&reftitle.parameters;
filter
オプションのフィルタで、取得したいプロパティの型を絞り込みます。
ReflectionProperty の定数
で設定し、デフォルトではすべてのプロパティ型を取得します。
&reftitle.returnvalues;
ReflectionProperty オブジェクトの配列を返します。
&reftitle.changelog;
&Version;
&Description;
7.2.0
filter は、nullable になりました。
&reftitle.examples;
ReflectionClass::getProperties でのフィルタリングの例
この例では、オプションのパラメータ filter
を使って private プロパティを読み飛ばします。
getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);
foreach ($props as $prop) {
print $prop->getName() . "\n";
}
var_dump($props);
?>
]]>
&example.outputs.similar;
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"
}
}
]]>
&reftitle.seealso;
ReflectionClass::getProperty
ReflectionProperty
ReflectionProperty の修飾子定数