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

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@336240 c90b9560-bf6c-de11-be94-00142212c4b1
127 lines
3.3 KiB
XML
127 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="reflectionproperty.getvalue" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>ReflectionProperty::getValue</refname>
|
|
<refpurpose>Gets value</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>mixed</type><methodname>ReflectionProperty::getValue</methodname>
|
|
<methodparam choice="opt"><type>object</type><parameter>object</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Gets the property's value.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>object</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
If the property is non-static an object must be provided to fetch the
|
|
property from. If you want to fetch the default property without
|
|
providing an object use <methodname>ReflectionClass::getDefaultProperties</methodname>
|
|
instead.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
The current value of the property.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Throws a <classname>ReflectionException</classname> if the property is inaccessible.
|
|
You can make a protected or private property accessible using
|
|
<methodname>ReflectionProperty::setAccessible</methodname>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><methodname>ReflectionProperty::getValue</methodname> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
class Foo {
|
|
public static $staticProperty = 'foobar';
|
|
|
|
public $property = 'barfoo';
|
|
protected $privateProperty = 'foofoo';
|
|
}
|
|
|
|
$reflectionClass = new ReflectionClass('Foo');
|
|
|
|
var_dump($reflectionClass->getProperty('staticProperty')->getValue());
|
|
var_dump($reflectionClass->getProperty('property')->getValue(new Foo));
|
|
|
|
$reflectionProperty = $reflectionClass->getProperty('privateProperty');
|
|
$reflectionProperty->setAccessible(true);
|
|
var_dump($reflectionProperty->getValue(new Foo));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
string(6) "foobar"
|
|
string(6) "barfoo"
|
|
string(6) "foofoo"
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>ReflectionProperty::setValue</methodname></member>
|
|
<member><methodname>ReflectionProperty::setAccessible</methodname></member>
|
|
<member><methodname>ReflectionClass::getDefaultProperties</methodname></member>
|
|
<member><methodname>ReflectionClass::getStaticPropertyValue</methodname></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
|
|
-->
|