Passed
Push — master ( 294393...d99a5b )
by Dieter
49s
created

TicketGroup::__construct()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 24
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 19
cts 19
cp 1
rs 8.5125
c 0
b 0
f 0
cc 5
eloc 13
nc 16
nop 1
crap 5
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\DocRefund\UpdateRefund;
24
25
use Amadeus\Client\RequestOptions\DocRefund\TickGroupOpt;
26
use Amadeus\Client\Struct\Ticket\CheckEligibility\ActionIdentification;
27
use Amadeus\Client\Struct\WsMessageUtility;
28
29
/**
30
 * TicketGroup
31
 *
32
 * @package Amadeus\Client\Struct\DocRefund\UpdateRefund
33
 * @author Dieter Devlieghere <[email protected]>
34
 */
35
class TicketGroup extends WsMessageUtility
36
{
37
    /**
38
     * @var CouponInformationDetails
39
     */
40
    public $couponInformationDetails;
41
42
    /**
43
     * @var BoardingPriority
44
     */
45
    public $boardingPriority;
46
47
    /**
48
     * @var ActionIdentification
49
     */
50
    public $actionIdentification;
51
52
    /**
53
     * @var ReferenceInformation
54
     */
55
    public $referenceInformation;
56
57
    /**
58
     * TicketGroup constructor.
59
     *
60
     * @param TickGroupOpt $opt
61
     */
62 4
    public function __construct(TickGroupOpt $opt)
63
    {
64 4
        if ($this->checkAnyNotEmpty($opt->couponNumber, $opt->couponStatus)) {
65 4
            $this->couponInformationDetails = new CouponInformationDetails(
66 4
                $opt->couponNumber,
67 4
                $opt->couponStatus
68 4
            );
69 4
        }
70
71 4
        if (!empty($opt->boardingPriority)) {
72 3
            $this->boardingPriority = new BoardingPriority($opt->boardingPriority);
73 3
        }
74
75 4
        if (!empty($opt->actionRequestCode)) {
76 1
            $this->actionIdentification = new ActionIdentification($opt->actionRequestCode);
77 1
        }
78
79 4
        if (!empty($opt->references)) {
80 1
            $this->referenceInformation = new ReferenceInformation(
81 1
                $opt->references,
82
                ReferenceDetails::TYPE_VALIDATION_CERTIFICATE_USED_FOR_STAFF
83 1
            );
84 1
        }
85 4
    }
86
}
87