Fop::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 4

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 4
nc 2
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\AddMultiElements;
24
25
/**
26
 * Fop
27
 *
28
 * @package Amadeus\Client\Struct\Pnr\AddMultiElements
29
 * @author Dieter Devlieghere <[email protected]>
30
 */
31
class Fop
32
{
33
    const IDENT_CASH = "CA";
34
    const IDENT_CHECK = "CK";
35
    const IDENT_CREDITCARD = "CC";
36
    const IDENT_MISC = "MS";
37
38
    /**
39
     * @var string
40
     */
41
    public $identification;
42
    /**
43
     * @var mixed
44
     */
45
    public $amount;
46
    /**
47
     * @var mixed
48
     */
49
    public $creditCardCode;
50
    /**
51
     * @var mixed
52
     */
53
    public $accountNumber;
54
    /**
55
     * @var mixed
56
     */
57
    public $expiryDate;
58
    /**
59
     * @var mixed
60
     */
61
    public $approvalCode;
62
    /**
63
     * @var mixed
64
     */
65
    public $customerAccountNumber;
66
    /**
67
     * @var mixed
68
     */
69
    public $paymentTimeReference;
70
    /**
71
     * @var mixed
72
     */
73
    public $freetext;
74
    /**
75
     * @var mixed
76
     */
77
    public $currencyCode;
78
79
    /**
80
     * @param string|null $identification One of the constants IDENT_* defined in this class.
81
     */
82 30
    public function __construct($identification = null)
83
    {
84 30
        if (!is_null($identification) && strlen($identification) == 2 && self::isValidFopType($identification)) {
85 30
            $this->identification = $identification;
86 12
        }
87 30
    }
88
89
    /**
90
     * Check if the given Form Of Payment type is valid
91
     *
92
     * @param string $fopType
93
     * @return boolean
94
     */
95 30
    public static function isValidFopType($fopType)
96
    {
97 18
        return ($fopType == self::IDENT_CASH
98 27
            || $fopType == self::IDENT_CHECK
99 22
            || $fopType == self::IDENT_CREDITCARD
100 30
            || $fopType == self::IDENT_MISC);
101
    }
102
}
103