<commit_before><commit_msg>Create Gearman.php<commit_after><?php

class Gearman extends CApplicationComponent
{
    public $servers;
    protected $client;
    protected $worker;

    public function init()
    {
        parent::init();
    }

    protected function setServers($instance)
    {
        foreach ($this->servers as $s) {
            $instance->addServer($s['host'], $s['port']);
        }

        return $instance;
    }

    public function client()
    {
        if (!$this->client) {
            $this->client = $this->setServers(new GearmanClient());
        }

        return $this->client;
    }

    public function worker()
    {
        if (!$this->worker) {
            $this->worker = $this->setServers(new GearmanWorker());
        }
        
        $this->worker->addOptions(GEARMAN_WORKER_GRAB_UNIQ);

        return $this->worker;
    }

}
{'fraction_non_alphanumeric': 0.14006888633754305, 'fraction_numerical': 0.0, 'mean_word_length': 2.1032028469750887, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 15, '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': '1005341', 'n_tokens_mistral': 264, 'n_tokens_neox': 256, 'n_words': 48}