Reverses the update lists for the core and all plugins.
@param array  $result
@return array
500833
protected function processUpdateLists($result)
    {
        if ($core = array_get($result, 'core')) {
            $result['core']['updates'] = array_reverse(array_get($core, 'updates', []), true);
        }

        foreach (array_get($result, 'plugins', []) as $code => $plugin) {
            $result['plugins'][$code]['updates'] = array_reverse(array_get($plugin, 'updates', []), true);
        }

        return $result;
    }
912287
public function reverseTransform($value)
    {
        $result = array();
        if (is_array($value)) {
            array_walk_recursive($value, function($item, $key) use (&$result) {
                if ($item) {
                    $result[] = $key;
                }
            });
        }

        return $result;
    }
1216086
private function mapGeoposResults($results)
    {
        $ret = [];

        foreach ($results as $coords) {
            $point = [];

            foreach ($coords as $latlon) {
                array_push($point, floatval($latlon));
            }

            array_push($ret, $point);
        }

        return $ret;
    }
147765
public function processColumnListing($results)
	{
		return array_map(function ($result) {
			return is_object($result) ? $result->column_name : $result['column_name'];
		}, $results);
	}
171687
private function processResult(array $result)
    {
        $this->checkResponseStatus($result['http_code']);

        // Get decoded response data
        $responseArr = json_decode($result['response'], true);

        $this->checkJsonError();

        return $responseArr;
    }
1166224
protected function prepareResults(array &$results, array $options)
    {
        $reindexed = array();

        foreach ($results as &$result) {
            $this->prepareResult($result, $options);
            if (!empty($options['index'])) {
                $reindexed[$result[$options['index']]] = $result;
            }
        }

        if (!empty($options['index'])) {
            $results = $reindexed;
        }
    }
617480
public static function extractResultErrorsInfo(array $result): array
    {
        assert(
            count($result) === 2 &&
            $result[static::REPLY_SUCCESS_VALUE] === null &&
            is_array($result[static::REPLY_ERRORS_INFO]) === true &&
            empty($result[static::REPLY_ERRORS_INFO]) === false
        );

        $value = $result[static::REPLY_ERRORS_INFO];

        return $value;
    }
176052
public function buildResult($result)
    {
        $chatMembers = [];

        foreach ($result as $item) {
            $chatMembers[] = new ChatMember($item);
        }

        return $chatMembers;
    }
1168225
public static function convertResultToArrayList(\mysqli_result $result)
    {
        $list = array();
        
        while (($row = $result->fetch_assoc()) != null)
        {
            $list[] = $row;
        }
        
        return $list;
    }
1286720
protected function restoreVerbatimBlocks($result)
    {
        $result = preg_replace_callback(
            '/' . preg_quote($this->verbatimPlaceholder) . '/',
            function () {
                return array_shift($this->verbatimBlocks);
            },
            $result
        );

        $this->verbatimBlocks = [];

        return $result;
    }
406380
protected function restoreRawContent($result)
    {
        $result = preg_replace_callback('/'.$this->getRawPlaceholder('(\d+)').'/', function ($matches) {
            return $this->rawBlocks[$matches[1]];
        }, $result);

        $this->rawBlocks = [];

        return $result;
    }
1277204
private function buildPlans($result)
    {
        $plans = [];
        foreach ($result['plans'] as $plan) {
            $plans[] = $this->planBuilder
                ->create()
                ->withCanceledAt($plan['cancelled_at'] !== null ? new \DateTime($plan['cancelled_at']) : null)
                ->withConsiderMember($plan['consider_member'])
                ->withCount($plan['count'])
                ->withCreatedAt(new \DateTime($plan['created_at']))
                ->withDescription($plan['description'])
                ->withEndDate($plan['end_date'] !== null ? new \DateTime($plan['end_date']) : null)
                ->withId($plan['id'])
                ->withLocationId($plan['location_id'])
                ->withName($plan['name'])
                ->withPersonIds($plan['person_ids'])
                ->withPlanProductId($plan['plan_product_id'])
                ->withPriceCents($plan['price_cents'])
                ->withStaffMemberId($plan['staff_member_id'])
                ->withStartDate(new \DateTime($plan['start_date']))
                ->withType($plan['type'])
                ->withUpdateAt($plan['updated_at'] !== null ? new \DateTime($plan['updated_at']) : null)
                ->build();
        }

        return $plans;
    }
518390
public function processColumnListing($results)
	{
		$mapping = function ($r) {
			$r = (object) $r;

			return $r->name;
		};

		return array_map($mapping, $results);
	}
204708
protected function collectionFromResult($result)
    {
        // If we have one result which is not an assoc array, make it the first element of an array for the
        // collectionFromResult function so we always return a collection from filter
        if ((bool) count(array_filter(array_keys($result), 'is_string'))) {
            $result = [$result];
        }

        $class = $this->class;
        $collection = [];

        foreach ($result as $r) {
            $collection[] = new $class($this->connection, $r);
        }

        return $collection;
    }
998227
protected function processImportantUpdates($result)
    {
        $hasImportantUpdates = false;

        /*
         * Core
         */
        if (isset($result['core'])) {
            $coreImportant = false;

            foreach (array_get($result, 'core.updates', []) as $build => $description) {
                if (strpos($description, '!!!') === false) continue;

                $detailsUrl = '//octobercms.com/support/articles/release-notes';
                $description = str_replace('!!!', '', $description);
                $result['core']['updates'][$build] = [$description, $detailsUrl];
                $coreImportant = $hasImportantUpdates = true;
            }

            $result['core']['isImportant'] = $coreImportant ? '1' : '0';
        }

        /*
         * Plugins
         */
        foreach (array_get($result, 'plugins', []) as $code => $plugin) {
            $isImportant = false;

            foreach (array_get($plugin, 'updates', []) as $version => $description) {
                if (strpos($description, '!!!') === false) continue;

                $isImportant = $hasImportantUpdates = true;
                $detailsUrl = Backend::url('system/updates/details/'.PluginVersion::makeSlug($code).'/upgrades').'?fetch=1';
                $description = str_replace('!!!', '', $description);
                $result['plugins'][$code]['updates'][$version] = [$description, $detailsUrl];
            }

            $result['plugins'][$code]['isImportant'] = $isImportant ? '1' : '0';
        }

        $result['hasImportantUpdates'] = $hasImportantUpdates;

        return $result;
    }
363015
private static function SortByNavIndex(array &$result)
    {
        $sorted = array();
        foreach ($result as $bundle=>$modules)
        {
            ksort($modules);
            $sorted[$bundle] = $modules;
        }
        return $sorted;
    }
175167
public function finish($results)
    {
        $table = $results['__table'];
        unset($results['__table']);

        return \DB::table($table)->insert($results);
    }