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
    {
@@ 459-488 (lines=30) @@
456
     * @return Result
457
     * @throws Exception
458
     */
459
    protected function analyzeFarePricePNRWithBookingClassResponse($response)
460
    {
461
        $analyzeResponse = new Result($response);
462
463
        $domXpath = $this->makeDomXpath($response->responseXml);
464
465
        $queryErrorCode = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCode";
466
        $queryErrorCategory = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCategory";
467
        $queryErrorMsg = "//m:applicationError/m:errorWarningDescription/m:freeText";
468
469
        $errorCodeNodeList = $domXpath->query($queryErrorCode);
470
471
        if ($errorCodeNodeList->length > 0) {
472
            $analyzeResponse->status = Result::STATUS_ERROR;
473
474
            $errorCatNode = $domXpath->query($queryErrorCategory)->item(0);
475
            if ($errorCatNode instanceof \DOMNode) {
476
                $analyzeResponse->status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue);
477
            }
478
479
            $analyzeResponse->messages[] = new Result\NotOk(
480
                $errorCodeNodeList->item(0)->nodeValue,
481
                $this->makeMessageFromMessagesNodeList(
482
                    $domXpath->query($queryErrorMsg)
483
                )
484
            );
485
        }
486
487
        return $analyzeResponse;
488
    }
489
490
    /**
491
     * @param SendResult $response Fare_PricePNRWithLowerFares result