<commit_before><?php namespace Zephyrus\Database\QueryBuilder;

class OrderByClause
{
    private string $orderBySql;

    public function __construct()
    {
        $this->orderBySql = "";
    }

    public function getSql(): string
    {
        return ((empty($this->orderBySql)) ?: 'ORDER BY ') . $this->orderBySql;
    }

    public function asc(string $column, bool $nullLast = true): self
    {
        $this->addOrderClause("$column ASC" . ($nullLast ? '' : " NULLS FIRST"));
        return $this;
    }

    public function desc(string $column, bool $nullFirst = true): self
    {
        $this->addOrderClause("$column DESC" . ($nullFirst ? '' : " NULLS LAST"));
        return $this;
    }

    private function addOrderClause(string $clause)
    {
        if (!empty($this->orderBySql)) {
            $this->orderBySql .= ', ';
        }
        $this->orderBySql .= $clause;
    }
}<commit_msg>fix: empty sort<commit_after><?php namespace Zephyrus\Database\QueryBuilder;

class OrderByClause
{
    private string $orderBySql;

    public function __construct()
    {
        $this->orderBySql = "";
    }

    public function getSql(): string
    {
        return ((empty($this->orderBySql)) ? '' : 'ORDER BY ') . $this->orderBySql;
    }

    public function asc(string $column, bool $nullLast = true): self
    {
        $this->addOrderClause("$column ASC" . ($nullLast ? '' : " NULLS FIRST"));
        return $this;
    }

    public function desc(string $column, bool $nullFirst = true): self
    {
        $this->addOrderClause("$column DESC" . ($nullFirst ? '' : " NULLS LAST"));
        return $this;
    }

    private function addOrderClause(string $clause)
    {
        if (!empty($this->orderBySql)) {
            $this->orderBySql .= ', ';
        }
        $this->orderBySql .= $clause;
    }
}
{'fraction_non_alphanumeric': 0.15203073545554335, 'fraction_numerical': 0.0, 'mean_word_length': 2.433145009416196, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6340726', 'n_tokens_mistral': 569, 'n_tokens_neox': 559, 'n_words': 122}