@param array $records
@param int   $currentRecordIndex

@return string
323851
private function formatRecord(array $records, $currentRecordIndex)
    {
        $record = $records[$currentRecordIndex];
        $recordAsString = '';

        if ($this->isLogInfoDisplayed($record)) {
            $logInfo = $this->formatLogInfo($record);
            $recordAsString .= $this->formatAsSection($logInfo);
        }

        if (isset($record['message']) && !empty($record['message'])) {
            $recordAsString .= $this->formatMessage($record).PHP_EOL;
        }

        if (isset($record['context']) && !empty($record['context'])) {
            // if the context contains an error stack trace, remove it to display it separately
            $stack = null;
            if (isset($record['context']['stack'])) {
                $stack = $record['context']['stack'];
                unset($record['context']['stack']);
            }

            $recordAsString .= $this->formatContext($record).PHP_EOL;

            if (null !== $stack) {
                $recordAsString .= '--> Stack Trace:'.PHP_EOL;
                $recordAsString .= $this->formatStackTrace($stack, '    | ');
            }
        }

        if (isset($record['extra']) && !empty($record['extra'])) {
            // don't display the extra information when it's identical to the previous log record
            $previousRecordExtra = isset($records[$currentRecordIndex - 1]) ? $records[$currentRecordIndex - 1]['extra'] : null;
            if ($record['extra'] !== $previousRecordExtra) {
                $recordAsString .= $this->formatExtra($record).PHP_EOL;
            }
        }

        return $recordAsString;
    }
784946
private function hideRecordIfNotTranslated($recordConfig, $record)
    {
        $language = GeneralUtility::_GET('L');
        if ($this->isRecordNotTranslated($recordConfig, $record, $language)) {
            $record = $this->pageRepository->getRecordOverlay($recordConfig['table'], $record, $language);
            if ((int)$record['l10n_parent'] !== 0) {
                return $record;
            }

            return null;
        }

        return $record;
    }
273258
private function getRecordsByHandle(array $records): array
    {
        $recordsByHandle = [];
        foreach ($records as $record) {
            $modelClass = get_class($record);
            $converter = Craft::$app->controller->module->getConverter($modelClass);
            $index = $converter->getRecordIndex($record);
            $recordsByHandle[$index] = $record;
        }

        return $recordsByHandle;
    }
1225209
public function getCurrentIndex($idfield = 'id')
    {
        // TODO: think more to optimize this method
        if (is_array($this->data)) {
            return array_search(current($this->data), $this->data);
        }

        // else it is dsql dataset...
        return $this->current_row[$idfield];
    }
462713
public function findSubdefsByRecordReferenceFromCollection($records, array $names = null)
    {
        $subdefs = $this->reduceRecordReferenceCollection(
            $records,
            function (array &$carry, array $subdefs, array $references) {
                $subdefsByRecordId = [];

                /** @var \media_subdef $subdef */
                foreach ($subdefs as $subdef) {
                    $recordId = $subdef->get_record_id();

                    if (!isset($subdefsByRecordId[$recordId])) {
                        $subdefsByRecordId[$recordId] = [];
                    }

                    $subdefsByRecordId[$recordId][$subdef->get_name()] = $subdef;
                }

                /** @var RecordReferenceInterface $reference */
                foreach ($references as $index => $reference) {
                    if (isset($subdefsByRecordId[$reference->getRecordId()])) {
                        $carry[$index] = $subdefsByRecordId[$reference->getRecordId()];
                    };
                }

                return $carry;
            },
            array_fill_keys(array_keys($records instanceof \Traversable ? iterator_to_array($records) : $records), []),
            $names
        );

        $reordered = [];

        foreach ($records as $index => $record) {
            $reordered[$index] = $subdefs[$index];
        }

        return $reordered;
    }
