public function formatOrderBy(array $orderBy) {
        if ($orderBy) {
            $output = [];

            foreach ($orderBy as $field => $direction) {
                if ($direction instanceof Func) {
                    $output[] = $this->formatFunction($direction);
                } else {
                    $output[] = $this->quote($field) . ' ' . $this->getKeyword($direction);
                }
            }

            return sprintf($this->getClause(self::ORDER_BY), implode(', ', $output));
        }

        return '';
    }