ConfirmCar   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 7
dl 0
loc 80
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 29 6
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\Offer;
24
25
use Amadeus\Client\RequestCreator\MessageVersionUnsupportedException;
26
use Amadeus\Client\RequestOptions\OfferConfirmCarOptions;
27
use Amadeus\Client\Struct\BaseWsMessage;
28
use Amadeus\Client\Struct\Offer\ConfirmCar\AddressUsageDetails;
29
use Amadeus\Client\Struct\Offer\ConfirmCar\DeliveryAndCollection;
30
use Amadeus\Client\Struct\Offer\ConfirmCar\PaxTattooNbr;
31
use Amadeus\Client\Struct\Offer\ConfirmCar\PnrInfo;
32
use Amadeus\Client\Struct\Offer\ConfirmCar\TattooReference;
33
use Amadeus\Client\Struct\Pnr\Retrieve\ReservationOrProfileIdentifier;
34
35
/**
36
 * Offer_ConfirmCarOffer
37
 *
38
 * @package Amadeus\Client\Struct\Offer
39
 * @author Dieter Devlieghere <[email protected]>
40
 */
41
class ConfirmCar extends BaseWsMessage
42
{
43
    /**
44
     * @var ConfirmCar\PnrInfo
45
     */
46
    public $pnrInfo;
47
48
    public $bookingType;
49
50
    /**
51
     * @var ConfirmCar\DeliveryAndCollection[]
52
     */
53
    public $deliveryAndCollection = [];
54
55
    public $vehicleInformation;
56
57
    public $arrivalInfo;
58
59
    public $fFlyerNbr;
60
61
    public $rateInfo;
62
63
    public $payment;
64
65
    public $attributeData;
66
67
    public $billingData;
68
69
    public $supleInfo;
70
71
    public $estimatedDistance;
72
73
    public $agentInformation;
74
75
    public $trackingOpt;
76
77
    public $customerEmail;
78
79
    public $retryProcess;
80
81
    public $ruleReference;
82
83
    public $action;
84
85
    /**
86
     * ConfirmCar constructor.
87
     *
88
     * @param OfferConfirmCarOptions $params
89
     * @throws MessageVersionUnsupportedException
90
     */
91
    public function __construct($params)
92
    {
93
        $this->pnrInfo = new PnrInfo();
94
95
        if (!empty($params->passengerTattoo)) {
96
            $this->pnrInfo->paxTattooNbr = new PaxTattooNbr($params->passengerTattoo);
97
        }
98
99
        if (!empty($params->offerTattoo)) {
100
            $this->pnrInfo->tattooReference = new TattooReference($params->offerTattoo);
101
        }
102
103
        if (!empty($params->recordLocator)) {
104
            $this->pnrInfo->pnrRecLoc = new ReservationOrProfileIdentifier($params->recordLocator);
105
        }
106
107
        if (!empty($params->pickUpInfo)) {
108
            $this->deliveryAndCollection[] = new DeliveryAndCollection(
109
                AddressUsageDetails::PURPOSE_COLLECTION,
110
                $params->pickUpInfo
111
            );
112
        }
113
        if (!empty($params->dropOffInfo)) {
114
            $this->deliveryAndCollection[] = new DeliveryAndCollection(
115
                AddressUsageDetails::PURPOSE_DELIVERY,
116
                $params->dropOffInfo
117
            );
118
        }
119
    }
120
}
121