Loading:


array aggregate_info
array aggregate_info ( object $object )

 

Pobiera informacje o agregacji  dla danego obiektu.


Parametry

object

 


Zwracane wartości

Zwraca informacje o agregacji  jako tablicę asocjacyjną, tablicy metod i właściwości. Kluczem do głównej tablicy jest nazwa zagregowanej klasy



Napisz Artyku³

Listing



//Example #1 Użycie aggregate_info()

<?php

class Slicer {
    var $vegetable;

    function Slicer($vegetable)
    {
        $this->vegetable = $vegetable;
    }

    function slice_it($num_cuts)
    {
        echo "Czynimy pewne proste cięcie\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 "Cięcie w jednym kierunku\n";
        for ($i=0; $i < $num_cuts; $i++) {
            // robimy trochę cięć
        }
        $this->rotate($this->rotation_angle);
        echo "Cięcie w drugim kierunku\n";
        for ($i=0; $i < $num_cuts; $i++) {
            // robimy trochę więcej cieć
        }
    }

    function rotate($deg)
    {
        echo "Treaz obracamy {$this->vegetable} {$deg} degrees\n";
    }

    function _secret_super_dicing($num_cuts)
    {
        // tak tajne że nie możemy pokazać ;-)
    }
}

$obj = new Slicer('onion');
aggregate($obj, 'Dicer');
print_r(aggregate_info($obj));
?>

//Powyższy przykład wyświetli:

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

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

        )

)


   

 




Dodano przez: igor
Ranga: Administrator serwisu Punktów: 28716
Komentarze użytkowników
    • Tre¶æ komentarza
      Kod do komentarza (opcjonalnie)
      PHP JavaScript MySQL Smarty SQL HTML CSS ActionScript
      Autor
      Token
      token

       

       








funkcje.net
Wszelkie prawa zastrzeżone©. | Funkcje.net 2008-2024 v.1.5 | design: diviXdesign & rainbowcolors