Code Duplication    Length = 26-30 lines in 2 locations

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

@@ 109-134 (lines=26) @@
106
        return $ccResult;
107
    }
108
109
    protected function analyzeAirMultiAvailabilityResponse($response)
110
    {
111
        $analyzeResponse = new Result($response);
112
113
        $message = null;
114
115
        $domXpath = $this->makeDomXpath($response->responseXml);
116
117
        $codeNode = $domXpath->query("//m:errorOrWarningSection/m:errorOrWarningInfo//m:code")->item(0);
118
        if ($codeNode instanceof \DOMNode) {
119
            $analyzeResponse->status = Result::STATUS_ERROR;
120
121
            $categoryNode = $domXpath->query("//m:errorOrWarningSection/m:errorOrWarningInfo//m:type")->item(0);
122
            if ($categoryNode instanceof \DOMNode) {
123
                $analyzeResponse->status = $this->makeStatusFromErrorQualifier($categoryNode->nodeValue);
124
            }
125
126
            $messageNodes = $domXpath->query('//m:errorOrWarningSection/m:textInformation/m:freeText');
127
            if ($messageNodes->length > 0) {
128
                $message = $this->makeMessageFromMessagesNodeList($messageNodes);
129
            }
130
            $analyzeResponse->messages [] = new Result\NotOk($codeNode->nodeValue, $message);
131
        }
132
133
        return $analyzeResponse;
134
    }
135
136
    protected function analyzeAirSellFromRecommendationResponse($response)
137
    {
@@ 489-518 (lines=30) @@
486
     * @return Result
487
     * @throws Exception
488
     */
489
    protected function analyzeFarePricePNRWithBookingClassResponse($response)
490
    {
491
        $analyzeResponse = new Result($response);
492
493
        $domXpath = $this->makeDomXpath($response->responseXml);
494
495
        $queryErrorCode = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCode";
496
        $queryErrorCategory = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCategory";
497
        $queryErrorMsg = "//m:applicationError/m:errorWarningDescription/m:freeText";
498
499
        $errorCodeNodeList = $domXpath->query($queryErrorCode);
500
501
        if ($errorCodeNodeList->length > 0) {
502
            $analyzeResponse->status = Result::STATUS_ERROR;
503
504
            $errorCatNode = $domXpath->query($queryErrorCategory)->item(0);
505
            if ($errorCatNode instanceof \DOMNode) {
506
                $analyzeResponse->status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue);
507
            }
508
509
            $analyzeResponse->messages[] = new Result\NotOk(
510
                $errorCodeNodeList->item(0)->nodeValue,
511
                $this->makeMessageFromMessagesNodeList(
512
                    $domXpath->query($queryErrorMsg)
513
                )
514
            );
515
        }
516
517
        return $analyzeResponse;
518
    }
519
520
    /**
521
     * @param SendResult $response