src/Worker.php
public function stop($wait = false)
    {
    	if ($this->simulation) {
			$this->state = self::TERMINATED;
			return true;
		}

        if (!is_dir('/proc/'.$this->pid))
            return null;

        $this->state = self::TERMINATING;

        if (!posix_kill($this->pid, SIGTERM))
            return false;

        if ($wait) {
            pcntl_waitpid($this->pid, $status);
            $this->state = self::TERMINATED;
        } else {
            if (!is_dir('/proc/'.$this->pid))
                $this->state = self::TERMINATED;
        }
        return true;
    }
public function stop($wait = false)
    {
    	if ($this->simulation) {
			$this->state = self::TERMINATED;
			return true;
		}

        if (!is_dir('/proc/'.$this->pid))
            return null;

        $this->state = self::TERMINATING;

        if (!posix_kill($this->pid, SIGTERM))
            return false;

        if ($wait) {
            pcntl_waitpid($this->pid, $status);
            $this->state = self::TERMINATED;
        } else {
            if (!is_dir('/proc/'.$this->pid))
                $this->state = self::TERMINATED;
        }
        return true;
    }
Stops a worker and ends the process
@param boolean $wait If true, this method will hold execution till the process end
@return boolean Null, if worker is not active. False, if signal can't be sent to worker.
True, if signal sent OR signal sent and worker terminated (if $wait = true).