code: protected function analyzeWithErrorCodeMsgQueryLevel(SendResult $response, $qErr, $qMsg, $qLvl, $lvlToText)
      {
          $analyzeResponse = new Result($response);
  
          $domXpath = $this->makeDomXpath($response->responseXml);
  
          $errorCodeNodeList = $domXpath->query($qErr);
  
          if ($errorCodeNodeList->length > 0) {
              $analyzeResponse->status = Result::STATUS_ERROR;
  
              $lvlNodeList = $domXpath->query($qLvl);
  
              $level = null;
              if ($lvlNodeList->length > 0) {
                  if (array_key_exists($lvlNodeList->item(0)->nodeValue, $lvlToText)) {
                      $level = $lvlToText[$lvlNodeList->item(0)->nodeValue];
                  }
              }
  
              $analyzeResponse->messages[] = new Result\NotOk(
                  $errorCodeNodeList->item(0)->nodeValue,
                  $this->makeMessageFromMessagesNodeList(
                      $domXpath->query($qMsg)
                  ),
                  $level
              );
          }
  
          return $analyzeResponse;
      }
docs: Analyze response by looking for error, message and level with the provided XPATH queries
  
  Result status defaults to Result::STATUS_ERROR if any error is found.
  
  xpath queries must be prefixed with the namespace self::XMLNS_PREFIX
  
  @param SendResult $response
  @param string $qErr XPATH query for fetching error code (first node is used)
  @param string $qMsg XPATH query for fetching error messages (all nodes are used)
  @param string $qLvl  XPATH query for fetching error level (first node is used)
  @param array $lvlToText Level-to-text translation
  @return Result