Code Duplication    Length = 26-30 lines in 2 locations

src/Amadeus/Client/ResponseHandler/Base.php 2 locations

@@ 106-131 (lines=26) @@
103
        return $ccResult;
104
    }
105
106
    protected function analyzeAirMultiAvailabilityResponse($response)
107
    {
108
        $analyzeResponse = new Result($response);
109
110
        $message = null;
111
112
        $domXpath = $this->makeDomXpath($response->responseXml);
113
114
        $codeNode = $domXpath->query("//m:errorOrWarningSection/m:errorOrWarningInfo//m:code")->item(0);
115
        if ($codeNode instanceof \DOMNode) {
116
            $analyzeResponse->status = Result::STATUS_ERROR;
117
118
            $categoryNode = $domXpath->query("//m:errorOrWarningSection/m:errorOrWarningInfo//m:type")->item(0);
119
            if ($categoryNode instanceof \DOMNode) {
120
                $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNode->nodeValue);
121
            }
122
123
            $messageNodes = $domXpath->query('//m:errorOrWarningSection/m:textInformation/m:freeText');
124
            if ($messageNodes->length > 0) {
125
                $message = $this->makeMessageFromMessagesNodeList($messageNodes);
126
            }
127
            $analyzeResponse->messages [] = new Result\NotOk($codeNode->nodeValue, $message);
128
        }
129
130
        return $analyzeResponse;
131
    }
132
133
    protected function analyzeAirSellFromRecommendationResponse($response)
134
    {
@@ 422-451 (lines=30) @@
419
     * @return Result
420
     * @throws Exception
421
     */
422
    protected function analyzeFarePricePNRWithBookingClassResponse($response)
423
    {
424
        $analyzeResponse = new Result($response);
425
426
        $domXpath = $this->makeDomXpath($response->responseXml);
427
428
        $queryErrorCode = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCode";
429
        $queryErrorCategory = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCategory";
430
        $queryErrorMsg = "//m:applicationError/m:errorWarningDescription/m:freeText";
431
432
        $errorCodeNodeList = $domXpath->query($queryErrorCode);
433
434
        if ($errorCodeNodeList->length > 0) {
435
            $analyzeResponse->status = Result::STATUS_ERROR;
436
437
            $errorCatNode = $domXpath->query($queryErrorCategory)->item(0);
438
            if ($errorCatNode instanceof \DOMNode) {
439
                $analyzeResponse->status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue);
440
            }
441
442
            $analyzeResponse->messages[] = new Result\NotOk(
443
                $errorCodeNodeList->item(0)->nodeValue,
444
                $this->makeMessageFromMessagesNodeList(
445
                    $domXpath->query($queryErrorMsg)
446
                )
447
            );
448
        }
449
450
        return $analyzeResponse;
451
    }
452
453
    /**
454
     * @param SendResult $response Fare_PricePNRWithLowerFares result