1
0
mirror of https://github.com/php/doc-pl.git synced 2026-03-24 15:12:16 +01:00
Files
2024-07-05 06:11:38 +02:00

149 lines
4.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ec2fe9a592f794978114ef5021db9f1d00c2e05d Maintainer: sobak Status: ready -->
<!-- $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>Pobiera wartość</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionProperty">
<modifier>public</modifier> <type>mixed</type><methodname>ReflectionProperty::getValue</methodname>
<methodparam choice="opt"><type class="union"><type>object</type><type>null</type></type><parameter>object</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Pobiera wartość właściwości.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>
Jeżeli właściwość nie jest statyczna, to należy podać obiekt, z którego
właściwość zostanie pobrana. Jeżeli chcesz pobrać domyślną właściwość bez
określania obiektu, użyj <methodname>ReflectionClass::getDefaultProperties</methodname>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Obecna wartość właściwości.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.1.0</entry>
<entry>
Dostęp do właściwości prywatnych i protected jest teraz możliwy
wprost przez <methodname>ReflectionProperty::getValue</methodname>.
Wcześniej musiały one zostać ustawione jako dostępne poprzez wywołanie
<methodname>ReflectionProperty::setAccessible</methodname>; w
przeciwnym razie rzucany był <classname>ReflectionException</classname>.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Parametr <parameter>object</parameter> dopuszcza teraz &null;.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Przykład użycia <methodname>ReflectionProperty::getValue</methodname></title>
<programlisting role="php">
<![CDATA[
<?php
class Foo {
public static $wlasciwoscStatyczna = 'foobar';
public $wlasciwosc = 'barfoo';
protected $wlasciwoscPrywatna = 'foofoo';
}
$reflectionClass = new ReflectionClass('Foo');
var_dump($reflectionClass->getProperty('wlasciwoscStatyczna')->getValue());
var_dump($reflectionClass->getProperty('wlasciwosc')->getValue(new Foo));
$reflectionProperty = $reflectionClass->getProperty('wlasciwoscPrywatna');
$reflectionProperty->setAccessible(true); // wymagane tylko przed PHP 8.1.0
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
-->