mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166882 c90b9560-bf6c-de11-be94-00142212c4b1
151 lines
3.6 KiB
XML
151 lines
3.6 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.6 $ -->
|
|
<refentry id="function.aggregate-info">
|
|
<refnamediv>
|
|
<refname>aggregate_info</refname>
|
|
<refpurpose>
|
|
Returns an associative array of the methods and properties from
|
|
each class that has been aggregated to the object
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>aggregate_info</methodname>
|
|
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
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.
|
|
</para>
|
|
<para>
|
|
For example the code below
|
|
<example>
|
|
<title>Using <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>
|
|
<para>
|
|
Will produce the output
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[dicer] => Array
|
|
(
|
|
[methods] => Array
|
|
(
|
|
[0] => dice_it
|
|
[1] => rotate
|
|
)
|
|
|
|
[properties] => Array
|
|
(
|
|
[0] => rotation_angle
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
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
|
|
-->
|