php - aggregate_info

Description

array aggregate_info ( object $object )

Gets the aggregation information for the given object.

Parameters


object

Return Values

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.

Examples

Example 1611. Using aggregate_info()

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));

No comments:

Post a Comment