public function validateResponse($response)
    {
        if ($response === false) {
            throw new Exception(
                'Error reading data from the server.',
                Exception::SERVER_READ
            );
        }

        if ($response === 'BAD_FORMAT') {
            throw new Exception(
                'The client sent a command line that was not well-formed. ' .
                'This can happen if the line does not end with \r\n, if non-numeric ' .
                'characters occur where an integer is expected, if the wrong number of ' .
                'arguments are present, or if the command line is mal-formed in any other way.',
                Exception::BAD_FORMAT
            );
        }

        if ($response === 'OUT_OF_MEMORY') {
            throw new Exception(
                'The server cannot allocate enough memory for the job. The client should try again later.',
                Exception::OUT_OF_MEMORY
            );
        }

        if ($response === 'UNKNOWN_COMMAND') {
            throw new Exception(
                'The client sent a command that the server does not know.',
                Exception::UNKNOWN_COMMAND
            );
        }

        if ($response === 'INTERNAL_ERROR') {
            throw new Exception(
                'This indicates a bug in the server. It should never happen. ' .
                'If it does happen, please report it at http://groups.google.com/group/beanstalk-talk.',
                Exception::INTERNAL_ERROR
            );
        }

        return true;
    }
public function validateResponse($response)
    {
        if ($response === false) {
            throw new Exception(
                'Error reading data from the server.',
                Exception::SERVER_READ
            );
        }

        if ($response === 'BAD_FORMAT') {
            throw new Exception(
                'The client sent a command line that was not well-formed. ' .
                'This can happen if the line does not end with \r\n, if non-numeric ' .
                'characters occur where an integer is expected, if the wrong number of ' .
                'arguments are present, or if the command line is mal-formed in any other way.',
                Exception::BAD_FORMAT
            );
        }

        if ($response === 'OUT_OF_MEMORY') {
            throw new Exception(
                'The server cannot allocate enough memory for the job. The client should try again later.',
                Exception::OUT_OF_MEMORY
            );
        }

        if ($response === 'UNKNOWN_COMMAND') {
            throw new Exception(
                'The client sent a command that the server does not know.',
                Exception::UNKNOWN_COMMAND
            );
        }

        if ($response === 'INTERNAL_ERROR') {
            throw new Exception(
                'This indicates a bug in the server. It should never happen. ' .
                'If it does happen, please report it at http://groups.google.com/group/beanstalk-talk.',
                Exception::INTERNAL_ERROR
            );
        }

        return true;
    }
public function validateResponse ( $ response ) { if ( $ response === false ) { throw new Exception ( 'Error reading data from the server.' , Exception :: SERVER_READ ) ; } if ( $ response === 'BAD_FORMAT' ) { throw new Exception ( 'The client sent a command line that was not well-formed. ' . 'This can happen if the line does not end with \r\n, if non-numeric ' . 'characters occur where an integer is expected, if the wrong number of ' . 'arguments are present, or if the command line is mal-formed in any other way.' , Exception :: BAD_FORMAT ) ; } if ( $ response === 'OUT_OF_MEMORY' ) { throw new Exception ( 'The server cannot allocate enough memory for the job. The client should try again later.' , Exception :: OUT_OF_MEMORY ) ; } if ( $ response === 'UNKNOWN_COMMAND' ) { throw new Exception ( 'The client sent a command that the server does not know.' , Exception :: UNKNOWN_COMMAND ) ; } if ( $ response === 'INTERNAL_ERROR' ) { throw new Exception ( 'This indicates a bug in the server. It should never happen. ' . 'If it does happen, please report it at http://groups.google.com/group/beanstalk-talk.' , Exception :: INTERNAL_ERROR ) ; } return true ; }
Generic validation for all responses from beanstalkd

@param  string               $response
@return boolean              true when response is valid
@throws \Beanstalk\Exception When response is invalid
Generic validation for all responses from beanstalkd