Completed
Push — master ( 610618...63e89b )
by Dieter
08:00
created

CancelDocument   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 8
dl 0
loc 58
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 25 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\Ticket;
24
25
use Amadeus\Client\RequestOptions\TicketCancelDocumentOptions;
26
use Amadeus\Client\Struct\BaseWsMessage;
27
use Amadeus\Client\Struct\DocRefund\DocumentNumberDetails;
28
use Amadeus\Client\Struct\Ticket\CancelDocument\SequenceNumberRanges;
29
use Amadeus\Client\Struct\Ticket\CancelDocument\StockProviderDetails;
30
use Amadeus\Client\Struct\Ticket\CancelDocument\TargetOfficeDetails;
31
use Amadeus\Client\Struct\Ticket\CancelDocument\VoidOption;
32
33
/**
34
 * Ticket_CancelDocument request structure
35
 *
36
 * @package Amadeus\Client\Struct\Ticket
37
 * @author Dieter Devlieghere <[email protected]>
38
 */
39
class CancelDocument extends BaseWsMessage
40
{
41
    /**
42
     * @var DocumentNumberDetails
43
     */
44
    public $documentNumberDetails;
45
46
    /**
47
     * @var SequenceNumberRanges[]
48
     */
49
    public $sequenceNumberRanges = [];
50
51
    /**
52
     * @var VoidOption
53
     */
54
    public $voidOption;
55
56
    /**
57
     * @var StockProviderDetails
58
     */
59
    public $stockProviderDetails;
60
61
    /**
62
     * @var TargetOfficeDetails
63
     */
64
    public $targetOfficeDetails;
65
66
    /**
67
     * CancelDocument constructor.
68
     *
69
     * @param TicketCancelDocumentOptions $options
70
     */
71 7
    public function __construct($options)
72
    {
73 7
        if (!empty($options->officeId)) {
74 7
            $this->targetOfficeDetails = new TargetOfficeDetails($options->officeId);
75 7
        }
76
77 7
        if ($this->checkAnyNotEmpty($options->airlineStockProvider, $options->marketStockProvider)) {
78 7
            $this->stockProviderDetails = new StockProviderDetails(
79 7
                $options->airlineStockProvider,
80 7
                $options->marketStockProvider
81 7
            );
82 7
        }
83
84 7
        if ($options->void === true) {
85 1
            $this->voidOption = new VoidOption();
86 1
        }
87
88 7
        foreach ($options->sequenceRanges as $sequenceRange) {
89 2
            $this->sequenceNumberRanges[] = new SequenceNumberRanges($sequenceRange->from, $sequenceRange->to);
90 7
        }
91
92 7
        if (!empty($options->eTicket)) {
93 5
            $this->documentNumberDetails = new DocumentNumberDetails($options->eTicket);
94 5
        }
95 7
    }
96
}
97