Completed
Push — master ( 33e1d8...2c97f6 )
by Dieter
08:19
created

Commission   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 44
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 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\Struct\Pnr\AddMultiElements;
24
25
use Amadeus\Client\RequestOptions\Pnr\Element\ManualCommission;
26
27
/**
28
 * Commission
29
 *
30
 * @package Amadeus\Client\Struct\Pnr\AddMultiElements
31
 * @author Dieter Devlieghere <[email protected]>
32
 */
33
class Commission
34
{
35
    /**
36
     * @var string
37
     */
38
    public $passengerType;
39
40
    /**
41
     * @var string
42
     */
43
    public $indicator;
44
45
    /**
46
     * @var CommissionInfo
47
     */
48
    public $commissionInfo;
49
50
    /**
51
     * @var CommissionInfo
52
     */
53
    public $oldCommission;
54
55
    /**
56
     * @var int
57
     */
58
    public $manualCapping;
59
60
    /**
61
     * Commission constructor.
62
     *
63
     * @param ManualCommission $options
64
     */
65 1
    public function __construct($options)
66
    {
67 1
        $this->passengerType = $options->passengerType;
0 ignored issues
show
Documentation Bug introduced by
It seems like $options->passengerType can also be of type integer. However, the property $passengerType is declared as type string. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
68 1
        $this->indicator = $options->indicator;
69 1
        $this->commissionInfo = new CommissionInfo(
70 1
            $options->percentage,
71 1
            $options->amount,
72 1
            $options->vatIndicator,
73 1
            $options->remitIndicator
74 1
        );
75 1
    }
76
}
77