Push order by clause onto parts

@return void
508643
protected function pushOrder()
    {
        if( $this->order ) {
            $this->parts[] = 'ORDER BY';
            $this->parts[] = $this->quoteIdentifierIfNotExpression($this->order);
            $this->parts[] = $this->direction == self::DESC ? self::DESC : self::ASC;
        }
    }
374679
private function setOrderBy()
    {
        if (isset($this->requestParams['order']) && count($this->requestParams['order'])) {
            $counter = count($this->requestParams['order']);

            for ($i = 0; $i < $counter; ++$i) {
                $columnIdx = (integer) $this->requestParams['order'][$i]['column'];
                $requestColumn = $this->requestParams['columns'][$columnIdx];

                if ('true' == $requestColumn['orderable']) {
                    $this->qb->addOrderBy(
                        $this->orderColumns[$columnIdx],
                        $this->requestParams['order'][$i]['dir']
                    );
                }
            }
        }

        return $this;
    }
920284
private function build_order_by( $order_by, $columns ) {
		$sql = '';
		if ( ! empty( $order_by ) ) {
			$items = [];
			foreach ( $order_by as $k => $order ) {
				if ( is_int( $k ) ) {
					$k     = $order;
					$order = 'ASC';
				} else {
					$order = trim( strtoupper( $order ) );
				}
				if ( $order !== 'DESC' && $order !== 'ASC' ) {
					continue;
				}
				$k       = $this->get_field_name( $k, $columns );
				$items[] = "$k $order";
			}
			if ( ! empty( $items ) ) {
				$sql .= ' ORDER BY ' . implode( ', ', $items );
			}
		}

		return $sql;
	}
107183
protected function setSortingOrder()
    {
        if (null !== $this->info->list->default_sort) {
            return $this;
        }

        if ($this->info->list->orderable && $this->info->list->getOrderableColumn()) {
            $this->info->list->default_sort = $this->info->list->getOrderableColumn();
        } elseif ($this->info->timestamps) {
            $this->info->list->default_sort = $this->info->timestamp_created;
        } elseif ($this->info->incrementing) {
            $this->info->list->default_sort = $this->model->getKeyName();
        }

        return $this;
    }
520502
protected function applyCustomSorting(): void
    {
        if ($this->get('orderSRC') != '') {
            $tmp = StringUtil::deserialize($this->get('orderSRC'));

            if (!empty($tmp) && is_array($tmp)) {
                // Remove all values
                $order = array_map(
                    function () {
                    },
                    array_flip($tmp)
                );

                // Move the matching elements to their position in $arrOrder
                foreach ($this->images as $k => $v) {
                    if (array_key_exists($v['uuid'], $order)) {
                        $order[$v['uuid']] = $v;
                        unset($this->images[$k]);
                    }
                }

                // Append the left-over images at the end
                if (!empty($this->images)) {
                    $order = array_merge($order, array_values($this->images));
                }

                // Remove empty (unreplaced) entries
                $this->images = array_values(array_filter($order));
                unset($order);
            }
        }
    }
903651
function order($order)
    {
        if (!empty($order))
        {
            self::sql_safe($order);
            $this->order = "order by $order";
        }
        else
        {
            $this->order = '';
        }
    }
1232622
protected function pushGroup()
    {
        if( $this->group ) {
            $this->parts[] = 'GROUP BY';
            $this->parts[] = $this->quoteIdentifierIfNotExpression($this->group);
        }
    }
1355396
protected function pushIgnoreDelayed()
    {
        if( $this->delayed ) {
            $this->parts[] = 'DELAYED';
        }
        if( $this->ignore && !$this->replace ) {
            $this->parts[] = 'IGNORE';
        }
    }
