Sets the sorting of the result list

@param string|null $key Sorting of the result list like "stock.type", null for no sorting
@return \Aimeos\Controller\Frontend\Stock\Iface Stock controller for fluent interface
@since 2019.04
354939
public function sort( $key = null )
	{
		$direction = '+';

		if( $key != null && $key[0] === '-' )
		{
			$key = substr( $key, 1 );
			$direction = '-';
		}

		switch( $key )
		{
			case null:
				$this->filter->setSortations( [] );
				break;
			case 'stock':
				$this->filter->setSortations( [
					$this->filter->sort( $direction, 'stock.type' ),
					$this->filter->sort( $direction, 'stock.stocklevel' )
				] );
				break;
			default:
				$this->filter->setSortations( [$this->filter->sort( $direction, $key )] );
		}

		return $this;
	}
272756
public function setting($key)
    {
        return isset($this->settings[$key]) ? $this->settings[$key] : null;
    }
420338
public function lpop($key)
    {
        $this->init();
        $result = $this->driver->lpop($key);
        return $this->convertFalseToNull($result);
    }
1141726
public function sort($key, $direction=CanSort::ASC)
    {
        $this->bootCanSortMethodsOnce();
        $this->sorting[$key] = $direction;
        return $this;
    }
56812
public function getValue($key = null)
    {
        if (is_null($key)) {//返回所有
            return $this->args;
        } elseif (isset($this->args[$key])) {
            return $this->args[$key];
        } else {
            return null;
        }
    }
211439
public function key($key = null)
    {
        if (!func_num_args()) {
            return $this->_key;
        }
        $this->_key = $key;
        return $this;
    }
164376
public function get_rating($key = 0)
	{
		$ratings = $this->get_ratings();
		if (isset($ratings[$key]))
		{
			return $ratings[$key];
		}

		return null;
	}
504043
public function indexBy($key): self
    {
        // init
        $results = [];

        foreach ($this->getGenerator() as $a) {
            if (\array_key_exists($key, $a) === true) {
                $results[$a[$key]] = $a;
            }
        }

        return static::create(
            $results,
            $this->iteratorClass,
            false
        );
    }
500917
public function setOrder(\HarvestCloud\CoreBundle\Entity\Order $order = null)
    {
        $this->order = $order;

        return $this;
    }
298589
public function delete($key = null)
    {
        if ($key === null) {
            $this->reset();

            return $this;
        }

        $arr = &$this->getStackByReference($key);

        if (is_array($arr) && array_key_exists($key, $arr)) {
            unset($arr[$key]);
        }

        return $this;
    }
36710
public function setData($data, $key = null)
	{
		if (is_array($data) && $key === null) {
			$this->data = $data;

			return $this;
		}

		if ($key === null)
			$key = 'data';

		$this->data[$key] = $data;

		return $this;
	}
12555
public static function getCoordinateMap($key=NULL)
    {
        if ($key) {
            return isset(self::$_keyCoordinateMap[$key]) ? self::$_keyCoordinateMap[$key] : NULL;
        } else {
            return self::$_keyCoordinateMap;
        }
    }
701679
public function setOrder()
    {
        // set order position if exist
        $order = [];
        foreach ($this->data['order'] as $alias => $params) {

            $order = array_flip($order);

            if (empty($params) === false) {

                foreach ($params as $field => $sort) {
                    $order[] = $alias . '.' . $field . ' ' . $sort;
                }
            }
        }

        $this->builder->orderBy($order);

        return null;
    }
303428
public function orderBy($key, $order='asc')
    {
        if ($this->isConfigKey($key) && $this->addedJoinsCounter != 0) {
            $this->query->orderBy('config.'.$this->configQueryKey($key), $order);
            return $this;
        }

        $this->query->orderBy($key, $order);
        return $this;
    }
731978
public function sort($order = 'asc')
    {
        if ($order == 'desc') {
            rsort($this->_map);
        }else{
            sort($this->_map);
        }

        return $this;
    }
780293
public function setOrder($order)
    {
        $pool = ['asc', 'desc'];

        // Silently ignore wrong values
        if (in_array($order, $pool)) {
            $this->container['order'] = $order;
        }

        return $this;
    }
1279920
public function lookup($key = null)
    {
        $hash = $this->mHash($key ? : time());
        //先进行倒序排序操作
        if (!$this->isSorted) {
            krsort($this->serverList, SORT_NUMERIC);
            $this->isSorted = true;
        }
        //圆环上顺时针方向查找当前KEY紧邻的一台服务器
        foreach ($this->serverList as $pos => $server) {
            if ($hash >= $pos) {
                return $server;
            }
        }
        //没有找到则返回顺时针方向最后一台服务器
        foreach ($this->serverList as $server) {
            return $server;
        }
        return false;
    }