<commit_before><?php
/**
 * BaseModel.php
 *
 * @copyright Chongyi <<EMAIL>>
 * @link      https://insp.top
 */

namespace Dybasedev\Keeper\Database\SQL\Model;

abstract class BaseModel
{
    protected $attributes = [];

    protected $attributeSetters = [];

    protected $attributeGetters = [];

    protected $nativeAttributes = [];

    public function __get($name)
    {
        if (isset($this->attributeGetters[$name])) {
            return ($this->attributeGetters[$name])($this->attributes[$name]);
        }
        return $this->attributes[$name];
    }

    public function __set($name, $value)
    {
        if (isset($this->attributeSetters[$name])) {
            ($this->attributeSetters[$name])($value);
        } else {
            $this->attributes[$name] = $value;
        }
    }

    public function __isset($name)
    {
        return isset($this->attributes[$name]);
    }

    public function __unset($name)
    {
        unset($this->attributes[$name]);
    }

    public function getAttributes($native = true)
    {
        if ($native && $this->nativeAttributes) {
            $attributes = [];
            foreach ($this->nativeAttributes as $attribute) {
                $attributes[$attribute] = $this->{$attribute};
            }

            return $this->attributes + $attributes;
        }

        return $this->attributes;
    }
}<commit_msg>model primary key<commit_after><?php
/**
 * BaseModel.php
 *
 * @copyright Chongyi <<EMAIL>>
 * @link      https://insp.top
 */

namespace Dybasedev\Keeper\Database\SQL\Model;

abstract class BaseModel
{
    protected $attributes = [];

    protected $attributeSetters = [];

    protected $attributeGetters = [];

    protected $nativeAttributes = [];

    protected $primaryKey = 'id';

    public function __get($name)
    {
        if (isset($this->attributeGetters[$name])) {
            return ($this->attributeGetters[$name])($this->attributes[$name]);
        }
        return $this->attributes[$name];
    }

    public function __set($name, $value)
    {
        if (isset($this->attributeSetters[$name])) {
            ($this->attributeSetters[$name])($value);
        } else {
            $this->attributes[$name] = $value;
        }
    }

    public function __isset($name)
    {
        return isset($this->attributes[$name]);
    }

    public function __unset($name)
    {
        unset($this->attributes[$name]);
    }

    public function getAttributes($native = true)
    {
        if ($native && $this->nativeAttributes) {
            $attributes = [];
            foreach ($this->nativeAttributes as $attribute) {
                $attributes[$attribute] = $this->{$attribute};
            }

            return $this->attributes + $attributes;
        }

        return $this->attributes;
    }

    /**
     * @return string
     */
    public function getPrimaryKey(): string
    {
        return $this->primaryKey;
    }
}
{'fraction_non_alphanumeric': 0.1534518113465482, 'fraction_numerical': 0.0, 'mean_word_length': 2.2486126526082133, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 36, 'https://': 2, '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': '3612845', 'n_tokens_mistral': 821, 'n_tokens_neox': 801, 'n_words': 147}