<commit_before><?php

namespace EXSyst\Component\Worker;

use Traversable;
use EXSyst\Component\Worker\Bootstrap\WorkerBootstrapProfile;
use EXSyst\Component\Worker\Internal\KillSwitch;
use EXSyst\Component\Worker\Internal\Lock;

class WorkerFactory
{
    private $bootstrapProfile;

    public function __construct(WorkerBootstrapProfile $bootstrapProfile = null)
    {
        $this->bootstrapProfile = isset($bootstrapProfile) ? $bootstrapProfile : new WorkerBootstrapProfile();
    }

    public function getBootstrapProfile()
    {
        return $this->bootstrapProfile;
    }

    public function createWorker($implementationClassName)
    {
        return Worker::withClass($this->bootstrapProfile, $implementationClassName);
    }

    public function createWorkerWithExpression($implementationExpression)
    {
        return Worker::withExpression($this->bootstrapProfile, $implementationExpression);
    }

    public function createWorkerPool($implementationClassName, $workerCount)
    {
        return WorkerPool::withClass($this->bootstrapProfile, $implementationClassName, $workerCount);
    }

    public function createWorkerPoolWithExpression($implementationExpression, $workerCount)
    {
        return WorkerPool::withExpression($this->bootstrapProfile, $implementationExpression, $workerCount);
    }

    public function connectToSharedWorker($socketAddress, $implementationClassName = null, $autoStart = true)
    {
        return SharedWorker::withClass($socketAddress, $this->bootstrapProfile, $implementationClassName, $autoStart);
    }

    public function connectToSharedWorkerWithExpression($socketAddress, $implementationExpression = null, $autoStart = true)
    {
        return SharedWorker::withExpression($socketAddress, $this->bootstrapProfile, $implementationExpression, $autoStart);
    }

    public function startSharedWorker($socketAddress, $implementationClassName)
    {
        SharedWorker::startWithClass($socketAddress, $this->bootstrapProfile, $implementationClassName);
    }

    public function startSharedWorkerWithExpression($socketAddress, $implementationExpression)
    {
        SharedWorker::startWithExpression($socketAddress, $this->bootstrapProfile, $implementationExpression);
    }
<commit_msg>Changed two methods to fluent interface<commit_after><?php

namespace EXSyst\Component\Worker;

use Traversable;
use EXSyst\Component\Worker\Bootstrap\WorkerBootstrapProfile;
use EXSyst\Component\Worker\Internal\KillSwitch;
use EXSyst\Component\Worker\Internal\Lock;

class WorkerFactory
{
    private $bootstrapProfile;

    public function __construct(WorkerBootstrapProfile $bootstrapProfile = null)
    {
        $this->bootstrapProfile = isset($bootstrapProfile) ? $bootstrapProfile : new WorkerBootstrapProfile();
    }

    public function getBootstrapProfile()
    {
        return $this->bootstrapProfile;
    }

    public function createWorker($implementationClassName)
    {
        return Worker::withClass($this->bootstrapProfile, $implementationClassName);
    }

    public function createWorkerWithExpression($implementationExpression)
    {
        return Worker::withExpression($this->bootstrapProfile, $implementationExpression);
    }

    public function createWorkerPool($implementationClassName, $workerCount)
    {
        return WorkerPool::withClass($this->bootstrapProfile, $implementationClassName, $workerCount);
    }

    public function createWorkerPoolWithExpression($implementationExpression, $workerCount)
    {
        return WorkerPool::withExpression($this->bootstrapProfile, $implementationExpression, $workerCount);
    }

    public function connectToSharedWorker($socketAddress, $implementationClassName = null, $autoStart = true)
    {
        return SharedWorker::withClass($socketAddress, $this->bootstrapProfile, $implementationClassName, $autoStart);
    }

    public function connectToSharedWorkerWithExpression($socketAddress, $implementationExpression = null, $autoStart = true)
    {
        return SharedWorker::withExpression($socketAddress, $this->bootstrapProfile, $implementationExpression, $autoStart);
    }

    public function startSharedWorker($socketAddress, $implementationClassName)
    {
        SharedWorker::startWithClass($socketAddress, $this->bootstrapProfile, $implementationClassName);

        return $this;
    }

    public function startSharedWorkerWithExpression($socketAddress, $implementationExpression)
    {
        SharedWorker::startWithExpression($socketAddress, $this->bootstrapProfile, $implementationExpression);

        return $this;
    }

{'fraction_non_alphanumeric': 0.09237472766884532, 'fraction_numerical': 0.0, 'mean_word_length': 5.04078947368421, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '5785235', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1070, 'n_words': 201}