Документация PHP


Object Aggregation/Composition Функции

aggregate_methods_by_list

Object Aggregation/Composition Функции

PHP Manual


aggregate_info

(No version information available, might be only in CVS)

aggregate_info — Gets aggregation information for a given object

Описание

array aggregate_info ( object $object )

Gets the aggregation information for the given object .

Список параметров

object

Возвращаемые значения

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.

Примеры

Пример #1 Using aggregate_info()

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

Результат выполнения данного примера:

Array
(
    [dicer] => Array
        (
            [methods] => Array
                (
                    [0] => dice_it
                    [1] => rotate
                )

            [properties] => Array
                (
                    [0] => rotation_angle
                )

        )

)

As you can see, all properties and methods of the Dicer class have been aggregated into our new object, with the exception of the class constructor and the method _secret_super_dicing

Смотрите также


Object Aggregation/Composition Функции

aggregate_methods_by_list

Object Aggregation/Composition Функции

PHP Manual

SAPE все усложнил?

MainLink - простая и прибыльная продажа ссылок!

Последние поступления:

Размещена 10 августа 2020 года

Я по ТВ видел, что через 10 лет мы будем жить лучше, чем в Германии...
Я не понял, что это они с Германией сделать хотят?!

читать далее…

ТехЗадание на Землю

Размещена 14 марта 2018 года

Пpоект Genesis (из коpпоpативной пеpеписки)

читать далее…

Шпаргалка по работе с Vim

Размещена 05 декабря 2017 года

Vim довольно мощный редактор, но работа с ним не всегда наглядна.
Например если нужно отредактировать какой-то файл например при помощи crontab, без знания специфики работы с viv никак.

читать далее…

Ошибка: Error: Cannot find a valid baseurl for repo

Размещена 13 сентабря 2017 года

Если возникает ошибка на centos 5 вида
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/

читать далее…

Linux Optimization

Размещена 30 июля 2012 года

Prelink

читать далее…