Create asc order instance
@param \PerrysLambda\ArrayList $list
@param callable|string|null $order
@return \PerrysLambda\Sortable
977832
public static function startOrder(ArrayList $list, $order)
    {
        $order = LambdaUtils::toSelectCallable($order);
        $temp = new static($list, $order, self::ORDER_ASC);
        $temp->thenBy($order);
        return $temp;
    }
828718
protected function getItemBagForOrder(Order $order)
    {
        $itemBag = $this->createItemBagForOrder($order);

        $event = new ItemBagEvent([
            'items' => $itemBag,
            'order' => $order
        ]);
        $this->trigger(self::EVENT_AFTER_CREATE_ITEM_BAG, $event);

        return $event->items;
    }
951994
public function setOrder(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Order $order = null)
    {
        $this->order = $order;

        return $this;
    }
927289
public function fromArray( array $list )
	{
		$unknown = array();
		$list = parent::fromArray( $list );

		foreach( $list as $key => $value )
		{
			switch( $key )
			{
				case 'order.base.address.baseid': $this->setBaseId( $value ); break;
				case 'order.base.address.addressid': $this->setAddressId( $value ); break;
				case 'order.base.address.type': $this->setType( $value ); break;
				default: $unknown[$key] = $value;
			}
		}

		return $unknown;
	}
201826
public function orderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), false);
    }
1360934
public function sort($field = null, $order = 'a') {
        if ($field === null) {
            $field = rqst('sort.name');
            $order = rqst('sort.dir', 'a');
        }
        if ($field) {
            if (is_string($field)) {
                $orders = explode(',', strtolower($order));
                $fields = explode(',', $field);
                foreach ($fields as $i => $field) {
                    $this->order [] = [$field, isset($orders[ $i ]) ? $orders[ $i ] : $orders[0]];
                }
            } else if (is_array($field)) {
                $this->sort($field[0], isset($field[1]) ? $field[1] : 'a');
            }
        }

        return $this;
    }
536286
public static function orderArray($array, $order)
    {
        $ordered = [];

        foreach ($order as $key) {
            if (array_key_exists($key, $array)) {
                $ordered[$key] = $array[$key];
            }
        }

        return $ordered;
    }
853997
public function orderBy($field, $order = 'asc'){
        $this->model = $this->model->orderBy(...func_get_args());
        return $this;
    }
682909
public function orderByASC(array $cols, $order_asc = true)
    {
        $this->order_asc = $order_asc;
        return $this->addOrderBy($cols);
    }
1001448
protected function sortList(array &$list, array $allowed, array $query, array $default = array())
    {
        if (empty($default)) {
            $default = array('sort' => '', 'order' => '');
        } else {
            $order = reset($default);
            $field = key($default);
            $default = array('sort' => $field, 'order' => $order);
        }

        $query += $default;

        if (in_array($query['sort'], $allowed)) {
            uasort($list, function ($a, $b) use ($query) {
                return $this->callbackSortList($a, $b, $query);
            });
        }
    }
739079
public function generateOrder($sortBy, $sortOrder, &$order)
    {
        if (! empty($sortBy)) {
            if (empty($sortOrder)) { // @codeCoverageIgnore
                $sortOrder = "ASC"; // @codeCoverageIgnore
            } // @codeCoverageIgnore

            $order = "$sortBy $sortOrder";
        }
    }
196997
public function sort($key, $order)
    {
        uasort($this->db, function ($a, $b) use ($key, $order) {
            if (is_object($a) && is_object($b)) {
                return $order == 'asc'
                    ? strnatcasecmp($a->$key, $b->$key)
                    : -strnatcasecmp($a->$key, $b->$key);
            } elseif (is_array($a) && is_array($b)) {
                return $order == 'asc'
                    ? strnatcasecmp($a[$key], $b[$key])
                    : -strnatcasecmp($a[$key], $b[$key]);
            }

            throw new InvalidArgumentException('Can only sort by keys or properties of non-scalar types');
        });
    }
980671
@NonNull
    @Override
    public OrderBy orderBy(@NonNull Ordering... orderings) {
        if (orderings == null) {
            throw new IllegalArgumentException("orderings is null.");
        }
        return new OrderBy(this, Arrays.asList(orderings));
    }
866858
public function setOrderBy($order)
	{
		if(is_null($order))
		{
			$this->getSelect()->setOrder(null);
			return $this;
		}

		if(!is_array($order))
		{
			$order = array($order);
		}

		$sort = array();
		foreach($order as $value)
		{
			$direction = 1;
			if (preg_match('/(.*\W)(ASC|DESC)\b/si', $value, $matches)) {
				$value = trim($matches[1]);
				switch($matches[2])
				{
					case "ASC":
						$direction = 1;
						break;
					case "DESC":
						$direction = -1;
						break;
				}
			}

			$sort[$value] = $direction;
		}

		$this->getSelect()->setOrder($sort);
		return $this;
	}
1236129
public static Sort by(final List<Order> orders) {

    Assert.notNull(orders, "Orders must not be null!");

    return orders.isEmpty() ? Sort.unsorted() : new Sort(orders);
  }
831246
public function prepareOrder($order = null, $sort = null)
    {
        if ($order == null or $sort == null) {
            $this->setOrderBy = '';

            return $this;
        }

        if (!in_array($sort, ['ASC', 'DESC'])) {
            $sort = 'DESC';
        }

        $this->setOrderBy = ' ORDER BY ' . $order . ' ' . $sort;

        return $this;
    }
649064
public static function sort(ArrayList &$list, Comparator $comparator)
    {
        $array = $list->toArray();
        usort($array, [$comparator, "compare"]);
        $list->replace($array);
        return $list;
    }