original_string: protected function validate_response($response) {
  
          $response = $this->decode_response($response);
  
          if (empty($response)) {
              throw new checker_exception('err_response_empty');
          }
  
          if (empty($response['status']) or $response['status'] !== 'OK') {
              throw new checker_exception('err_response_status', $response['status']);
          }
  
          if (empty($response['apiver']) or $response['apiver'] !== '1.3') {
              throw new checker_exception('err_response_format_version', $response['apiver']);
          }
  
          if (empty($response['forbranch']) or $response['forbranch'] !== moodle_major_version(true)) {
              throw new checker_exception('err_response_target_version', $response['forbranch']);
          }
      }
code: protected function validate_response($response) {
  
          $response = $this->decode_response($response);
  
          if (empty($response)) {
              throw new checker_exception('err_response_empty');
          }
  
          if (empty($response['status']) or $response['status'] !== 'OK') {
              throw new checker_exception('err_response_status', $response['status']);
          }
  
          if (empty($response['apiver']) or $response['apiver'] !== '1.3') {
              throw new checker_exception('err_response_format_version', $response['apiver']);
          }
  
          if (empty($response['forbranch']) or $response['forbranch'] !== moodle_major_version(true)) {
              throw new checker_exception('err_response_target_version', $response['forbranch']);
          }
      }
code_tokens: protected function validate_response ( $ response ) { $ response = $ this -> decode_response ( $ response ) ; if ( empty ( $ response ) ) { throw new checker_exception ( 'err_response_empty' ) ; } if ( empty ( $ response [ 'status' ] ) or $ response [ 'status' ] !== 'OK' ) { throw new checker_exception ( 'err_response_status' , $ response [ 'status' ] ) ; } if ( empty ( $ response [ 'apiver' ] ) or $ response [ 'apiver' ] !== '1.3' ) { throw new checker_exception ( 'err_response_format_version' , $ response [ 'apiver' ] ) ; } if ( empty ( $ response [ 'forbranch' ] ) or $ response [ 'forbranch' ] !== moodle_major_version ( true ) ) { throw new checker_exception ( 'err_response_target_version' , $ response [ 'forbranch' ] ) ; } }
docstring: Makes sure the response is valid, has correct API format etc.
  
  @param string $response raw response as returned by the {@link self::get_response()}
  @throws checker_exception
docstring_tokens: Makes sure the response is valid has correct API format etc .