public function pop(?string $worker = null, ?int $numJobs = null)
    {
        $workerName = $worker ?: $this->client->getWorkerName();
        $jids = json_decode($this->client->pop($this->name, $workerName, $numJobs ?: 1), true);

        $jobs = [];
        array_map(function (array $data) use (&$jobs) {
            $job = new BaseJob($this->client, $data);
            $job->setEventsManager($this->getEventsManager());

            $jobs[] = $job;
        }, $jids ?: []);

        return $numJobs === null ? array_shift($jobs) : $jobs;
    }