Processes child records recursively to get other children into the same array

@param $record
163658
protected function processChildRecord($record)
    {
        $id = (int)$record['uid'];
        $this->checkOptions($record);
        /* @var $recordContentObjectRenderer ContentObjectRenderer */
        $recordContentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
        $recordContentObjectRenderer->start($record, 'tt_content');
        $this->processedRecordVariables[$id] = ['data' => $record];
        if (
            (int)$this->options['recursive'] > 0 &&
            $record['CType'] === 'gridelements_pi1' &&
            !empty($record['tx_gridelements_backend_layout'])
        ) {
            $childProcessorConfiguration = $this->containerProcessorConfiguration;
            $childProcessorConfiguration['dataProcessing.']['0.'] = $this->processorConfiguration;
            $childProcessorConfiguration['dataProcessing.']['0.']['recursive'] = (int)$this->options['recursive'] - 1;
            $childProcessorConfiguration['dataProcessing.']['0'] = 'GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor';
            $this->processedRecordVariables[$id] = $this->contentDataProcessor->process(
                $recordContentObjectRenderer,
                $childProcessorConfiguration,
                $this->processedRecordVariables[$id]
            );
        } else {
            $this->processedRecordVariables[$id] = $this->contentDataProcessor->process(
                $recordContentObjectRenderer,
                $this->containerProcessorConfiguration,
                $this->processedRecordVariables[$id]
            );
        }
    }
582417
protected function write(array $record): void
    {
        $this->ensureProcessIsStarted();

        $this->writeProcessInput($record['formatted']);

        $errors = $this->readProcessErrors();
        if (empty($errors) === false) {
            throw new \UnexpectedValueException(sprintf('Errors while writing to process: %s', $errors));
        }
    }
186203
protected static function extract_item_record_from_record(stdClass $record) {
        $newrec = new stdClass();
        foreach ($record as $key => $value) {
            if (strpos($key, 'item') !== 0) {
                continue;
            }
            $key = substr($key, 4);
            $newrec->{$key} = $value;
        }
        return $newrec;
    }
1003474
protected function processSearchResults($records)
    {
        $results = [];
        foreach ($records as $record) {
            foreach ($record as $attribute => $value) {
                // if the value is an array with a single value, e.g. 'samaccountname' => array(0 => 'myusername')
                // then make sure it's just set in the results as 'samaccountname' => 'myusername' so that it
                // can be used directly by ArrayData
                if (is_array($value) && count($value) == 1) {
                    $value = $value[0];
                }

                // ObjectGUID and ObjectSID attributes are in binary, we need to convert those to strings
                if ($attribute == 'objectguid') {
                    $value = LDAPUtil::bin_to_str_guid($value);
                }
                if ($attribute == 'objectsid') {
                    $value = LDAPUtil::bin_to_str_sid($value);
                }

                $record[$attribute] = $value;
            }

            $results[] = $record;
        }

        return $results;
    }
226189
public function log(\Imi\Log\Record $record)
    {
        if(in_array($record->getLevel(), $this->levels))
        {
            $this->records[] = $record;
            $this->trySave();
        }
    }
1189285
protected static function doesRecordContainModifier($record)
    {
        if (is_array($record)) {
            foreach ($record as $key => $value) {
                if (!empty($key) && ('$' == $key[0])) {
                    return true;
                }
            }
        }

        return false;
    }
55096
public function processRecord(array $record)
    {
        $request = $this->requestStack->getCurrentRequest();

        $record['extra']['user_ip'] = '0.0.0.0';
        if (null !== $request) {
            $record['extra']['user_ip'] = $request->getClientIp();
            $record['extra']['user_name'] = $this->securityContext->getToken()->getUsername();
        }

        $record['extra']['site_name'] = $this->context->getSiteName();
        $record['extra']['site_id'] = $this->context->getSiteId();

        return $record;
    }
307739
private function processRecord(array $record): ?int
    {
        $requestId = $record['requestId'];

        $content = 0 === $record['contentLength'] ? null : $record['contentData'];

        if (DaemonInterface::FCGI_BEGIN_REQUEST === $record['type']) {
            $this->processBeginRequestRecord($requestId, $content);
        } elseif (!isset($this->requests[$requestId])) {
            throw new ProtocolException('Invalid request id for record of type: '.$record['type']);
        } elseif (DaemonInterface::FCGI_PARAMS === $record['type']) {
            while (null !== $content && strlen($content) > 0) {
                $this->readNameValuePair($requestId, $content);
            }
        } elseif (DaemonInterface::FCGI_STDIN === $record['type']) {
            if (null !== $content) {
                fwrite($this->requests[$requestId]['stdin'], $content);
            } else {
                // Returns the status code
                return $this->dispatchRequest($requestId);
            }
        } elseif (DaemonInterface::FCGI_ABORT_REQUEST === $record['type']) {
            $this->endRequest($requestId);
        } else {
            throw new ProtocolException('Unexpected packet of type: '.$record['type']);
        }

        return null; // No status code to return
    }
