Internally builds the ChromeLogger-compatible data-structure from internal log-entries.

@param array[][] $entries

@return array
501030
protected function createData(array $entries): array
    {
        $rows = [];

        foreach ($entries as $entry) {
            $rows[] = $this->createEntryData($entry);
        }

        return [
            'version' => self::VERSION,
            'columns' => [self::COLUMN_LOG, self::COLUMN_TYPE, self::COLUMN_BACKTRACE],
            'rows' => $rows,
        ];
    }
1333821
private function rebuildHeader(array $headers)
    {
        $header = [];

        foreach ($headers as $entry) {
            $header[$entry['name']][] = $entry['value'];
        }

        return $header;
    }
109031
private function orderedEntry(array $entry, array $headerKeys)
    {
        $result = [];

        foreach ($headerKeys as $key) {
            $result[$key] = $entry[$key];
        }

        return $result;
    }
521589
public function addEntry(LdifEntryInterface ...$entries)
    {
        foreach ($entries as $entry) {
            $this->entries[] = $entry;
        }

        return $this;
    }
156575
public static function logEntry($entry)
  {
    $parts = explode("|", $entry, 5);
    $array = array();

    if(count($parts) != 5)
    {
      $array["timestamp"] = 0;
      $array["level"]     = TeamSpeak3::LOGLEVEL_ERROR;
      $array["channel"]   = "ParamParser";
      $array["server_id"] = "";
      $array["msg"]       = Str::factory("convert error (" . trim($entry) . ")");
      $array["msg_plain"] = $entry;
      $array["malformed"] = TRUE;
    }
    else
    {
      $array["timestamp"] = strtotime(trim($parts[0]));
      $array["level"]     = self::logLevel(trim($parts[1]));
      $array["channel"]   = trim($parts[2]);
      $array["server_id"] = trim($parts[3]);
      $array["msg"]       = Str::factory(trim($parts[4]));
      $array["msg_plain"] = $entry;
      $array["malformed"] = FALSE;
    }

    return $array;
  }
1176120
protected static function getAtomEntries(\SimpleXMLElement $entries)
    {
        $items = [];

        foreach ($entries as $entry) {
            $item = [
                'url' => null,
                'originUrl' => null,
                'pubdate' => null,
            ];

            if ($entry->created) {
                $item['pubdate'] = (string) $entry->created;
            } elseif ($entry->updated) {
                $item['pubdate'] = (string) $entry->updated;
            } elseif ($entry->modified) {
                $item['pubdate'] = (string) $entry->modified;
            }

            foreach ($entry->link as $link) {
                $attributes = $link->attributes();

                if (!empty($attributes->href) && ((string) $attributes->rel === 'alternate')) {
                    $item['url'] = (string) $attributes->href;
                    break;
                }
            }

            foreach ($entry->link as $link) {
                $attributes = $link->attributes();

                if (!empty($attributes->href) && ((string) $attributes->rel === 'comments')) {
                    $item['originUrl'] = (string) $attributes->href;
                    break;
                }
            }

            if (!$item['url'] && isset($link)) {
                $attributes = $link->attributes();

                if (!empty($attributes->href)) {
                    $item['url'] = (string) $attributes->href;
                }
            }

            if ($item['url']) {
                $items[] = $item;
            }
        }

        return $items;
    }
73788
public function setEntries($entries)
    {
        foreach ($entries as $key => $dtoData) {
            $this->entries[$key] = new LeagueItemDto($dtoData);
        }
    
        return $this;
    }
381452
private function iteratorFromResults(array $results)
    {
        $values = [];

        foreach ($results as $item) {
            $entry = new IndexEntry();

            $entry->indexKey  = key($item);
            $entry->objectKey = reset($item);

            $values[] = $entry;
        }

        return new ArrayIterator($values);
    }
820996
protected function from_db_records(array $results) {
        $entityfactory = $this->get_entity_factory();

        return array_map(function(array $result) use ($entityfactory) {
            ['record' => $record] = $result;
            return $entityfactory->get_post_from_stdclass($record);
        }, $results);
    }
1155784
protected function getLogs(): array
	{
		if ($this->logs === null) {
			$this->logs = $this->readLogs();
		}
		return $this->logs;
	}
988096
protected static function createEntries(Container $container, array $entries)
    {
        $defaultShared = $container->isSharedByDefault();

        foreach ($entries as $entry) {
            foreach (self::$requiredEntryKeys as $key) {
                if (!isset($entry[$key])) {
                    $message = sprintf('Missing required entry key "%s" in "%s".', $key, __METHOD__);
                    throw new Exception\InvalidArgumentException($message);
                }
            }

            if (!in_array($entry[ContainerInterface::CONFIG_ENTRY_TYPE], self::$entryTypes)) {
                throw new Exception\InvalidArgumentException(sprintf(
                    'Value "%s" for "%s" is not valid; it must be one of "%s" in "%s".',
                    $entry[ContainerInterface::CONFIG_ENTRY_TYPE],
                    $key,
                    implode(', ', self::$types),
                    __METHOD__
                ));
            }

            $shared = isset($entry[ContainerInterface::CONFIG_ENTRY_SHARED]) ? (bool) $entry[ContainerInterface::CONFIG_ENTRY_SHARED] : $defaultShared;

            $container->add($entry[ContainerInterface::CONFIG_ENTRY_NAME], $entry[ContainerInterface::CONFIG_ENTRY_VALUE], $entry[ContainerInterface::CONFIG_ENTRY_TYPE], $shared);
        }
    }
