Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a34ed6838d4b29d38abd504392a4a797 > files > 62

php-manual-es-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>aggregate_info</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual de 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=ISO-8859-1"></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 de 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"
>Siguiente</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="AEN54180"
></A
><P
>    (PHP 5 CVS only)</P
>aggregate_info&nbsp;--&nbsp;
     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="AEN54183"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>aggregate_info</B
> ( object object)<BR
></BR
><P
>&#13;     Will return the aggretaion 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
>&#13;     For example the code below
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN54193"
></A
><P
><B
>Ejemplo 1. Using <B
CLASS="function"
>aggregate_info()</B
></B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php

class Slicer {
    var $vegetable;

    function Slicer($vegetable) {
        $this-&#62;vegetable = $vegetable;
    }

    function slice_it($num_cuts) {
        echo "Doing some simple slicing\n";
        for ($i=0; $i &#60; $num_cuts; $i++) {
            // do some slicing
        }
    }
}

class Dicer {
    var $vegetable;
    var $rotation_angle = 90;   // degrees

    function Dicer($vegetable) {
        $this-&#62;vegetable = $vegetable;
    }

    function dice_it($num_cuts) {
        echo "Cutting in one direction\n";
        for ($i=0; $i &#60; $num_cuts; $i++) {
            // do some cutting
        }
        $this-&#62;rotate($this-&#62;rotation_angle);
        echo "Cutting in a second direction\n";
        for ($i=0; $i &#60; $num_cuts; $i++) {
            // do some more cutting
        }
    }

    function rotate($deg) {
        echo "Now rotating {$this-&#62;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));
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     Will produce the output
     <DIV
CLASS="informalexample"
><A
NAME="AEN54198"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
>Array
(
    [dicer] =&#62; Array
        (
            [methods] =&#62; Array
                (
                    [0] =&#62; dice_it
                    [1] =&#62; rotate
                )

            [properties] =&#62; Array
                (
                    [0] =&#62; rotation_angle
                )

        )

)</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
     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 <TT
CLASS="methodname"
>_secret_super_dicing</TT
>
    </P
><P
>&#13;     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"
>Inicio</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.aggregate-methods-by-list.html"
ACCESSKEY="N"
>Siguiente</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"
>Subir</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>aggregate_methods_by_list</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>