Completed
Push — master ( 56a4b6...59de4e )
by Dieter
11:31
created

PersonalFacts   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 5
dl 0
loc 45
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 18 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\Pnr\Retrieve;
24
25
use Amadeus\Client\RequestOptions\Pnr\Retrieve\Ticket as TicketOptions;
26
use Amadeus\Client\Struct\WsMessageUtility;
27
28
/**
29
 * PersonalFacts
30
 *
31
 * @package Amadeus\Client\Struct\Pnr\Retrieve
32
 * @author Dieter Devlieghere <[email protected]>
33
 */
34
class PersonalFacts extends WsMessageUtility
35
{
36
    /**
37
     * @var TravellerInformation
38
     */
39
    public $travellerInformation;
40
41
    /**
42
     * @var ProductInformation
43
     */
44
    public $productInformation;
45
46
    /**
47
     * @var Ticket
48
     */
49
    public $ticket;
50
51
    /**
52
     * PersonalFacts constructor.
53
     *
54
     * @param string|null $surName
55
     * @param \DateTime|null $departureDate
56
     * @param TicketOptions|null $ticket
57
     * @param string|null $company
58
     * @param string|null $flightNumber
59
     */
60 4
    public function __construct($surName, $departureDate, $ticket, $company, $flightNumber)
61
    {
62 4
        if (!empty($surName)) {
63 4
            $this->travellerInformation = new TravellerInformation($surName);
64 4
        }
65
66 4
        if ($departureDate instanceof \DateTime || $this->checkAnyNotEmpty($company, $flightNumber)) {
67 2
            $this->productInformation = new ProductInformation(
68 2
                $departureDate,
69 2
                $company,
70
                $flightNumber
71 2
            );
72 2
        }
73
74 4
        if ($ticket instanceof TicketOptions) {
75 1
            $this->ticket = new Ticket($ticket->airline, $ticket->number);
76 2
        }
77 4
    }
78
}
79