Completed
Pull Request — master (#241)
by
unknown
63:33
created

DisplayDailyOrSummarizedReport   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 2
cbo 4
dl 0
loc 64
ccs 24
cts 24
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 23 1
A loadCurrency() 0 6 2
A loadSalesReportIdentification() 0 6 2
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\SalesReports;
24
25
use Amadeus\Client\RequestOptions\SalesReportsDisplayDailyOrSummarizedReportOptions;
26
use Amadeus\Client\Struct\SalesReports\DisplayDailyOrSummarizedReport\SalesReportIdentification;
27
use Amadeus\Client\Struct\SalesReports\DisplayQueryReport\CurrencyInfo;
28
29
/**
30
 * DisplayDailyOrSummarizedReport
31
 *
32
 * @package Amadeus\Client\Struct\SalesReports
33
 * @author Artem Zakharchenko <[email protected]>
34
 */
35
class DisplayDailyOrSummarizedReport extends DisplayQueryReport
36
{
37
    /**
38
     * @var SalesReportIdentification
39
     */
40
    public $salesReportIdentification;
41
42
    /**
43
     * @var DisplayQueryReport\CurrencyInfo
44
     */
45
    public $currency;
46
47
    /**
48
     * @var string
49
     */
50
    public $dummy;
51
52
    /**
53
     * DisplayDailyOrSummarizedReport constructor.
54
     *
55
     * @param SalesReportsDisplayDailyOrSummarizedReportOptions $options
56
     */
57 16
    public function __construct(SalesReportsDisplayDailyOrSummarizedReportOptions $options)
58
    {
59 16
        $this->loadRequestOptions($options->requestOptions);
60
61 16
        $this->loadAgencySource($options->agencySourceType, $options->agencyIataNumber, $options->agencyOfficeId);
62
63 16
        $this->loadAgent($options->agentCode);
64
65 16
        $this->loadValidatingCarrier($options->validatingCarrier);
66
67 16
        $this->loadDateRange($options->startDate, $options->endDate);
68
69 16
        $this->loadDate($options->specificDateType, $options->specificDate);
70
71 16
        $this->loadCurrency($options->currencyType, $options->currency);
72
73 16
        $this->loadSalesIndicator($options->salesIndicator);
74
75 16
        $this->loadSalesReportIdentification(
76 16
            $options->salesReportIdentificationNumber,
77 16
            $options->salesReportIdentificationType
78 8
        );
79 16
    }
80
81
    /**
82
     * @param string $type
83
     * @param string $currency
84
     */
85 16
    protected function loadCurrency($type, $currency)
86
    {
87 16
        if ($this->checkAnyNotEmpty($type, $currency)) {
88 4
            $this->currency = new CurrencyInfo($type, $currency);
89 2
        }
90 16
    }
91
92 16
    protected function loadSalesReportIdentification($number, $type)
93
    {
94 16
        if ($this->checkAllNotEmpty($number, $type)) {
95 4
            $this->salesReportIdentification = new SalesReportIdentification($number, $type);
96 2
        }
97 16
    }
98
}
99