protected function build($withParentheses)
    {
        $builtConditions = [];
        foreach ($this->conditions as $condition) {
            if ($condition instanceof \Parable\ORM\Query\ConditionSet) {
                $builtConditions[] = $condition->buildWithParentheses();
            } else {
                $builtConditions[] = $condition->build();
            }
        }

        $glue = ' ' . static::TYPE . ' ';

        $string = implode($glue, $builtConditions);
        if ($withParentheses) {
            $string = "({$string})";
        }

        return $string;
    }