<commit_before><?php

// vim:ts=4:sw=4:et:fdm=marker:fdl=0

namespace atk4\data;

/**
 * Class description?
 */
class Field_SQL extends Field implements \atk4\dsql\Expressionable
{
    /**
     * Actual field name
     *
     * @var string|null
     */
    public $actual = null;

    /**
     * Should this field use alias?
     *
     * @return boolean
     */
    public function useAlias()
    {
        return isset($this->actual);
    }

    /**
     * When field is used as expression, this method will be called.
     *
     * @param \atk\dsql\Expression $expression
     *
     * @return \atk\dsql\Expression
     */
    public function getDSQLExpression($expression)
    {
        if (isset($this->owner->persistence_data['use_table_prefixes'])) {
            return $expression->expr('{}.{}', [
                $this->join
                    ? (isset($this->join->foreign_alias)
                        ? $this->join->foreign_alias
                        : $this->join->short_name)
                    : (isset($this->owner->table_alias) ? $this->owner->table_alias : $this->owner->table),
                $this->actual ?: $this->short_name,
            ]);
        } else {
            // relations set flag use_table_prefixes, so no need to check them here
            return $expression->expr('{}', [
                $this->actual ?: $this->short_name,
            ]);
        }
    }
}<commit_msg>nicer<commit_after><?php

// vim:ts=4:sw=4:et:fdm=marker:fdl=0

namespace atk4\data;

/**
 * Class description?
 */
class Field_SQL extends Field implements \atk4\dsql\Expressionable
{
    /**
     * Actual field name
     *
     * @var string|null
     */
    public $actual = null;

    /**
     * Should this field use alias?
     *
     * @return boolean
     */
    public function useAlias()
    {
        return isset($this->actual);
    }

    /**
     * When field is used as expression, this method will be called.
     *
     * @param \atk\dsql\Expression $expression
     *
     * @return \atk\dsql\Expression
     */
    public function getDSQLExpression($expression)
    {
        if (isset($this->owner->persistence_data['use_table_prefixes'])) {
            return $expression->expr('{}.{}', [
                $this->join
                    ? (isset($this->join->foreign_alias)
                        ? $this->join->foreign_alias
                        : $this->join->short_name)
                    : (isset($this->owner->table_alias)
                        ? $this->owner->table_alias
                        : $this->owner->table),
                $this->actual ?: $this->short_name,
            ]);
        } else {
            // relations set flag use_table_prefixes, so no need to check them here
            return $expression->expr('{}', [
                $this->actual ?: $this->short_name,
            ]);
        }
    }
}
{'fraction_non_alphanumeric': 0.14225941422594143, 'fraction_numerical': 0.003486750348675035, 'mean_word_length': 1.6589434661723819, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '4356370', 'n_tokens_mistral': 850, 'n_tokens_neox': 830, 'n_words': 160}