private function chunkSplit(array $thrifts): array
    {
        $actualBufferSize = $this->zipkinBatchOverheadLength;
        $chunkId = 0;
        $chunks = [];

        foreach ($thrifts as $thrift) {
            $spanBufferLength = $this->getBufferLength($thrift);

            if (!empty($chunks[$chunkId]) && ($actualBufferSize + $spanBufferLength) > $this->maxBufferLength) {
                // point to next chunk
                ++$chunkId;

                // reset buffer size
                $actualBufferSize = $this->zipkinBatchOverheadLength;
            }

            if (!isset($chunks[$chunkId])) {
                $chunks[$chunkId] = [];
            }

            $chunks[$chunkId][] = $thrift;
            $actualBufferSize += $spanBufferLength;
        }

        return $chunks;
    }
private function chunkSplit(array $thrifts): array
    {
        $actualBufferSize = $this->zipkinBatchOverheadLength;
        $chunkId = 0;
        $chunks = [];

        foreach ($thrifts as $thrift) {
            $spanBufferLength = $this->getBufferLength($thrift);

            if (!empty($chunks[$chunkId]) && ($actualBufferSize + $spanBufferLength) > $this->maxBufferLength) {
                // point to next chunk
                ++$chunkId;

                // reset buffer size
                $actualBufferSize = $this->zipkinBatchOverheadLength;
            }

            if (!isset($chunks[$chunkId])) {
                $chunks[$chunkId] = [];
            }

            $chunks[$chunkId][] = $thrift;
            $actualBufferSize += $spanBufferLength;
        }

        return $chunks;
    }
private function chunkSplit ( array $ thrifts ) : array { $ actualBufferSize = $ this -> zipkinBatchOverheadLength ; $ chunkId = 0 ; $ chunks = [ ] ; foreach ( $ thrifts as $ thrift ) { $ spanBufferLength = $ this -> getBufferLength ( $ thrift ) ; if ( ! empty ( $ chunks [ $ chunkId ] ) && ( $ actualBufferSize + $ spanBufferLength ) > $ this -> maxBufferLength ) { // point to next chunk ++ $ chunkId ; // reset buffer size $ actualBufferSize = $ this -> zipkinBatchOverheadLength ; } if ( ! isset ( $ chunks [ $ chunkId ] ) ) { $ chunks [ $ chunkId ] = [ ] ; } $ chunks [ $ chunkId ] [ ] = $ thrift ; $ actualBufferSize += $ spanBufferLength ; } return $ chunks ; }
Splits an array of thrift-objects into several chunks when the buffer limit has been reached.

@param array|ThriftSpan[]|TBase[] $thrifts

@return array
Splits an array of thrift - objects into several chunks when the buffer limit has been reached .