1209739
public function getRecord($recordId, $dataDimensions = null)
    {

        if ($dataDimensions == null) {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        if ($this->isSingleContentRecordCaching()) {
            $cacheKey = $this->createCacheKey('record', [$this->getCurrentContentTypeName(), $recordId],
                                              $dataDimensions);

            $data = $this->getCacheProvider()->fetch($cacheKey);

            if ($data) {

                $data = json_decode($data, true);
                $recordFactory = $this->getRecordFactory();
                $record        = $recordFactory->createRecordFromJSON($this->getCurrentContentTypeDefinition(), $data);

                $record->setLanguage($dataDimensions->getLanguage());
                $record->setWorkspace($dataDimensions->getWorkspace());
                $record->setViewName($dataDimensions->getViewName());

                $record->setRepository($this);

                return $record;
            }

            $record = parent::getRecord($recordId, $dataDimensions);

            if ($record) {
                $data = json_encode($record);

                $this->getCacheProvider()->save($cacheKey, $data, $this->singleContentRecordCaching);
            }

            return $record;
        }

        return parent::getRecord($recordId, $dataDimensions);
    }
511406
public function format(array $record)
    {
        $formattedRecord = $this->formatter->format($record);

        if (is_array($formattedRecord)) {
            list($channel, $message, $backtrace, $loglevel) = $formattedRecord;

            return [
                $channel,
                $this->formatterPrefix . $message,
                $backtrace,
                $loglevel,
            ];
        }

        return $this->formatterPrefix . $formattedRecord;
    }
1239992
public function multiRewrite($records)
    {
        $ids = [];

        foreach ($records as $record) {
            if (!isset($record[$this->getIdentifier()])) {
                throw new DataStoreException("Identifier is required in 'multiRewrite' action for each record");
            }

            try {
                $rewroteRecord = $this->rewrite($record);
                $ids[] = $rewroteRecord[$this->getIdentifier()];
            } catch (\Throwable $e) {
                // TODO: need to log record that was not rewrote
                continue;
            }
        }

        return $ids;
    }
1043828
public function execute(array $records) : array {
        return array_map(function($record) {
            $contextid = $record->ctxid;
            context_helper::preload_from_record($record);
            $context = context::instance_by_id($contextid);
            return $context;
        }, $records);
    }
572455
protected function prepare( Record_Interface $record ): array {

		$data = [
			'description' => $record->get_description(),
			'category'    => $record->get_category(),
			'offset'      => round( ( $record->get_origin() - $this->origin ) / $this->total * 100, 2 ),
			'width'       => round( $record->get_duration() / $this->total * 100, 2 ),
		];

		return $data;
	}
361386
public function getRecordOnClick($record)
    {
        if (!isset($this->recordOnClick)) {
            return null;
        }

        $recordOnClick = RouterHelper::replaceParameters($record, $this->recordOnClick);
        return Html::attributes(['onclick' => $recordOnClick]);
    }
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;
    }
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;
    }
724397
public static function didFinishIndexingRecords(array $records, databox $databox)
    {
        $connection = $databox->get_connection();
        $sql = "UPDATE record SET jeton = (jeton & ~ :flag) WHERE record_id IN (:record_ids)";
        self::executeFlagQuery($connection, $sql, Flag::TO_INDEX | Flag::INDEXING, $records);
    }
631336
protected static function fixRecords(array $records)
    {
        if (!Arr::isAssoc($records)) {
            foreach ($records as $key => $record) {
                $record['is_sys_admin'] = 1;
                $records[$key] = $record;
            }
        } else {
            $records['is_sys_admin'] = 1;
        }

        return $records;
    }
57127
private function replaceRecords(Collection $records, string $search, string $replace): int
    {
        $count = 0;
        $query = preg_quote($search, '/');

        foreach ($records as $record) {
            $old_record = $record->gedcom();
            $new_record = preg_replace('/(\n\d [A-Z0-9_]+ )' . $query . '/i', '$1' . $replace, $old_record);

            if ($new_record !== $old_record) {
                $record->updateRecord($new_record, true);
                $count++;
            }
        }

        return $count;
    }
498902
protected function exportRecord(AbstractRecord $record, DataDimensions $dataDimensions)
    {
        $precalculate      = $this->precalculateExportRecord($record, $dataDimensions);
        $allowedProperties = array_intersect_key($record->getProperties(), $precalculate['allowedProperties']);
        $record            = clone $record;
        $record->setProperties($allowedProperties);

        return $record;
    }