@param array  $result
@param string $className

@return array
177940
public static function formatListByType(array $result, string $className): array
    {
        if (empty($result)) {
            return [];
        }

        $rowList = [];
        foreach ($result as $row) {
            $rowList[] = self::formatRowByType($row, $className);
        }

        return $rowList;
    }
716329
public function getProperty($classname, $property)
    {
        return $this->hasProperty($classname, $property)
            ? $this->properties[$classname . '$' . $property]
            : [];
    }
572055
public static function formatRowByType(array $row, string $className): array
    {
        $rowAry   = [];
        $entities = EntityCollector::getCollector();
        if (!isset($entities[$className])) {
            return $row;
        }

        if (strpos($className, '\\') === false) {
            $className = $entities[$className];
        }
        foreach ($row as $name => $value) {
            $field = $entities[$className]['column'][$name];
            $type  = $entities[$className]['field'][$field]['type'];

            $rowAry[$name] = self::trasferTypes($type, $value);
        }

        return $rowAry;
    }
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);
    }
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);
    }
717287
public function extract($objectClass, $result)
    {
        $hydrator = $this->objectManager->getHydratorFor($objectClass);

        return $hydrator->extract($result);
    }
988931
protected function recursive_get_all_children($classname, array &$result) {
        foreach ($this->children as $child) {
            if (is_a($child, $classname)) {
                $result[] = $child;
            }
            if ($child instanceof tree) {
                $child->recursive_get_all_children($classname, $result);
            }
        }
    }
721191
private static function convertResult($result)
    {
        if (!is_array($result)) {
            return self::convert($result);
        }

        $results = [];

        foreach ($result as $item) {
            $results[] = self::convert($item);
        }

        return $results;
    }
1089388
protected function prepareAccessTokenResponse(array $result)
    {
        $jwt = (new Parser())->parse($result['access_token']);
        $result['resource_owner_id'] = $jwt->getClaim('sub');
        $result['role'] = $jwt->getClaim('role');

        return $result;
    }
595239
public static function keyPair(array $result): array
    {
        $firstRow = current($result);
        if (empty($firstRow)) {
            return $result;
        }

        list($keyName, $valueName) = array_keys($firstRow);

        return array_combine(
            array_column($result, $keyName),
            array_column($result, $valueName)
        );
    }
738752
private function processHitResultsRecurse($results, $prefix=null) {
        if(!is_array($results)) {
            return [$prefix => $results];
        }

        $ret = [];
        foreach($results as $key=>$result) {
            // Flatten arrays.
            $sub_prefix = is_null($prefix) ? $key:"$prefix.$key";
            $ret = array_merge($ret, $this->processHitResultsRecurse($result, $sub_prefix));
        }
        return $ret;
    }
767632
static function fromResult(PDOStatement $result, $class_name = null, $use_pool = null) {
		if (null === $class_name) {
			$class_name = get_called_class();
		}
		if (null === $use_pool) {
			$use_pool = static::$_poolEnabled;
		}

		$objects = array();
		if (is_array($class_name)) {
			$class_names = $class_name;
			unset($class_name);
			while ($values = $result->fetch(PDO::FETCH_NUM)) {
				unset($main_object);
				$startcol = 0;
				foreach ($class_names as $key => $class_name) {
					$object = new $class_name;
					if (!$object->fromNumericResultArray($values, $startcol)) {
						continue;
					}

					if (
						$use_pool
						&& ($pk = $object->getPrimaryKey())
						&& ($pool_object = $object->retrieveFromPool($object->{'get' . $pk}()))
					) {
						$object = $pool_object;
					}

					if ($use_pool) {
						$object->insertIntoPool($object);
					}

					if (!isset($main_object)) {
						$main_object = $objects[] = $object;
					} else {
						if (method_exists($main_object, 'set' . $class_name)) {
							$main_object->{'set' . $class_name}($object);
						} else {
							$main_object->{$class_name} = $object;
						}
					}
				}
			}
		} else {
			// PDO::FETCH_PROPS_LATE is required to call the ctor after hydrating the fields
			$flags = PDO::FETCH_CLASS;
			if (defined('PDO::FETCH_PROPS_LATE')) {
				$flags |= PDO::FETCH_PROPS_LATE;
			}
			$result->setFetchMode($flags, $class_name);
			while (false !== ($object = $result->fetch())) {
				if (
					$use_pool
					&& (!empty($pk) || ($pk = $object->getPrimaryKey()))
					&& ($pool_object = $object->retrieveFromPool($object->{'get' . $pk}()))
				) {
					$object = $pool_object;
				} else {
					$object->castInts();
					$object->setNew(false);
				}

				$objects[] = $object;

				if ($use_pool) {
					$object->insertIntoPool($object);
				}
			}
		}
		return $objects;
	}
590530
protected function processResult($result)
    {
        $output = Helper::objectToArray($result);

        if (! is_array($output)) {
            throw new Error\Api($output);
        }

        if (isset($output['result'])) {
            return $output;
        }

        if (
            isset($output['request']) &&
            $output['request']['result'] != 1 &&
            $output['request']['result'] !== 'TRUE') {
            throw new Error\Api($output['request']['errorId'] . ' - ' . $output['request']['errorMessage']);
        }

        return $output;
    }
1130460
public function setResult($name = null, $result = null)
    {
        if (null === $result) {
            $result = $name;
            array_push($this->results, $result);

            return $this;
        }

        $this->results[(string) $name] = $result;

        return $this;
    }
946483
protected function childrenByInstance($class_name) {
    $matches = [];
    $child = $this->head;
    while ($child) {
      if ($child instanceof $class_name) {
        $matches[] = $child;
      }
      $child = $child->next;
    }
    return $matches;
  }
172631
public static function ExpectRetrievedValueIsArray(
        string $property,
        $value,
        string $class_name
    ) : array {
        /**
        * @psalm-var T
        */
        $value = static::MaybeThrowIfNotType($property, $value, $class_name, 'array');

        return $value;
    }
1168225
public static function convertResultToArrayList(\mysqli_result $result)
    {
        $list = array();
        
        while (($row = $result->fetch_assoc()) != null)
        {
            $list[] = $row;
        }
        
        return $list;
    }