<commit_before><?php
namespace Hook\Model;

use Hook\Database\AppContext;

/**
 * AppKey
 */
class AppKey extends Model
{
    protected $guarded = array('key');

    const TYPE_CLI = 'cli';
    const TYPE_BROWSER = 'browser';
    const TYPE_SERVER = 'server';
    const TYPE_DEVICE = 'device';

    public static function boot()
    {
        parent::boot();
        static::saving(function ($instance) { $instance->beforeSave(); });
    }

    public function app() {
        return $this->belongsTo('Hook\Model\App');
    }

    public function isBrowser()
    {
        return $this->type == self::TYPE_BROWSER;
    }

    public function isServer()
    {
        return $this->type == self::TYPE_SERVER;
    }

    public function isDevice()
    {
        return $this->type == self::TYPE_DEVICE;
    }

    public function isCommandline()
    {
        return $this->type == self::TYPE_CLI;
    }

    public function beforeSave()
    {
        // creating the key
        if (!$this->key) {
            $this->key = md5(uniqid(rand(), true));
        }
    }

    public function __callStatic($method, $arguments) {
        return call_user_func_array(array(AppContext::getKey(), $name), $arguments);
    }

}<commit_msg>fix static AppKey calls<commit_after><?php
namespace Hook\Model;

use Hook\Database\AppContext;

/**
 * AppKey
 */
class AppKey extends Model
{
    protected $guarded = array('key');

    const TYPE_CLI = 'cli';
    const TYPE_BROWSER = 'browser';
    const TYPE_SERVER = 'server';
    const TYPE_DEVICE = 'device';

    public static function boot()
    {
        parent::boot();
        static::saving(function ($instance) { $instance->beforeSave(); });
    }

    public function app() {
        return $this->belongsTo('Hook\Model\App');
    }

    public function isBrowser()
    {
        return $this->type == self::TYPE_BROWSER;
    }

    public function isServer()
    {
        return $this->type == self::TYPE_SERVER;
    }

    public function isDevice()
    {
        return $this->type == self::TYPE_DEVICE;
    }

    public function isCommandline()
    {
        return $this->type == self::TYPE_CLI;
    }

    public function beforeSave()
    {
        // creating the key
        if (!$this->key) {
            $this->key = md5(uniqid(rand(), true));
        }
    }

    public static function __callStatic($method, $arguments) {
        return call_user_func_array(array(AppContext::getKey(), $name), $arguments);
    }

}
{'fraction_non_alphanumeric': 0.14083367057871307, 'fraction_numerical': 0.0008093889113719142, 'mean_word_length': 2.4573426573426573, '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': '3786680', 'n_tokens_mistral': 758, 'n_tokens_neox': 738, 'n_words': 166}