1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-24 15:52:13 +01:00
Files
archived-doc-ru/reference/reflection/reflectionmethod/invokeargs.xml
2021-01-14 13:10:57 +03:00

142 lines
3.9 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 98df2cf9a939729d73adee1484ec05929c74c98b Maintainer: tmn Status: ready -->
<!-- Reviewed: yes Maintainer: lex -->
<!-- $Revision$ -->
<refentry xml:id="reflectionmethod.invokeargs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionMethod::invokeArgs</refname>
<refpurpose>Вызов метода с передачей аргументов массивом</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>mixed</type><methodname>ReflectionMethod::invokeArgs</methodname>
<methodparam><type class="union"><type>object</type><type>null</type></type><parameter>object</parameter></methodparam>
<methodparam><type>array</type><parameter>args</parameter></methodparam>
</methodsynopsis>
<para>
Вызывает отражённый метод и передаёт ему аргументы в виде массива.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>
Объект, метод которого вызывается. Если метод статический, можно
передать <type>null</type>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>args</parameter></term>
<listitem>
<para>
Массив (<type>array</type>), содержащий аргументы функции.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает результат выполнения метода.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Выбрасывает исключение <classname>ReflectionException</classname>, если в объекте
<parameter>object</parameter> нет определения этого метода.
</para>
<para>
Выбрасывает исключение <classname>ReflectionException</classname>, если вызвать
метод на исполнение не удалось.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>
Пример использования <methodname>ReflectionMethod::invokeArgs</methodname>
</title>
<programlisting role="php">
<![CDATA[
<?php
class HelloWorld {
public function sayHelloTo($name) {
return 'Привет, ' . $name;
}
}
$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
echo $reflectionMethod->invokeArgs(new HelloWorld(), array('Майк'));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Привет, Майк
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
&reflection.invoke.reference;
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>ReflectionMethod::invoke</methodname></member>
<member><link linkend="object.invoke">__invoke()</link></member>
<member><function>call_user_func_array</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
-->