Completed
Pull Request — master (#241)
by
unknown
117:52 queued 59:14
created

DisplayDailyOrSummarizedReport::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 14
cts 14
cp 1
rs 9.552
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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->checkAnyNotEmpty($number, $type)) {
95 4
            $this->salesReportIdentification = new SalesReportIdentification($number, $type);
96 2
        }
97 16
    }
98
}
99