Sets the user sort direction from the session state
@param string $sortDirection
@return void
349683
protected function setSortDirection($sortDirection)
    {
        if (!in_array($sortDirection, [
            MediaLibrary::SORT_DIRECTION_ASC,
            MediaLibrary::SORT_DIRECTION_DESC
        ])) {
            throw new ApplicationException('Invalid input data');
        }

        $this->putSession('media_sort_direction', $sortDirection);
    }
282808
private function appendSort($sort)
    {
        $column = $sort;
        $direction = 'asc';

        if ($sort[0] == '-') {
            $column = substr($sort, 1);
            $direction = 'desc';
        }

        $this->sort[] = [
            'column'    => $column,
            'direction' => $direction,
        ];
    }
518784
public void setSortMode(final SortMode sortMode) {
		getOrCreateComponentModel().sortMode = sortMode == null ? SortMode.NONE : sortMode;
	}
1331613
protected function _sortString(&$sorted)
    {
        if (empty($this->_collator)) {
            asort($sorted, SORT_LOCALE_STRING);
        } else {
            $this->_collator->asort($sorted, Collator::SORT_STRING);
        }
    }
440698
protected function SetActivePageSort()
    {
        $this->sActivePageSort = $this->GetUserInput('pagesort');
        if (empty($this->sActivePageSort)) {
            //load default
            $this->sActivePageSort = $this->GetPageSortDefaultValue(); //default
            $this->SetModuleSessionParameter('pagesort', $this->sActivePageSort);
        } else {
            $bFound = false;
            foreach ($this->aPageSort as $iPsKey => $aPsVal) {
                if (in_array($this->sActivePageSort, $aPsVal)) {
                    $bFound = true;
                }
            }
            if (!$bFound) {
                //try to load from session
                $this->sActivePageSort = strtolower(trim($this->GetModuleSessionParameter('pagesort', false)));
                if (!$this->sActivePageSort) {
                    $this->sActivePageSort = $this->aPageSort[1]['id'];
                } //default
                $this->SetModuleSessionParameter('pagesort', $this->sActivePageSort);
            }
        }
    }
905334
public function sort(array $sorting)
    {
        foreach ($sorting as $key => $value) {
            $column = isset($this->sortMapping[$key])
                ? $this->sortMapping[$key]
                : current($this->qb->getRootAliases()) . '.' . $key;

            $this->qb->addOrderBy($column, $value);
        }
    }
932890
public function listAction($page = 1, $pageSize = 10, $sort = 'id', $sortDirection = "ASC")
    {
        return parent::listAction($page, $pageSize, $sort, $sortDirection);
    }
794978
protected function get_sort_direction(?int $sortmethod) : string {
        switch ($sortmethod) {
            case self::SORTORDER_LASTPOST_ASC:
            case self::SORTORDER_CREATED_ASC:
            case self::SORTORDER_REPLIES_ASC:
                return "ASC";
            case self::SORTORDER_LASTPOST_DESC:
            case self::SORTORDER_CREATED_DESC:
            case self::SORTORDER_REPLIES_DESC:
                return "DESC";
            default:
                return "DESC";
        }
    }
479031
protected function _setSortingParameters()
    {
        $sSortingParameters = $this->getViewParameter('sorting');
        if ($sSortingParameters) {
            list($sSortBy, $sSortDir) = explode('|', $sSortingParameters);
            $this->setItemSorting($this->getSortIdent(), $sSortBy, $sSortDir);
        }
    }
1227769
protected function setSort()
    {
        $this->sort = Input::get($this->sortName, []);
        if (!is_array($this->sort)) {
            return;
        }

        if (empty($this->sort['column']) || empty($this->sort['type'])) {
            return;
        }

        if (str_contains($this->sort['column'], '.')) {
            $this->setRelationSort($this->sort['column']);
        } else {
            $this->resetOrderBy();

            $this->queries->push([
                'method' => 'orderBy',
                'arguments' => [$this->sort['column'], $this->sort['type']],
            ]);
        }
    }
1332417
public function setSorting($sortingName, $direction = 'asc')
    {
        $value = $sortingName . ' ' . $direction;
        $path = $this->prefixWithNamespace('sort');
        $this->argumentsAccessor->set($path, $value);
        $this->stateChanged = true;
        return $this;
    }
1231874
public function sortOrder2(int $sortOrder, bool $descendingFlag = false): void
  {
    $this->sortDirection2 = ($descendingFlag) ? 'desc' : 'asc';
    $this->sortOrder2     = $sortOrder;
  }
450874
private function setSort($sort)
    {
        $this->sort = [];
        $orders = array_filter(explode(',', $sort));
        array_map([$this, 'appendSort'], $orders);
    }
728002
public function removeSort($sort)
    {
        if ($this->sorts->contains($sort)) {
            $this->sorts->removeElement($sort);
        }

        return $this;
    }
1083343
public function sort($direction)
    {
        if (strtolower($direction) === self::DIRECTION_DESC) {
            $this->scanIndexForward = false;
        } else {
            $this->scanIndexForward = true;
        }
    }
576827
public function sort(array &$methods, $sort = self::BY_COMPLEXITY)
    {
        if (!in_array($sort, self::SORTS, true)) {
            $sort = self::BY_COMPLEXITY;
        }

        usort(
            $methods,
            $sort === self::BY_COMPLEXITY
                ? $this->byComplexity()
                : $this->byName()
        );
    }
1225601
public static function setFetchSortingDirection($direction)
    {
        $direction = strtoupper($direction);

        if ($direction == 'RANDOM') {
            $direction = 'RAND';
        }

        self::$_fetchSortDirection = (in_array($direction, array('RAND', 'ASC', 'DESC')) ? $direction : null);
    }