public function aggregate(/* [array $uint8_1, array $uint8_2, ...] */)
    {
        // read dynamic arguments
        $count = func_num_args();
        if (! $count) {
            return [];
        }

        // interpret dynamic arguments and concatenate
        // byte arrays into one aggregated byte array `concat`.
        $concat = [];
        $length = 0;
        for ($i = 0; $i < $count; $i++) {
            $argument = func_get_arg($i);
            if (! is_array($argument)) {
                // object is not serialized yet
                $argument = $this->serialize($argument);
            }

            $concat = array_merge($concat, $argument);
            $length += count($argument);
        }

        // prepend size on 4 bytes
        $output = $this->serializeInt($length);

        // append serialized parts
        $output = array_merge($output, $concat);
        return $output;
    }
public function aggregate(/* [array $uint8_1, array $uint8_2, ...] */)
    {
        // read dynamic arguments
        $count = func_num_args();
        if (! $count) {
            return [];
        }

        // interpret dynamic arguments and concatenate
        // byte arrays into one aggregated byte array `concat`.
        $concat = [];
        $length = 0;
        for ($i = 0; $i < $count; $i++) {
            $argument = func_get_arg($i);
            if (! is_array($argument)) {
                // object is not serialized yet
                $argument = $this->serialize($argument);
            }

            $concat = array_merge($concat, $argument);
            $length += count($argument);
        }

        // prepend size on 4 bytes
        $output = $this->serializeInt($length);

        // append serialized parts
        $output = array_merge($output, $concat);
        return $output;
    }
public function aggregate ( /* [array $uint8_1, array $uint8_2, ...] */ ) { // read dynamic arguments $ count = func_num_args ( ) ; if ( ! $ count ) { return [ ] ; } // interpret dynamic arguments and concatenate // byte arrays into one aggregated byte array `concat`. $ concat = [ ] ; $ length = 0 ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ argument = func_get_arg ( $ i ) ; if ( ! is_array ( $ argument ) ) { // object is not serialized yet $ argument = $ this -> serialize ( $ argument ) ; } $ concat = array_merge ( $ concat , $ argument ) ; $ length += count ( $ argument ) ; } // prepend size on 4 bytes $ output = $ this -> serializeInt ( $ length ) ; // append serialized parts $ output = array_merge ( $ output , $ concat ) ; return $ output ; }
This method lets you aggregate multiple serialized
byte arrays.

It will also prepend a size on 4 bytes representing
the *count of the merged/aggregated byte arrays*.

This method accepts *any* count of array arguments.
The passed array must contain UInt8 representation
of bytes (see serializeX methods).

@param   array   $uint8_1
@param   array   $uint8_2
@param   array   $uint8_X
@return  array
This method lets you aggregate multiple serialized byte arrays .