Loading:


    aggregate_info()

    Pobiera agregacje informacje dla danego obiekt. Pobiera z agregacji informacji na dany obiekt.

     

    Zwraca agregacje informacji jako tablica asocjacyjna z tablic metod i właściwości. Kluczem do głównej tablicy jest nazwą zagregowanych klasy.

     

    Kompatybilność: PHP4, PHP5.



    Napisz Artyku³

    Listing

    <?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++) {
                // robimy jakieś cięcia
            }
        }
    }

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

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

        function dice_it($num_cuts)
        {
            echo "Cutting in one direction\n";
            for ($i=0; $i < $num_cuts; $i++) {
                // zrób jakies cięcia
            }
            $this->rotate($this->rotation_angle);
            echo "Cutting in a second direction\n";
            for ($i=0; $i < $num_cuts; $i++) {
                // zrób jakies cięcia
            }
        }

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

        function _secret_super_dicing($num_cuts)
        {
            // bardzo wazna funkcja ;]
        }
    }

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

    //zwróci:

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

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

            )

    )




    Dodano przez: divix
    Ranga: Administrator serwisu Punktów: 0
    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-2025 v.1.5 | design: diviXdesign & rainbowcolors