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

getResponseLines() protected method

Returns the result of command that wait the list in response from beanstalkd.
protected getResponseLines ( string $cmd ) : array | null
$cmd string
return array | null
    protected function getResponseLines($cmd)
    {
        $result = null;
        $this->write(trim($cmd));
        $response = $this->read();
        $matches = [];
        if (!preg_match('#^(OK (\\d+))#mi', $response, $matches)) {
            throw new \RuntimeException(sprintf('Unhandled response: %s', $response));
        }
        $result = preg_split("#[\r\n]+#", rtrim($this->read($matches[2])));
        // discard header line
        if (isset($result[0]) && $result[0] == '---') {
            array_shift($result);
        }
        return $result;
    }