QueueList   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
eloc 25
c 0
b 0
f 0
dl 0
loc 79
ccs 20
cts 20
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 29 7
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
     * @var AccountNumber
78
     */
79 40
    public $accountNumber;
80
81 40
    /**
82
     * @param QueueListOptions $options
83 40
     */
84
    public function __construct(QueueListOptions $options)
85 40
    {
86 5
        $this->queueNumber = new QueueNumber($options->queue->queue);
87 2
88
        $this->categoryDetails = new CategoryDetails($options->queue->category);
89 40
90 10
        if (!empty($options->queue->timeMode)) {
91 10
            $this->date = new QueueDate($options->queue->timeMode);
92 10
        }
93 4
        
94 4
        if (!empty($options->queue->officeId)) {
95
            $this->targetOffice = new TargetOffice(
96 40
                SourceType::SOURCETYPE_OFFICE_SPECIFIED,
97
                $options->queue->officeId
98 40
            );
99 5
        }
100 16
101
        $this->sortCriteria = new SortCriteria($options->sortType);
102 40
103 5
        foreach ($options->searchCriteria as $opt) {
104 2
            $this->searchCriteria[] = new SearchCriteria($opt);
105 40
        }
106
107
        if (is_int($options->firstItemNr) && is_int($options->lastItemNr)) {
108
            $this->scanRange = new ScanRange($options->firstItemNr, $options->lastItemNr);
109
        }
110
111
        if (!empty($options->queue->accountNumber)) {
112
            $this->accountNumber = new AccountNumber($options->queue->accountNumber);
113
        }
114
    }
115
}
116