1276968
public function entries()
    {
        $entries = array();

        if (false === $this->_entry_cache) {
            // cache is empty: fetch from LDAP
            while ($entry = $this->shiftEntry()) {
                $entries[] = $entry;
            }
            $this->_entry_cache = $entries; // store result in cache
        }

        return $this->_entry_cache;
    }
502186
protected function buildRequirements(array $matches)
    {
        $result = [];
        foreach ($matches as $match) {
            list($key, $regexp) = $this->splitSegment($match[3]);
            $result[$key] = $regexp . ($match[1] == '(' ? '*' : '+');
        }

        return $result;
    }
540946
protected function createEntryData(array $entry): array
    {
        // NOTE: "log" level type is deliberately omitted from the following map, since
        //       it's the default entry-type in ChromeLogger, and can be omitted.

        static $LEVELS = [
            LogLevel::DEBUG => self::LOG,
            LogLevel::INFO => self::INFO,
            LogLevel::NOTICE => self::INFO,
            LogLevel::WARNING => self::WARN,
            LogLevel::ERROR => self::ERROR,
            LogLevel::CRITICAL => self::ERROR,
            LogLevel::ALERT => self::ERROR,
            LogLevel::EMERGENCY => self::ERROR,
        ];

        $row = [];

        [$level, $message, $context] = $entry;

        $data = [
            \str_replace('%', '%%', Dumper::interpolate($message, $context)),
        ];

        if (\count($context)) {
            $context = $this->sanitize($context);

            $data = \array_merge($data, $context);
        }

        $row[] = $data;

        $row[] = $LEVELS[$level] ?? self::LOG;

        if (isset($context['exception'])) {
            // NOTE: per PSR-3, this reserved key could be anything, but if it is an Exception, we
            //       can use that Exception to obtain a stack-trace for output in ChromeLogger.
            $exception = $context['exception'];

            if ($exception instanceof \Throwable) {
                $row[] = $exception->__toString();
            }
        }

        // Optimization: ChromeLogger defaults to "log" if no entry-type is specified.
        if ($row[1] === self::LOG) {
            if (\count($row) === 2) {
                unset($row[1]);
            } else {
                $row[1] = '';
            }
        }

        return $row;
    }
588070
protected function from_db_records(array $results) : array {
        $entityfactory = $this->get_entity_factory();

        return array_map(function(array $result) use ($entityfactory) {
            [
                'forum' => $forumrecord,
                'course_module' => $coursemodule,
                'course' => $course,
                'context' => $context,
            ] = $result;
            return $entityfactory->get_forum_from_stdclass($forumrecord, $context, $coursemodule, $course);
        }, $results);
    }
887088
protected function assignIdsFromUri($entries) {
        foreach ($entries as &$entry) {
            $entry['id'] = (int) preg_replace('#.*?(\d+)$#', '$1', $entry['uri']);
        }

        return $entries;
    }
700908
public function build($columns = [])
    {
        $headers = [];
        $data = [];
        $dataFormats = [];
        $aggregations = [];
        $aggregationsFormats = [];
        $metaData = [];

        foreach ($this->indexes as $index) {
            $columnsNames = array_keys($this->columns);

            $line = [];
            foreach ($columnsNames as $columnName) {
                $columnValues = $this->columns[$columnName]->getValues();

                $line = array_merge($line, [$columnName => $columnValues[$index]]);
            }

            $data[$index] = $this->orderColumns($line, $columns);
        }

        foreach ($this->columns as $columnName => $column) {
            $dataFormats[$columnName] = $column->getFormat();

            $headers = array_merge($headers, [$columnName => $column->getHeaderName()]);
            $metaData = array_merge($metaData, [$columnName => $column->getMetaData()]);

            $columnAggregation = $column->getAggregation();
            if ($columnAggregation) {
                $aggregationValue = $columnAggregation->aggregate($this);
                $aggregationsFormats[$columnName] = $columnAggregation->getFormat();
            } else {
                $aggregationValue = null;
            }
            $aggregations = array_merge($aggregations, [$columnName => $aggregationValue]);
        }

        $headers = $this->orderColumns($headers, $columns);
        $metaData = $this->orderColumns($metaData, $columns);
        $aggregations = $this->orderColumns($aggregations, $columns);

        return new StatsTable($data, $headers, $aggregations, $dataFormats, $aggregationsFormats, $metaData);
    }