<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >aggregate_info</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Object Aggregation/Composition Functions" HREF="ref.objaggregation.html"><LINK REL="PREVIOUS" TITLE="Object Aggregation/Composition Functions" HREF="ref.objaggregation.html"><LINK REL="NEXT" TITLE="aggregate_methods_by_list" HREF="function.aggregate-methods-by-list.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="ref.objaggregation.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.aggregate-methods-by-list.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.aggregate-info" ></A >aggregate_info</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN150306" ></A ><P > (no version information, might be only in CVS)</P >aggregate_info -- Returns an associative array of the methods and properties from each class that has been aggregated to the object </DIV ><DIV CLASS="refsect1" ><A NAME="AEN150309" ></A ><H2 >Description</H2 >array <B CLASS="methodname" >aggregate_info</B > ( object object )<BR ></BR ><P > Will return the aggregation information for a particular object as an associative array of arrays of methods and properties. The key for the main array is the name of the aggregated class. </P ><P > For example the code below <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN150319" ></A ><P ><B >Exemplo 1. Using <B CLASS="function" >aggregate_info()</B ></B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /><br /></font><font color="#007700">class </font><font color="#0000BB">Slicer </font><font color="#007700">{<br /> var </font><font color="#0000BB">$vegetable</font><font color="#007700">;<br /><br /> function </font><font color="#0000BB">Slicer</font><font color="#007700">(</font><font color="#0000BB">$vegetable</font><font color="#007700">) <br /> {<br /> </font><font color="#0000BB">$this</font><font color="#007700">-></font><font color="#0000BB">vegetable </font><font color="#007700">= </font><font color="#0000BB">$vegetable</font><font color="#007700">;<br /> }<br /><br /> function </font><font color="#0000BB">slice_it</font><font color="#007700">(</font><font color="#0000BB">$num_cuts</font><font color="#007700">) <br /> {<br /> echo </font><font color="#DD0000">"Doing some simple slicing\n"</font><font color="#007700">;<br /> for (</font><font color="#0000BB">$i</font><font color="#007700">=</font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$i </font><font color="#007700">< </font><font color="#0000BB">$num_cuts</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">++) {<br /> </font><font color="#FF8000">// do some slicing<br /> </font><font color="#007700">}<br /> }<br />}<br /><br />class </font><font color="#0000BB">Dicer </font><font color="#007700">{<br /> var </font><font color="#0000BB">$vegetable</font><font color="#007700">;<br /> var </font><font color="#0000BB">$rotation_angle </font><font color="#007700">= </font><font color="#0000BB">90</font><font color="#007700">; </font><font color="#FF8000">// degrees<br /><br /> </font><font color="#007700">function </font><font color="#0000BB">Dicer</font><font color="#007700">(</font><font color="#0000BB">$vegetable</font><font color="#007700">) <br /> {<br /> </font><font color="#0000BB">$this</font><font color="#007700">-></font><font color="#0000BB">vegetable </font><font color="#007700">= </font><font color="#0000BB">$vegetable</font><font color="#007700">;<br /> }<br /><br /> function </font><font color="#0000BB">dice_it</font><font color="#007700">(</font><font color="#0000BB">$num_cuts</font><font color="#007700">) <br /> {<br /> echo </font><font color="#DD0000">"Cutting in one direction\n"</font><font color="#007700">;<br /> for (</font><font color="#0000BB">$i</font><font color="#007700">=</font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$i </font><font color="#007700">< </font><font color="#0000BB">$num_cuts</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">++) {<br /> </font><font color="#FF8000">// do some cutting<br /> </font><font color="#007700">}<br /> </font><font color="#0000BB">$this</font><font color="#007700">-></font><font color="#0000BB">rotate</font><font color="#007700">(</font><font color="#0000BB">$this</font><font color="#007700">-></font><font color="#0000BB">rotation_angle</font><font color="#007700">);<br /> echo </font><font color="#DD0000">"Cutting in a second direction\n"</font><font color="#007700">;<br /> for (</font><font color="#0000BB">$i</font><font color="#007700">=</font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$i </font><font color="#007700">< </font><font color="#0000BB">$num_cuts</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">++) {<br /> </font><font color="#FF8000">// do some more cutting<br /> </font><font color="#007700">}<br /> }<br /><br /> function </font><font color="#0000BB">rotate</font><font color="#007700">(</font><font color="#0000BB">$deg</font><font color="#007700">) <br /> {<br /> echo </font><font color="#DD0000">"Now rotating </font><font color="#007700">{</font><font color="#DD0000">$this</font><font color="#007700">-></font><font color="#DD0000">vegetable</font><font color="#007700">}</font><font color="#DD0000"> </font><font color="#007700">{</font><font color="#DD0000">$deg</font><font color="#007700">}</font><font color="#DD0000"> degrees</font><font color="#007700">\n</font><font color="#DD0000">"</font><font color="#007700">;<br /> }<br /><br /> function </font><font color="#0000BB">_secret_super_dicing</font><font color="#007700">(</font><font color="#0000BB">$num_cuts</font><font color="#007700">) <br /> {<br /> </font><font color="#FF8000">// so secret we cannot show you ;-)<br /> </font><font color="#007700">}<br />}<br /><br /></font><font color="#0000BB">$obj </font><font color="#007700">= new </font><font color="#0000BB">Slicer</font><font color="#007700">(</font><font color="#DD0000">'onion'</font><font color="#007700">);<br /></font><font color="#0000BB">aggregate</font><font color="#007700">(</font><font color="#0000BB">$obj</font><font color="#007700">, </font><font color="#DD0000">'Dicer'</font><font color="#007700">);<br /></font><font color="#0000BB">print_r</font><font color="#007700">(</font><font color="#0000BB">aggregate_info</font><font color="#007700">(</font><font color="#0000BB">$obj</font><font color="#007700">));<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P > Will produce the output </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >Array ( [dicer] => Array ( [methods] => Array ( [0] => dice_it [1] => rotate ) [properties] => Array ( [0] => rotation_angle ) ) )</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > As you can see, all properties and methods of the <B CLASS="classname" >Dicer</B > class have been aggregated into our new object, with the exception of the class constructor and the method <CODE CLASS="methodname" >_secret_super_dicing</CODE > </P ><P > See also <A HREF="function.aggregate.html" ><B CLASS="function" >aggregate()</B ></A >, <A HREF="function.aggregate-methods.html" ><B CLASS="function" >aggregate_methods()</B ></A >, <A HREF="function.aggregate-methods-by-list.html" ><B CLASS="function" >aggregate_methods_by_list()</B ></A >, <A HREF="function.aggregate-methods-by-regexp.html" ><B CLASS="function" >aggregate_methods_by_regexp()</B ></A >, <A HREF="function.aggregate-properties.html" ><B CLASS="function" >aggregate_properties()</B ></A >, <A HREF="function.aggregate-properties-by-list.html" ><B CLASS="function" >aggregate_properties_by_list()</B ></A >, <A HREF="function.aggregate-properties-by-regexp.html" ><B CLASS="function" >aggregate_properties_by_regexp()</B ></A >, <A HREF="function.deaggregate.html" ><B CLASS="function" >deaggregate()</B ></A > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="ref.objaggregation.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.aggregate-methods-by-list.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Object Aggregation/Composition Functions</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.objaggregation.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >aggregate_methods_by_list</TD ></TR ></TABLE ></DIV ></BODY ></HTML >