mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-24 00:58:12 +02:00
fed8798d04
typos wz git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@167624 c90b9560-bf6c-de11-be94-00142212c4b1
145 lines
3.7 KiB
XML
145 lines
3.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.8 $ -->
|
|
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
|
<refentry id="function.aggregate-info">
|
|
<refnamediv>
|
|
<refname>aggregate_info</refname>
|
|
<refpurpose>
|
|
Retourne un tableau associatif avec les méthodes et propriétés de chaque classe
|
|
qui a été aggrégée
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>aggregate_info</methodname>
|
|
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>aggregate_info</function> retourne un tableau associatif avec
|
|
les méthodes et propriétés de chaque classe qui a été aggrégée pour former
|
|
l'objet <parameter>object</parameter>. La clé du tableau principal
|
|
est le nom de la classe aggrégée.
|
|
</para>
|
|
<para>
|
|
Pour un exemple, voir le code ci-dessous.
|
|
<example>
|
|
<title>Exemple avec <function>aggregate_info</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
class Slicer {
|
|
var $vegetable;
|
|
|
|
function Slicer($vegetable) {
|
|
$this->vegetable = $vegetable;
|
|
}
|
|
|
|
function slice_it($num_cuts) {
|
|
echo "Doing some simple slicing\n";
|
|
for ($i=0; $i < $num_cuts; $i++) {
|
|
// do some slicing
|
|
}
|
|
}
|
|
}
|
|
|
|
class Dicer {
|
|
var $vegetable;
|
|
var $rotation_angle = 90; // degrees
|
|
|
|
function Dicer($vegetable) {
|
|
$this->vegetable = $vegetable;
|
|
}
|
|
|
|
function dice_it($num_cuts) {
|
|
echo "Cutting in one direction\n";
|
|
for ($i=0; $i < $num_cuts; $i++) {
|
|
// do some cutting
|
|
}
|
|
$this->rotate($this->rotation_angle);
|
|
echo "Cutting in a second direction\n";
|
|
for ($i=0; $i < $num_cuts; $i++) {
|
|
// do some more cutting
|
|
}
|
|
}
|
|
|
|
function rotate($deg) {
|
|
echo "Now rotating {$this->vegetable} {$deg} degrees\n";
|
|
}
|
|
|
|
function _secret_super_dicing($num_cuts) {
|
|
// so secret we cannot show you ;-)
|
|
}
|
|
}
|
|
|
|
$obj = new Slicer('onion');
|
|
aggregate($obj, 'Dicer');
|
|
print_r(aggregate_info($obj));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[dicer] => Array
|
|
(
|
|
[methods] => Array
|
|
(
|
|
[0] => dice_it
|
|
[1] => rotate
|
|
)
|
|
|
|
[properties] => Array
|
|
(
|
|
[0] => rotation_angle
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
Comme vous pouvez le voir, toutes les méthodes et propriétés de la
|
|
classe <classname>dicer</classname> ont été aggrégée dans notre nouvel
|
|
objet, à l'exception de la classe constructeur et de la méthode
|
|
privée <methodname>_secret_super_dicing</methodname>
|
|
</para>
|
|
<simpara>
|
|
Voir aussi
|
|
<function>aggregate</function>,
|
|
<function>aggregate_methods</function>,
|
|
<function>aggregate_methods_by_list</function>,
|
|
<function>aggregate_methods_by_regexp</function>,
|
|
<function>aggregate_properties</function>,
|
|
<function>aggregate_properties_by_list</function>,
|
|
<function>aggregate_properties_by_regexp</function> et
|
|
<function>deaggregate</function>.
|
|
</simpara>
|
|
</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:"../../../../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
|
|
-->
|