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
    {
@@ 417-446 (lines=30) @@
414
     * @return Result
415
     * @throws Exception
416
     */
417
    protected function analyzeFarePricePNRWithBookingClassResponse($response)
418
    {
419
        $analyzeResponse = new Result($response);
420
421
        $domXpath = $this->makeDomXpath($response->responseXml);
422
423
        $queryErrorCode = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCode";
424
        $queryErrorCategory = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCategory";
425
        $queryErrorMsg = "//m:applicationError/m:errorWarningDescription/m:freeText";
426
427
        $errorCodeNodeList = $domXpath->query($queryErrorCode);
428
429
        if ($errorCodeNodeList->length > 0) {
430
            $analyzeResponse->status = Result::STATUS_ERROR;
431
432
            $errorCatNode = $domXpath->query($queryErrorCategory)->item(0);
433
            if ($errorCatNode instanceof \DOMNode) {
434
                $analyzeResponse->status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue);
435
            }
436
437
            $analyzeResponse->messages[] = new Result\NotOk(
438
                $errorCodeNodeList->item(0)->nodeValue,
439
                $this->makeMessageFromMessagesNodeList(
440
                    $domXpath->query($queryErrorMsg)
441
                )
442
            );
443
        }
444
445
        return $analyzeResponse;
446
    }
447
448
    /**
449
     * @param SendResult $response Fare_PricePNRWithLowerFares result