605630
public function isHandling(array $record)
    {
        if (empty($this->levels)) {
            return true;
        }

        return in_array($record['level'], $this->levels);
    }
818331
public function groupRecords($records)
    {
        if (!is_array($records) || empty($records)) {
            return;
        }

        $groups = array($this->get('element_name') => array());

        foreach ($records as $r) {
            $data = $r->getData($this->get('id'));
            $value = General::sanitize($data['value']);

            if (!isset($groups[$this->get('element_name')][$data['handle']])) {
                $groups[$this->get('element_name')][$data['handle']] = array(
                    'attr' => array('handle' => $data['handle'], 'value' => $value),
                    'records' => array(),
                    'groups' => array()
                );
            }

            $groups[$this->get('element_name')][$data['handle']]['records'][] = $r;
        }

        return $groups;
    }
310268
public function fillRecordWithRelations(Record $record)
    {
        foreach ($this->getWith() as $relation) {
            $relation->fillRecord($record);
        }

        return $record;
    }
1081342
protected function set_rules($record) {
        $comp = $record->createdcomp;
        if ($record->ruletype) {
            $class = $record->ruletype;
            if (class_exists($class)) {
                $oldruleconfig = $record->ruleconfig;
                if ($oldruleconfig == "null") {
                    $oldruleconfig = null;
                }
                $newruleconfig = $class::migrate_config($oldruleconfig, $this->mappings);
                $comp->set('ruleconfig', $newruleconfig);
                $comp->set('ruletype', $class);
                $comp->set('ruleoutcome', $record->ruleoutcome);
                $comp->update();
            }
        }
        foreach ($record->children as $child) {
            $this->set_rules($child);
        }
    }
748724
protected function columnMapRecord($record)
    {
        $adjustedmap = $this->columnMap;
        $newrecord = array();
        foreach ($record as $field => $value) {
            if (isset($adjustedmap[$field])) {
                $newrecord[$adjustedmap[$field]] = $value;
            } else {
                $newrecord[$field] = $value;
            }
        }

        return $newrecord;
    }
1003896
protected function write(array $record)
    {
        if ($record['level'] < Logger::NOTICE) {
            $this->handleDebugRecord($record);
        } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) {
            $this->handleExceptionRecord($record);
        } else {
            $this->handleErrorRecord($record);
        }
    }
1088441
protected function processRecords(array $records)
    {
        $record = new Record();
        $formatter = $this->getFormatter();
        if ($this->isInstanceOf($formatter, FormatterInterface::class)) {
            $formatter->formatRecords($records, $record);
        }

        $this->write($record);

        return $this->bubble;
    }
596368
public function format(array $record)
    {
        $record = parent::format($record);

        $record['tags'] = [];
        $record['custom_data'] = [];
        $record['timestamp'] = null;

        foreach (['extra', 'context'] as $source) {
            if (array_key_exists('tags', $record[$source]) && is_array($record[$source]['tags'])) {
                $record['tags'] = array_merge($record['tags'], $record[$source]['tags']);
            }
            if (array_key_exists('timestamp', $record[$source]) && is_numeric($record[$source]['timestamp'])) {
                $record['timestamp'] = $record[$source]['timestamp'];
            }
            unset($record[$source]['tags'], $record[$source]['timestamp']);
        }

        $record['custom_data'] = $record['extra'];
        $record['extra'] = [];
        foreach ($record['context'] as $key => $item) {
            if (!in_array($key, ['file', 'line', 'exception'])) {
                $record['custom_data'][$key] = $item;
                unset($record['context'][$key]);
            }
        }

        return $record;
    }
230067
protected function write(array $record)
    {
        if (!self::$sendHeaders) {
            return;
        }

        // WildFire-specific headers must be sent prior to any messages
        if (!self::$initialized) {
            self::$initialized = true;

            self::$sendHeaders = $this->headersAccepted();
            if (!self::$sendHeaders) {
                return;
            }

            foreach ($this->getInitHeaders() as $header => $content) {
                $this->sendHeader($header, $content);
            }
        }

        $header = $this->createRecordHeader($record);
        if (trim(current($header)) !== '') {
            $this->sendHeader(key($header), current($header));
        }
    }