mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-26 01:42:09 +01:00
108 lines
2.8 KiB
XML
108 lines
2.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: c44475e1fafcbee203ed4935a6d5d7a01379fcdc Maintainer: girgias Status: ready -->
|
|
<!-- Reviewed: yes Maintainer: girgias -->
|
|
<refentry xml:id="closure.call" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>Closure::call</refname>
|
|
<refpurpose>Lie et appelle la fermeture</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description"><!-- {{{ -->
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>mixed</type><methodname>Closure::call</methodname>
|
|
<methodparam><type>object</type><parameter>newThis</parameter></methodparam>
|
|
<methodparam rep="repeat"><type>mixed</type><parameter>args</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Lie temporairement la fermeture (closure) à <parameter>newThis</parameter>,
|
|
et l'appelle avec les paramètres donné.
|
|
</para>
|
|
</refsect1><!-- }}} -->
|
|
<refsect1 role="parameters"><!-- {{{ -->
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>newThis</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
L'&object; auquel lier la fermeture pour la durée de l'appel.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>args</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Zéro ou plusieurs paramètres, qui seront donnés en tant que paramètres
|
|
à la fermeture.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1><!-- }}} -->
|
|
<refsect1 role="returnvalues"><!-- {{{ -->
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne la valeur de retour de la fermeture.
|
|
</para>
|
|
</refsect1><!-- }}} -->
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Exemple de<function>Closure::call</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
class Value {
|
|
protected $value;
|
|
|
|
public function __construct($value) {
|
|
$this->value = $value;
|
|
}
|
|
|
|
public function getValue() {
|
|
return $this->value;
|
|
}
|
|
}
|
|
|
|
$three = new Value(3);
|
|
$four = new Value(4);
|
|
|
|
$closure = function ($delta) { var_dump($this->getValue() + $delta); };
|
|
$closure->call($three, 4);
|
|
$closure->call($four, 4);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
int(7)
|
|
int(8)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|