_jobId = $peekSubject; } elseif (in_array($peekSubject, $this->_subcommands)) { $this->_subcommand = $peekSubject; } else { throw new Exception\CommandException(sprintf( 'Invalid peek subject: %s', $peekSubject )); } } /* (non-phpdoc) * @see Command::getCommandLine() */ public function getCommandLine() { return isset($this->_jobId) ? sprintf('peek %u', $this->_jobId) : sprintf('peek-%s', $this->_subcommand); } /* (non-phpdoc) * @see ResponseParser::parseResponse() */ public function parseResponse($responseLine, $responseData) { if ($responseLine == Response::RESPONSE_NOT_FOUND) { if (isset($this->_jobId)) { $message = sprintf( '%s: Job %u does not exist.', $responseLine, $this->_jobId ); } else { $message = sprintf( "%s: There are no jobs in the '%s' status", $responseLine, $this->_subcommand ); } throw new Exception\ServerException($message); } elseif (preg_match('#^FOUND (\d+) \d+$#', $responseLine, $matches)) { return $this->_createResponse( Response::RESPONSE_FOUND, array( 'id' => (int) $matches[1], 'jobdata' => $responseData, ) ); } } }