Extract the user records from a list of DB records.

@param stdClass[] $records The DB records
@return stdClass[] The list of extracted users
774494
public function execute(array $records) : array {
        $idalias = $this->idalias;
        $alias = $this->alias;

        return array_map(function($record) use ($idalias, $alias) {
            return user_picture::unalias($record, null, $idalias, $alias);
        }, $records);
    }
97143
public static function tably($records)
    {
        if (count($records) === 0) {
            return null;
        }
        
        $htmls = array();
        $htmls[] = '<table>';
        foreach ($records as $record) {
            $htmls[] = '<tr>';
            foreach ($record as $k => $v) {
                $htmls[] = sprintf('<td class="%s">%s</td>', Str::machine($k), $v);
            }
            $htmls[] = '</tr>';
        }
        $htmls[] = '</table>';
        return join("\n", $htmls);
    }
1186548
protected function extractID($record)
    {
        // Normalize to string:
        $id = (string)$record->header->identifier;

        // Strip prefix if found:
        if (substr($id, 0, strlen($this->idPrefix)) == $this->idPrefix) {
            $id = substr($id, strlen($this->idPrefix));
        }

        // Apply regular expression matching:
        if (!empty($this->idSearch)) {
            $id = preg_replace($this->idSearch, $this->idReplace, $id);
        }

        // Return final value:
        return $id;
    }
1160197
private function processDoctrineLogRecord(array $record)
    {
        if (!isset($record['context']) || empty($record['context'])) {
            return $record;
        }

        $isDatabaseQueryContext = $this->arrayContainsOnlyNumericKeys($record['context']);
        if ($isDatabaseQueryContext) {
            $record['context'] = array('query params' => $record['context']);
        }

        return $record;
    }
1198382
protected function processRecord(array $record): array
    {
        foreach ($this->processors as $processor) {
            $record = $processor($record);
        }

        return $record;
    }
14972
public static <P> List<P> extractPayloads(final List<? extends Record<P>> records) {
        List<P> payloads = new ArrayList<>();
        for (Record<P> record : records) {
            payloads.add(record.getPayload());
        }
        return payloads;
    }
743168
protected function processRecord(array $record): array
    {
        if ($this->processors) {
            foreach ($this->processors as $processor) {
                $record = PhpHelper::call($processor, $record);
            }
        }

        return $record;
    }
1051983
public static function filterRecords(array $records, $filter)
    {
        if (is_string($filter))
        {
            $filter = new PropertyFilter($filter);
        }

        $result = [ ];
        foreach ($records as $record)
        {
            if ($filter->match($record))
            {
                $result[$record->getId()] = $record;
            }
        }

        return $result;
    }
985283
public function getRecords($filters = array())
	{
		$entries = self::all();

		$c = $entries->getTableName();
		$e = '#__extensions';

		$entries
			->select($c . '.*,' . $e . '.name')
			->join($e, $e . '.element', $c . '.component', 'inner')
			->whereEquals($e . '.type', 'component');

		if (isset($filters['component']) && $filters['component'])
		{
			$entries->whereEquals($e . '.element', $filters['component']);
		}

		return $entries
			->ordered($c . '.component', 'asc')
			->rows();
	}
54536
private function formatLogBatchHeader(array $records)
    {
        $firstRecord = $records[0];

        if ($this->isAsseticLog($firstRecord)) {
            return $this->formatAsSubtitle('Assetic request');
        }

        $logDate = $firstRecord['datetime'];
        $logDateAsString = $logDate->format('d/M/Y H:i:s');

        return $this->formatAsTitle($logDateAsString);
    }
968273
protected static function cleanRecords(
        $records,
        $include = '*',
        $id_field = self::DEFAULT_ID_FIELD,
        $use_doc = false
    ){
        $out = [];

        foreach ($records as $record) {
            if ($use_doc) {
                $record = array_get($record, 'doc', $record);
            }

            $out[] = '*' == $include ? $record : static::cleanRecord($record, $include, static::DEFAULT_ID_FIELD);
        }

        return $out;
    }
424594
public static function extractKeys($array, $keys) {
		$result = [ ];
		foreach ( $keys as $key ) {
			if (isset ( $array [$key] )) {
				$result [$key] = $array [$key];
			}
		}
		return $result;
	}
167249
protected function getBestSplit(array $records) : DecisionTreeLeaf
    {
        $targets = array_intersect_key($this->targets, array_flip($records));
        $samples = array_intersect_key($this->samples, array_flip($records));
        $samples = array_combine($records, $this->preprocess($samples));
        $bestGiniVal = 1;
        $bestSplit = null;
        $features = $this->getSelectedFeatures();
        foreach ($features as $i) {
            $colValues = [];
            foreach ($samples as $index => $row) {
                $colValues[$index] = $row[$i];
            }
            $counts = array_count_values($colValues);
            arsort($counts);
            $baseValue = key($counts);
            $gini = $this->getGiniIndex($baseValue, $colValues, $targets);
            if ($bestSplit === null || $bestGiniVal > $gini) {
                $split = new DecisionTreeLeaf();
                $split->value = $baseValue;
                $split->giniIndex = $gini;
                $split->columnIndex = $i;
                $split->isContinuous = $this->columnTypes[$i] == self::CONTINUOUS;
                $split->records = $records;

                // If a numeric column is to be selected, then
                // the original numeric value and the selected operator
                // will also be saved into the leaf for future access
                if ($this->columnTypes[$i] == self::CONTINUOUS) {
                    $matches = [];
                    preg_match("/^([<>=]{1,2})\s*(.*)/", strval($split->value), $matches);
                    $split->operator = $matches[1];
                    $split->numericValue = floatval($matches[2]);
                }

                $bestSplit = $split;
                $bestGiniVal = $gini;
            }
        }

        return $bestSplit;
    }
291757
protected function extractPrimaryKeyValue($record, $returnAs)
    {
        $record = (object) $record;
        $values = [];
        foreach((array) $this->ORMParameters['primaryKey'] as $field) {
            $values[$field] = $record->$field;
        }
        switch($returnAs) {
            case 's':
                return implode('|', $values);
            break;
            case 'a':
                return $values;
            break;
        }   
    }
1068652
protected function map(array $record)
    {
        $mapping = $this->getMapping();

        if (count($mapping) > 0) {
            $result = [];

            foreach ($mapping as $columnId => $data) {
                if (!empty($data[0])) {
                    if (!isset($result[$data[0]])) {
                        $result[$data[0]] = [];
                    }
                    $result[$data[0]][$data[1]] = $record[$columnId];
                } else {
                    $result[$data[1]] = $record[$columnId];
                }
            }

            return $result;
        } else {
            return $record;
        }
    }
91662
protected function formatRecordsList(array $records)
    {

        $result = [];
        foreach ($records as $id => $attributes) {
             if (! is_array($attributes)) {
                list($id, $attributes) = [$attributes, []];
            }
            $result[$id] = $attributes;
        }
        return $result;
    }
609692
protected function transform_db_records_to_entities(array $records) {
        $preprocessors = $this->get_preprocessors();
        $result = array_map(function($record) {
            return ['record' => $record];
        }, $records);

        $result = array_reduce(array_keys($preprocessors), function($carry, $preprocessor) use ($records, $preprocessors) {
            $step = $preprocessors[$preprocessor];
            $dependencies = $step->execute($records);

            foreach ($dependencies as $index => $dependency) {
                // Add the new dependency to the list.
                $carry[$index] = array_merge($carry[$index], [$preprocessor => $dependency]);
            }

            return $carry;
        }, $result);

        return $this->from_db_records($result);
    }