2002-12-05 21:44:07 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-08-20 09:37:01 +00:00
|
|
|
<!-- $Revision: 1.6 $ -->
|
2002-12-05 21:44:07 +00:00
|
|
|
<refentry id="function.aggregate-info">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>aggregate_info</refname>
|
|
|
|
<refpurpose>
|
2004-03-02 12:50:22 +00:00
|
|
|
Returns an associative array of the methods and properties from
|
2004-08-20 09:37:01 +00:00
|
|
|
each class that has been aggregated to the object
|
2002-12-05 21:44:07 +00:00
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>array</type><methodname>aggregate_info</methodname>
|
|
|
|
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2003-12-18 14:14:41 +00:00
|
|
|
Will return the aggregation information for a particular object
|
2002-12-05 21:44:07 +00:00
|
|
|
as an associative array of arrays of methods and properties. The
|
|
|
|
key for the main array is the name of the aggregated class.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
For example the code below
|
|
|
|
<example>
|
|
|
|
<title>Using <function>aggregate_info</function></title>
|
2003-08-16 17:21:41 +00:00
|
|
|
<programlisting role="php">
|
2002-12-05 21:44:07 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class Slicer {
|
|
|
|
var $vegetable;
|
|
|
|
|
2004-01-15 12:43:50 +00:00
|
|
|
function Slicer($vegetable)
|
|
|
|
{
|
2002-12-05 21:44:07 +00:00
|
|
|
$this->vegetable = $vegetable;
|
|
|
|
}
|
|
|
|
|
2004-01-15 12:43:50 +00:00
|
|
|
function slice_it($num_cuts)
|
|
|
|
{
|
2002-12-05 21:44:07 +00:00
|
|
|
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
|
|
|
|
|
2004-01-15 12:43:50 +00:00
|
|
|
function Dicer($vegetable)
|
|
|
|
{
|
2002-12-05 21:44:07 +00:00
|
|
|
$this->vegetable = $vegetable;
|
|
|
|
}
|
|
|
|
|
2004-01-15 12:43:50 +00:00
|
|
|
function dice_it($num_cuts)
|
|
|
|
{
|
2002-12-05 21:44:07 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-15 12:43:50 +00:00
|
|
|
function rotate($deg)
|
|
|
|
{
|
2002-12-05 21:44:07 +00:00
|
|
|
echo "Now rotating {$this->vegetable} {$deg} degrees\n";
|
|
|
|
}
|
|
|
|
|
2004-01-15 12:43:50 +00:00
|
|
|
function _secret_super_dicing($num_cuts)
|
|
|
|
{
|
2002-12-05 21:44:07 +00:00
|
|
|
// so secret we cannot show you ;-)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$obj = new Slicer('onion');
|
|
|
|
aggregate($obj, 'Dicer');
|
|
|
|
print_r(aggregate_info($obj));
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
2003-08-16 17:21:41 +00:00
|
|
|
<para>
|
|
|
|
Will produce the output
|
|
|
|
</para>
|
|
|
|
<screen>
|
2002-12-05 21:44:07 +00:00
|
|
|
<![CDATA[
|
|
|
|
Array
|
|
|
|
(
|
|
|
|
[dicer] => Array
|
|
|
|
(
|
|
|
|
[methods] => Array
|
|
|
|
(
|
|
|
|
[0] => dice_it
|
|
|
|
[1] => rotate
|
|
|
|
)
|
|
|
|
|
|
|
|
[properties] => Array
|
|
|
|
(
|
|
|
|
[0] => rotation_angle
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
]]>
|
2003-08-16 17:21:41 +00:00
|
|
|
</screen>
|
|
|
|
</example>
|
2002-12-05 21:44:07 +00:00
|
|
|
As you can see, all properties and methods of the
|
|
|
|
<classname>Dicer</classname> class have been aggregated
|
|
|
|
into our new object, with the exception of the class
|
|
|
|
constructor and the method <methodname>_secret_super_dicing</methodname>
|
|
|
|
</para>
|
|
|
|
<simpara>
|
|
|
|
See also
|
|
|
|
<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>,
|
|
|
|
<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
|
|
|
|
-->
|