579112
protected function pushWhere()
    {
        if( empty($this->where) ) {
            return;
        }

        $this->parts[] = 'WHERE';
        foreach( $this->where as $w ) {
            $where = $w[0];
            $value = isset($w[1]) ? $w[1] : null;
            $type = isset($w[2]) ? $w[2] : null;
            if( $where instanceof Expression ) {
                $this->parts[] = (string) $where;
            } else if( count($w) == 3 ) {
                $this->parts[] = $this->quoteIdentifierIfNotExpression($where);
                $this->parts[] = $type;
                $tmp = '';
                foreach( $value as $val ) {
                    $tmp .= '?, ';
                    $this->params[] = $val;
                }
                $this->parts[] = '(' . substr($tmp, 0, -2) . ')';
            } else if( false !== strpos($where, '?') ) {
                $this->parts[] = $where; //$this->quoteIdentifierIfNotExpression($where);
                $this->params[] = $value;
            } else {
                $this->parts[] = $this->quoteIdentifierIfNotExpression($where);
                $this->parts[] = '=';
                if( $value instanceof Expression ) {
                    $this->parts[] = (string) $value;
                } else {
                    $this->parts[] = '?';
                    $this->params[] = $value;
                }
            }
            $this->parts[] = '&&';
        }
        array_pop($this->parts);
    }
678593
protected function pushLimit()
    {
        if( null !== $this->limit ) {
            if( null !== $this->offset ) {
                $this->parts[] = 'LIMIT ?, ?';
                $this->params[] = $this->offset;
                $this->params[] = $this->limit;
            } else {
                $this->parts[] = 'LIMIT ?';
                $this->params[] = $this->limit;
            }
        }
    }
207787
public function addOrderBy($sort, $order = null)
    {
        if (false !== strpos($sort, '.')) {
            return parent::addOrderBy($sort, $order);
        }

        if (true === in_array($sort, self::$joinCriteria)) {
            $sort = $this->getSectionAlias().'.'.$sort;
        } elseif (0 !== strpos($this->getAlias().'.', $sort)) {
            $sort = $this->getAlias().'.'.$sort;
        }

        return parent::addOrderBy($sort, $order);
    }
804829
protected function addOrderCheckout()
    {
        $submitted = $this->getSubmittedOrderCheckout();
        $result = $this->order_action->add($submitted, array('admin' => $this->admin));
        $this->finishOrderCheckout($result);
    }
1282679
public function addOrderBy(array $orderBy): void
    {
        if (empty($orderBy)) {
            return;
        }
        $orderByList = [];
        foreach ($orderBy as $clause) {
            $clause['key'] = $this->quoteName($clause['key']);
            array_push($orderByList, $clause['key'] . ' ' . $clause['direction']);
        }
        $pattern = ' ORDER BY %s';
        $this->statement .= sprintf($pattern, implode(', ', $orderByList));
        $this->statement .= PHP_EOL;
    }
1284740
private function appendOrderByList(\Aztech\Skwal\Visitor\Printer\Assembler\Select $assembler,\Aztech\Skwal\Query\Select $query)
    {
        $this->expressionVisitor->useAliases(false);
        
        $orderByList = array();
        
        foreach ($query->getSortingColumns() as $sortingColumn) {
            $direction = $this->getSortDirectionText($sortingColumn);
            $orderByList[] = $this->expressionVisitor->printExpression($sortingColumn->getExpression()) . $direction;
        }
        
        $assembler->setOrderByList($orderByList);
    }
84696
protected function pushTable()
    {
        if( empty($this->table) ) {
            throw new LogicException('No table specified');
        }
        $this->parts[] = $this->quoteIdentifierIfNotExpression($this->table);
    }
1374700
protected function assemble()
    {
        $this->push($this->replace ? 'REPLACE' : 'INSERT');
        $this->pushIgnoreDelayed();
        $this->push('INTO');
        $this->pushTable();
        $this->push('SET');
        $this->pushValues();
        $this->pushOnDuplicateKeyUpdate();
    }
783677
public function sqlOrders()
    {
        if (!$this->hasOrders()) {
            return '';
        }

        $parts = [];
        foreach ($this->orders() as $order) {
            if (!$order instanceof DatabaseOrder) {
                $order = $this->createOrder($order->data());
            }

            $sql = $order->sql();
            if (strlen($sql) > 0) {
                $parts[] = $sql;
            }
        }

        if (empty($parts)) {
            return '';
        }

        return ' ORDER BY '.implode(', ', $parts);
    }