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

209 lines
5.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ec2fe9a592f794978114ef5021db9f1d00c2e05d Maintainer: sobak Status: ready -->
<!-- $Revision$ -->
<refentry xml:id="reflectionclass.getmethods" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionClass::getMethods</refname>
<refpurpose>Pobiera tablicę metod</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionClass">
<modifier>public</modifier> <type>array</type><methodname>ReflectionClass::getMethods</methodname>
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>filter</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Pobiera tablicę metod klasy.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filter</parameter></term>
<listitem>
<para>
Filtruje wyniki tak, aby zawierały tylko metody z określonymi atrybutami. Domyślnie
brak filtrowania.
</para>
<para>
Dowolna kombinacja bitowa stałych <constant>ReflectionMethod::IS_STATIC</constant>,
<constant>ReflectionMethod::IS_PUBLIC</constant>,
<constant>ReflectionMethod::IS_PROTECTED</constant>,
<constant>ReflectionMethod::IS_PRIVATE</constant>,
<constant>ReflectionMethod::IS_ABSTRACT</constant>,
<constant>ReflectionMethod::IS_FINAL</constant>,
aby zwrócić metody pasujące do <emphasis>któregokolwiek</emphasis> z
podanych atrybutów.
</para>
<note>
<simpara>
Zauważ że inne operatory bitowe, na przykład <literal>~</literal>,
nie będą działały jak oczekiwane. Innymi słowy nie jest możliwe
np. pobranie wszystkich metod niestatycznych.
</simpara>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Tablica obiektów <classname>ReflectionMethod</classname>
reprezentujących każdą z metod.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>7.2.0</entry>
<entry>
Parametr <parameter>filter</parameter> dopuszcza teraz &null;.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Podstawowe użycie <methodname>ReflectionClass::getMethods</methodname></title>
<programlisting role="php">
<![CDATA[
<?php
class Jablko {
public function pierwszaMetoda() { }
final protected function drugaMetoda() { }
private static function trzeciaMetoda() { }
}
$class = new ReflectionClass('Jablko');
$methods = $class->getMethods();
var_dump($methods);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(3) {
[0]=>
object(ReflectionMethod)#2 (2) {
["name"]=>
string(11) "pierwszaMetoda"
["class"]=>
string(5) "Jablko"
}
[1]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(12) "drugaMetoda"
["class"]=>
string(5) "Jablko"
}
[2]=>
object(ReflectionMethod)#4 (2) {
["name"]=>
string(11) "trzeciaMetoda"
["class"]=>
string(5) "Jablko"
}
}
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Filtrowanie wyników <methodname>ReflectionClass::getMethods</methodname></title>
<programlisting role="php">
<![CDATA[
<?php
class Jablko {
public function pierwszaMetoda() { }
final protected function drugaMetoda() { }
private static function trzeciaMetoda() { }
}
$class = new ReflectionClass('Jablko');
$methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_FINAL);
var_dump($methods);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(2) {
[0]=>
object(ReflectionMethod)#2 (2) {
["name"]=>
string(12) "drugaMetoda"
["class"]=>
string(5) "Jablko"
}
[1]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(11) "trzeciaMetoda"
["class"]=>
string(5) "Jablko"
}
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>ReflectionClass::getMethod</methodname></member>
<member><function>get_class_methods</function></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
-->