Test Failed
Pull Request — master (#368)
by
unknown
17:22
created

GetVirtualCardDetails   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 10 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 3
loc 30
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 3 13 4

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 * amadeus-ws-client
5
 *
6
 * Copyright 2015 Amadeus Benelux NV
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 *
20
 * @package Amadeus
21
 * @license https://opensource.org/licenses/Apache-2.0 Apache 2.0
22
 */
23
24
namespace Amadeus\Client\Struct\Pay;
25
26
use Amadeus\Client\RequestOptions\PayGetVirtualCardDetailsOptions;
27
use Amadeus\Client\Struct\BaseWsMessage;
28
use Amadeus\Client\Struct\InvalidArgumentException;
29
30
/**
31
 * GetVirtualCardDetails
32
 *
33
 * @package Amadeus\Client\Struct\Pay
34
 * @author Konstantin Bogomolov <[email protected]>
35
 */
36
class GetVirtualCardDetails extends BaseWsMessage
37
{
38
    const FILTER_FULL = 'Full';
39
    const FILTER_LIGHT = 'Light';
40
41
    public $Version = '2.0';
42
43
    public $References;
44
45
    public $DisplayFilter;
46
47
    /**
48
     * GetVirtualCardDetails constructor.
49
     * @param PayGetVirtualCardDetailsOptions $params
50
     * @param string|int                      $version
51
     */
52
    public function __construct(PayGetVirtualCardDetailsOptions $params, $version)
0 ignored issues
show
Unused Code introduced by
The parameter $version is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
53
    {
54 View Code Duplication
        if ($params->amadeusReference === null || $params->externalReference === null) {
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...
55
            throw new InvalidArgumentException('Both References in DeleteVirtualCard options are mandatory');
56
        }
57
58
        $this->References[] = new Reference(Reference::TYPE_AMADEUS, $params->amadeusReference);
59
        $this->References[] = new Reference(Reference::TYPE_EXTERNAL, $params->externalReference);
60
61
        if (null !== $params->displayFilter) {
62
            $this->DisplayFilter = $params->displayFilter;
63
        }
64
    }
65
}
66