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
    {
@@ 492-521 (lines=30) @@
489
     * @return Result
490
     * @throws Exception
491
     */
492
    protected function analyzeFarePricePNRWithBookingClassResponse($response)
493
    {
494
        $analyzeResponse = new Result($response);
495
496
        $domXpath = $this->makeDomXpath($response->responseXml);
497
498
        $queryErrorCode = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCode";
499
        $queryErrorCategory = "//m:applicationError//m:errorOrWarningCodeDetails/m:errorDetails/m:errorCategory";
500
        $queryErrorMsg = "//m:applicationError/m:errorWarningDescription/m:freeText";
501
502
        $errorCodeNodeList = $domXpath->query($queryErrorCode);
503
504
        if ($errorCodeNodeList->length > 0) {
505
            $analyzeResponse->status = Result::STATUS_ERROR;
506
507
            $errorCatNode = $domXpath->query($queryErrorCategory)->item(0);
508
            if ($errorCatNode instanceof \DOMNode) {
509
                $analyzeResponse->status = $this->makeStatusFromErrorQualifier($errorCatNode->nodeValue);
510
            }
511
512
            $analyzeResponse->messages[] = new Result\NotOk(
513
                $errorCodeNodeList->item(0)->nodeValue,
514
                $this->makeMessageFromMessagesNodeList(
515
                    $domXpath->query($queryErrorMsg)
516
                )
517
            );
518
        }
519
520
        return $analyzeResponse;
521
    }
522
523
    protected function analyzeFareMasterPricerTravelBoardSearchResponse($response)
524
    {