Phalcon\Queue\Beanstalk\Extended::getWatchingResponse PHP Method

getWatchingResponse() protected method

Added on 10-Jan-2014 20:04 IST by Tapan Kumar Thapa @ [email protected]
protected getWatchingResponse ( string $cmd ) : string | null
$cmd string
return string | null
    protected function getWatchingResponse($cmd)
    {
        $result = null;
        $nbBytes = $this->write($cmd);
        if ($nbBytes && $nbBytes > 0) {
            $response = $this->read($nbBytes);
            $matches = [];
            if (!preg_match('#^WATCHING (\\d+).*?#', $response, $matches)) {
                throw new \RuntimeException(sprintf('Unhandled response: %s', $response));
            }
            $result = $response;
        }
        return $result;
    }