Aggregate tabbed forms from each handler to fragments ready to be rendered.

@skipUpgrade
@param array $results
@return array
173454
protected function aggregateTabbedForms(array $results)
    {
        $forms = [];
        foreach ($results as $authName => $singleResult) {
            // The result *must* be an array with a Form key
            if (!is_array($singleResult) || !isset($singleResult['Form'])) {
                user_error('Authenticator "' . $authName . '" doesn\'t support tabbed forms', E_USER_WARNING);
                continue;
            }

            $forms[] = $singleResult['Form'];
        }

        if (!$forms) {
            throw new \LogicException('No authenticators found compatible with tabbed forms');
        }

        return [
            'Forms' => ArrayList::create($forms),
            'Form' => $this->generateTabbedFormSet($forms)
        ];
    }
237139
private function mapArrayStringToArrayInt($results)
    {
        $ret = [];

        foreach ($results as $value) {
            array_push($ret, intval($value));
        }

        return $ret;
    }
1139947
public function groupVersions($results)
    {
        $property = $this->versionAssociation()->getProperty();

        return $results->map(function (EntityInterface $row) use ($property) {
            $versionField = $this->_config['versionField'];
            $versions = (array)$row->get($property);
            $grouped = new Collection($versions);

            $result = [];
            foreach ($grouped->combine('field', 'content', 'version_id') as $versionId => $keys) {
                $entityClass = $this->_table->getEntityClass();
                $versionData = [
                    $versionField => $versionId
                ];

                $keys = $this->_convertFieldsToType($keys, 'toPHP');

                /* @var \Cake\Datasource\EntityInterface $versionRow */
                $versionRow = $grouped->match(['version_id' => $versionId])->first();

                foreach ($this->_config['additionalVersionFields'] as $mappedField => $field) {
                    if (!is_string($mappedField)) {
                        $mappedField = 'version_' . $field;
                    }
                    $versionData[$mappedField] = $versionRow->get($field);
                }

                $version = new $entityClass($keys + $versionData, [
                    'markNew' => false,
                    'useSetters' => false,
                    'markClean' => true
                ]);
                $result[$versionId] = $version;
            }

            $options = ['setter' => false, 'guard' => false];
            $row->set('_versions', $result, $options);
            unset($row[$property]);
            $row->clean();

            return $row;
        });
    }
1092656
public function prune(array $results)
    {
        $mean = array_sum($results) / count($results);
        $deviation = $this->deviations * $this->standardDeviation($results);
        $lower = $mean - $deviation;
        $upper = $mean + $deviation;

        return array_values(array_filter($results, function ($val) use ($lower, $upper) {
                return $val >= $lower && $val <= $upper;
            }));
    }
1364771
protected function handleResult(array $result)
    {
        if ($this->onlyCount && isset($result[0]) && is_array($result[0])) {
            return (int)current($result[0]);
        }

        $entities = [];
        foreach ($result as $row) {
            $model = clone $this->getModel();
            $model->populate($row);
            $entities[] = $model;
        }
        return $entities;
    }
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;
    }
443505
public function createSearchResults(array $results)
    {
        $created = array();
        foreach ($results as $key => $result) {
            $created[$key] = $this->createResult('Packagist\Api\Result\Result', $result);
        }

        return $created;
    }
712230
protected function generateTabbedFormSet($forms)
    {
        if (count($forms) === 1) {
            return $forms;
        }

        $viewData = new ArrayData([
            'Forms' => new ArrayList($forms),
        ]);

        return $viewData->renderWith(
            $this->getTemplatesFor('MultiAuthenticatorTabbedForms')
        );
    }
315332
public function prepend($items)
    {
        return new ResultScan(array_merge($this->parseItems($items), $this->buffered()->toArray()));
    }
1018423
protected function checkStrategiesResults($results)
    {
        $results = array_filter($results, function ($value) {
            return $value !== false && (!is_string($value) || mb_strpos($value, 'not found') === false);
        });

        return count($results) === count($this->strategies);
    }
600278
protected function getResultTable($results)
    {
        $resultSet = 1;
        $resultTable     = \MUtil_Html::create()->array();
        foreach ($results as $result) {
            if (is_string($result)) {
                $this->addMessage($result);
            } else {
                $resultRow = $resultTable->echo($result, sprintf($this->_('Result set %s.'), $resultSet++));
                $resultRow->class = 'browser';
            }
        }
        return $resultTable;
    }
111564
protected function buildDictionary(array $results)
    {
        // First we will build a dictionary of child models keyed by the foreign key
        // of the relation so that we will easily and quickly match them to their
        // parents without having a possibly slow inner loops for every models.
        $dictionary = [];

        foreach ($results as $result) {
            $dictionary[$result->pivot->{$this->foreignKey}][] = $result;
        }

        return $dictionary;
    }
741865
protected function buildDictionary(Collection $results)
    {
        // First we will build a dictionary of child models keyed by the foreign key
        // of the relation so that we will easily and quickly match them to their
        // parents without having a possibly slow inner loops for every models.
        $dictionary = [];

        foreach ($results as $result) {
            $dictionary[$result->{$this->accessor}->{$this->foreignPivotKey}][] = $result;
        }

        return $dictionary;
    }
363015
private static function SortByNavIndex(array &$result)
    {
        $sorted = array();
        foreach ($result as $bundle=>$modules)
        {
            ksort($modules);
            $sorted[$bundle] = $modules;
        }
        return $sorted;
    }
804243
public function result_collections($result)
    {
        // Combine $collection and $expanded headers
        $collections = isset($result['$collection'])
            ? array($result['$collection'])
            : array();

        if (isset($result['$expanded'])) {
            foreach ($result['$expanded'] as $expanded_collection) {
                $collections[] = $expanded_collection;
            }
        }

        return $collections;
    }
568904
public function hydrate(PDOStatement $results) {

    if (method_exists($this, 'preHydrate')) {
      $results = $this->preHydrate($results);
    }

    $return = array();

    if ($results) {
      $arrayResults = $results->fetchAll();
      foreach ($arrayResults as $arrayResult) {
        $className = get_class($this);
        $object = new $className();
        $return[$arrayResult[$this->id_name]] = $object->setRecord($arrayResult);
      }
    }

    if (method_exists($this, 'postHydrate')) {
      $return = $this->preHydrate($return);
    }

    return $return;
  }
618661
protected function column($results)
    {
        $array = array();
        if ($results instanceof mysqli_result) {
            while ($row = $results->fetch_array()) {
                $array[] = $row[0];
            }
        } else {
            foreach ($results as $row) {
                $array[] = $row[0];
            }
        }
        return $array;
    }