Completed
Push — master ( 48ab8a...13f83a )
by Dieter
05:33
created

QueueList   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 9

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 9
dl 0
loc 69
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 23 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\Queue;
24
25
use Amadeus\Client\RequestOptions\QueueListOptions;
26
use Amadeus\Client\Struct\BaseWsMessage;
27
28
/**
29
 * Structure class for representing the Queue_List request message
30
 *
31
 * @package Amadeus\Client\Struct\Queue
32
 * @author Dieter Devlieghere <[email protected]>
33
 */
34
class QueueList extends BaseWsMessage
35
{
36
    /**
37
     * @var Scroll
38
     */
39
    public $scroll;
40
41
    /**
42
     * @var TargetOffice
43
     */
44
    public $targetOffice;
45
46
    /**
47
     * @var QueueNumber
48
     */
49
    public $queueNumber;
50
51
    /**
52
     * @var CategoryDetails
53
     */
54
    public $categoryDetails;
55
56
    /**
57
     * @var QueueDate
58
     */
59
    public $date;
60
61
    /**
62
     * @var ScanRange
63
     */
64
    public $scanRange;
65
66
    /**
67
     * @var SearchCriteria[]
68
     */
69
    public $searchCriteria = [];
70
71
    /**
72
     * @var SortCriteria
73
     */
74
    public $sortCriteria;
75
76
    /**
77
     * @param QueueListOptions $options
78
     */
79 7
    public function __construct(QueueListOptions $options)
80
    {
81 7
        $this->queueNumber = new QueueNumber($options->queue->queue);
82
83 7
        $this->categoryDetails = new CategoryDetails($options->queue->category);
84
85 7
        if (!empty($options->queue->officeId)) {
86 2
            $this->targetOffice = new TargetOffice(
87 2
                SourceType::SOURCETYPE_OFFICE_SPECIFIED,
88 2
                $options->queue->officeId
89 2
            );
90 2
        }
91
92 7
        $this->sortCriteria = new SortCriteria($options->sortType);
93
94 7
        foreach ($options->searchCriteria as $opt) {
95 1
            $this->searchCriteria[] = new SearchCriteria($opt);
96 7
        }
97
98 7
        if (is_int($options->firstItemNr) && is_int($options->lastItemNr)) {
99 1
            $this->scanRange = new ScanRange($options->firstItemNr, $options->lastItemNr);
100 1
        }
101 7
    }
102
}
103