Sort all items.

@return void
321506
protected function sort()
    {
        if (!$this->sorted) {
            uasort($this->items, [$this, 'compare']);
            $this->sorted = true;
        }
    }
131620
public function getOrderedItems()
    {
        if (config('menus.ordering') || $this->ordering) {
            return $this->toCollection()->sortBy(function ($item) {
                return $item->order;
            })->all();
        }

        return $this->items;
    }
168180
public function sort()
    {
        if ($this->modules) {
            $modules = [];
            $sorter = new StringSort();

            foreach ($this->modules as $slug => $module) {
                $sorter->add($slug, array_intersect(array_keys($module->getAttribute('require')), array_keys($this->modules)));
            }

            foreach ($sorter->sort() as $slug) {
                $modules[$slug] = $this->modules[$slug];
            }

            // Override modules array
            $this->modules = $modules;
        }

        return $this;
    }
160791
public function previous()
    {
        $this->_itemValid = true;

        if (!prev($this->_items)) {
            $this->_itemValid = false;
        } else {
            $this->_itemPosition--;
        }
    }
604723
public function first() {

		$this->sort();

		return !empty($this->items) ? reset($this->items) : NULL;

	}
483120
public function sort(): self
    {
        if (count($this->pairs) === count(array_count_values(array_column($this->pairs, 0)))) {
            return $this;
        }

        $pairs = array_merge(...array_values(array_reduce($this->pairs, [$this, 'reducePairs'], [])));
        if ($pairs === $this->pairs) {
            return $this;
        }

        $clone = clone $this;
        $clone->pairs = $pairs;

        return $clone;
    }
443316
public function sort()
    {
        $order = static::config()->uninherited('module_priority');
        $project = static::config()->get('project');

        /* @var PrioritySorter $sorter */
        $sorter = Injector::inst()->createWithArgs(
            PrioritySorter::class . '.modulesorter',
            [
                $this->modules,
                $order ?: []
            ]
        );

        if ($project) {
            $sorter->setVariable(self::PROJECT_KEY, $project);
        }

        $this->modules = $sorter->getSortedList();
    }
1139154
protected function sortColumns()
    {
        $this->config->getColumns()->sort(function (FieldConfig $a, FieldConfig $b) {
            return $a->getOrder() > $b->getOrder();
        });
    }
100078
public function handleSort(int $item_id = null, $prev_id = null, $next_id = null, $parent_id = null): void
	{
		if ($this->isAjax()) {
			$page = $this->orm->pages->getById($item_id);
			if (!$page->isHomePage) {
				$page->parent = $parent_id;
				$this->orm->persistAndFlush($page);

				$this->orm->pages->changeSort((int) $item_id, (int) $prev_id, (int) $next_id, $this->locale);
			}
		} else {
			$this->terminate();
		}
	}
1090198
public function index() {
        $this->paginate = array_merge(array(
            'limit' => 25,
            'order' => array('ItemReport.' . $this->Model->displayField => 'ASC'),
            'contain' => array_keys($this->Model->belongsTo),
            'conditions' => array('ItemReport.status' => ItemReport::PENDING)
        ), $this->Model->admin['paginate']);

        $this->AdminToolbar->setBelongsToData($this->Model);

        $this->request->data['ItemReport']['status'] = ItemReport::PENDING;

        // Filters
        if (!empty($this->request->params['named'])) {
            $this->paginate['conditions'] = $this->AdminToolbar->parseFilterConditions($this->Model, $this->request->params['named']);
        }

        $this->set('results', $this->paginate($this->Model));
    }
1011593
public function rewind()
    {
        $this->getIteratorObject()->last();

        if ($this->getIteratorObject()->valid()) {
            if (($countItems = $this->countItems()) > 0) {
                $this->_itemPosition = $countItems - 1;
            } else {
                $this->_itemPosition = 0;
            }
        }
    }
24145
public function clear()
    {
        foreach ($this->items as $item) {
            $this->deleted[] = $item;
        }

        $this->items = [];
    }
442728
public function sortReleases()
	{
		// If there is an unreleased release pull that out and sort the rest
		$unreleased = null;
		if (isset($this->releases['unreleased']))
		{
			$unreleased = $this->releases['unreleased'];
			unset($this->releases['unreleased']);
		}

		$order = Sort::sort(array_keys($this->releases));
		$order = array_reverse($order);

		$newOrder = [];
		/** @var Version $version */
		foreach ($order as $version)
		{
			$index = $version->__toString();
			$newOrder[$index] = $this->releases[$index];
		}

		if ($unreleased !== null)
		{
			$newOrder = ['unreleased' => $unreleased] + $newOrder;
		}

		$this->releases = $newOrder;
	}
790148
public function actionDeleteAll()
    {
        if(isset($_POST['items'])) {
            foreach($_POST['items'] as $id) {
                $this->findModel($id)->deleteWithChildren();
            }
        }
    }
1295608
public function listAll()
    {
        $headers = $this->headers;
        if ($this->canSort()) {
            uksort($headers, [$this, 'sortHeaders']);
        }

        return array_keys($headers);
    }
1015571
private function sort()
    {
        if (!$this->sorted) {
            $this->sorted = true;
            return usort($this->requestRates, function (array $requestRateA, array $requestRateB) {
                // PHP 7: Switch to the <=> "Spaceship" operator
                return $requestRateB['rate'] > $requestRateA['rate'];
            });
        }
        return $this->sorted;
    }
448471
public void sort() {

        Collections.sort(m_appConfigurations, new ConfigurationComparator<I_CmsWorkplaceAppConfiguration>());
        Collections.sort(m_children, new ConfigurationComparator<CmsAppCategoryNode>());
    }