Test Failed
Push — master ( d99a5b...94cf84 )
by Dieter
10:01
created

HandlerGetFareRules::analyze()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 8
Ratio 53.33 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 8
loc 15
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 9
nc 2
nop 1
1
<?php
2
/**
3
 * amadeus-ws-client
4
 *
5
 * Copyright 2015 Amadeus Benelux NV
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.
9
 * You may obtain a copy of the License at
10
 *
11
 * http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 *
19
 * @package Amadeus
20
 * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
21
 */
22
23
namespace Amadeus\Client\ResponseHandler\Fare;
24
25
use Amadeus\Client\ResponseHandler\StandardResponseHandler;
26
use Amadeus\Client\Result;
27
use Amadeus\Client\Session\Handler\SendResult;
28
29
/**
30
 * Fare_GetFareRules response handler
31
 *
32
 * @package Amadeus\Client\ResponseHandler\Fare
33
 * @author Dieter Devlieghere <[email protected]>
34
 */
35
class HandlerGetFareRules extends StandardResponseHandler
36
{
37
    const Q_ERR_CODE = "//m:infoText//m:informationType";
38
    const Q_ERR_MSG = "//m:infoText/m:freeText";
39
40
    /**
41
     * @param SendResult $response
42
     * @return Result
43
     */
44
    public function analyze(SendResult $response)
45
    {
46
        $result = $this->analyzeSimpleResponseErrorCodeAndMessage($response);
47
48 View Code Duplication
        if ($result->status === Result::STATUS_OK) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
49
            $result = $this->analyzeWithErrCodeAndMsgQueryFixedCat(
50
                $response,
51
                self::Q_ERR_CODE,
52
                self::Q_ERR_MSG,
53
                Result::STATUS_WARN
54
            );
55
        }
56
57
        return $result;
58
    }
59
}
60