public function setPid($pid) { if ($this->status != self::STATUS_NEW) { throw new \RuntimeException('Cannot set worker pid after worker has started working'); } $this->pid = (int) $pid; }