Build an embedded collection and returns it.

@param array $rows

@return Collection
336505
protected function buildEmbeddedCollection(array $rows): Collection
    {
        return collect($rows)->map(function ($attributes) {
            return $this->buildEmbeddedObject($attributes);
        });
    }
271877
public function loadCollectionValues(LoadingContext $context, array $rows) : array
    {
        $primaryKey = $this->primaryKeyColumn->getName();
        $ids        = [];

        foreach ($rows as $key => $row) {
            $ids[$key] = $row->getColumn($primaryKey);
        }

        return $ids;
    }
833014
private function extractValues(array $rows)
    {
        $result = array();

        foreach ($rows as $row) {
            foreach ($row as $column => $value) {
                array_push($result, $value);
            }
        }

        return $result;
    }
317888
public static function rowsToArray($rows, array $options = [])
    {
        $limit = array_get($options, 'limit', 0);
        $offset = array_get($options, 'offset', 0);

        $array = [];
        if ($offset > 0) {
            if ($limit > 0) {
                for ($i = 0; ($i < $limit && $rows->offsetExists($offset + $i)); $i++) {
                    $array[] = $rows->offsetGet($offset + $i);
                }
            } else {
                for ($i = 0; $rows->offsetExists($offset + $i); $i++) {
                    $array[] = $rows->offsetGet($offset + $i);
                }
            }
        } else {
            foreach ($rows as $row) {
                $array[] = $row;
            }
        }

        return $array;
    }
349471
public function extractUrlAliasListFromData(array $rows)
    {
        $urlAliases = array();
        foreach ($rows as $row) {
            $urlAliases[] = $this->extractUrlAliasFromData($row);
        }

        return $urlAliases;
    }
811553
protected function instantiateItem(array $row)
    {
        if ( ! count($this->intermediateFields)) {
            return parent::instantiateItem($row);
        }

        $itemAttributes         = Arr::only($row, $this->itemFields);
        $intermediateAttributes = Arr::only($row, $this->intermediateFields);
        /** @var \Colibri\Database\Model $item */
        $item = new static::$itemClass($itemAttributes);

        return $item->setIntermediate($intermediateAttributes);
    }
1297697
protected function buildRows(array $data)
    {
        $this->rows = collect($data)->map(function ($model, $number) {
            return new Row($number, $model);
        });

        if ($this->rowsCallback) {
            $this->rows->map($this->rowsCallback);
        }
    }
932260
public function updateRows(array $rows): array
    {
        if (null === $this->data) {
            $this->buildIndex();
        }

        $list = [];
        foreach ($rows as $key => $row) {
            $key = (string)$key;
            if ($this->hasKey($key)) {
                $this->data[$key] = $list[$key] = $row;
            }
        }

        if ($list) {
            $this->save();
        }

        return $list;
    }
532882
public function replaceRows(array $rows): array
    {
        $list = [];
        foreach ($rows as $key => $row) {
            $key = (string)$key;
            if (strpos($key, '@@')) {
                $key = $this->getNewKey();
            }
            $path = $this->getPathFromKey($key);
            $file = $this->getFile($path);
            $list[$key] = $this->saveFile($file, $row);
        }

        return $list;
    }
464539
public function formatData(array $rows)
    {
        $options = [];

        if (($rows) && count($rows) > 0) {
            foreach ($rows as $row) {
                $options[$row['id']] = $row['plan_name'];
            }
        }

        return $options;
    }
962714
public function parseResults($rows)
    {
        $results = array();

        //convert the resulting set into arrays
        foreach ($rows as $item) {
            //iterate over the included and related columns
            $arr = array();

            $this->parseOnTableColumns($item, $arr);

            //then grab the computed, unsortable columns
            $this->parseComputedColumns($item, $arr);

            $results[] = $arr;
        }

        return $results;
    }
665340
private function seed($rows)
	{
		// Set our constrained (pre-fetched data) back on the rows
		foreach ($this->data as $relationship => $data)
		{
			$rows = $this->$relationship()->seedWithData($rows, $data, $relationship);
		}

		return $rows;
	}
197378
protected function fillUpSnippets($rows)
    {
        if ($this->snippetCallback === null || empty($rows)) {
            return $rows;
        }
        $snippetSources = call_user_func($this->snippetCallback, $rows);
        $snippets = $this->callSnippets($snippetSources);
        $snippetKey = 0;
        foreach ($rows as $key => $row) {
            $rows[$key]['snippet'] = $snippets[$snippetKey];
            $snippetKey++;
        }

        return $rows;
    }
1146086
public function addRow(array $row)
    {
        if (is_array($this->fields)) {
            $assoc = $row;
            $row = [];
            foreach ($this->fields as $field) {
                $row[] = isset($assoc[$field]) ? $assoc[$field] : "";
            }
        }

        $this->data[] = $row;

        return $this;
    }
992157
protected function getColumns( $rows ) {

        $columns = array();

        foreach ( $rows as $row ) {

            foreach ( $row as $column => $value ) {

                $columns[ $column ] = true;

            }

        }

        return array_keys( $columns );

    }
1131771
public function replaceRows(array $rows): array
    {
        if (null === $this->data) {
            $this->buildIndex();
        }

        $list = [];
        foreach ($rows as $key => $row) {
            if (strpos($key, '@@')) {
                $key = $this->getNewKey();
            }
            $this->data[$key] = $list[$key] = $row;
        }

        if ($list) {
            $this->save();
        }

        return $list;
    }
643792
public function setRows(array $rows)
    {
        $this->downloader->setRows($rows);
        $this->outputter->setRows($rows);
        $this->writer->setRows($rows);

        return $this;
    }