php-doc-en/reference/objaggregation/functions/aggregate-info.xml
Daniel Egeberg 96c9d88bad Converted to utf-8
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297028 c90b9560-bf6c-de11-be94-00142212c4b1
2010-03-28 22:10:10 +00:00

180 lines
4.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.aggregate-info" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>aggregate_info</refname>
<refpurpose>
Gets aggregation information for a given object
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>aggregate_info</methodname>
<methodparam><type>object</type><parameter>object</parameter></methodparam>
</methodsynopsis>
<para>
Gets the aggregation information for the given
<parameter>object</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the aggregation information as an associative array of arrays of
methods and properties. The key for the main array is the name of the
aggregated class.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<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>
&example.outputs;
<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>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>aggregate</function></member>
<member><function>aggregate_methods</function></member>
<member><function>aggregate_methods_by_list</function></member>
<member><function>aggregate_methods_by_regexp</function></member>
<member><function>aggregate_properties</function></member>
<member><function>aggregate_properties_by_list</function></member>
<member><function>aggregate_properties_by_regexp</function></member>
<member><function>deaggregate</function></member>
</simplelist>
</para>
</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
-->