Completed
Push — master ( d12f20...d8e140 )
by Dieter
21:40
created

Split::__construct()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 9
Code Lines 5

Duplication

Lines 3
Ratio 33.33 %

Code Coverage

Tests 8
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 3
loc 9
ccs 8
cts 8
cp 1
rs 9.2
c 1
b 0
f 0
cc 4
eloc 5
nc 4
nop 1
crap 4
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;
24
25
use Amadeus\Client\RequestOptions\PnrSplitOptions;
26
use Amadeus\Client\Struct\BaseWsMessage;
27
use Amadeus\Client\Struct\Pnr\Split\SplitDetails;
28
29
/**
30
 * Structure class for representing the PNR_Split request message
31
 *
32
 * @package Amadeus\Client\Struct\Pnr
33
 * @author Mike Hernas <[email protected]>
34
 */
35
class Split extends BaseWsMessage
36
{
37
    /**
38
     * @var ReservationInfo
39
     */
40
    public $reservationInfo;
41
42
    /**
43
     * @var SplitDetails
44
     */
45
    public $splitDetails;
46
    
47
    /**
48
     * Split constructor.
49
     *
50
     * @param PnrSplitOptions $params
51
     */
52 8
    public function __construct(PnrSplitOptions $params)
53
    {
54 8 View Code Duplication
        if (is_string($params->recordLocator) && strlen($params->recordLocator) >= 6) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55 4
            $this->reservationInfo = new ReservationInfo($params->recordLocator);
56 2
        }
57 8
        if ($params->passengerTattoos) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $params->passengerTattoos of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
58 8
            $this->splitDetails = new SplitDetails($params->passengerTattoos);
59 4
        }
60 8
    }
61
}
62