Passed
Push — master ( 98de4f...224db0 )
by Thiago
30s
created

CreditCard::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace MrPrompt\ShipmentCommon\Base;
3
4
use DateTime;
5
6
/**
7
 * Credit card
8
 *
9
 * @author Thiago Paes <[email protected]>
10
 */
11
class CreditCard
12
{
13
    const AMEX          = 38;
14
    const MASTERCARD    = 39;
15
    const HIPERCARD     = 40;
16
    const DINNERS       = 41;
17
    const DISCOVER      = 45;
18
    const VISA          = 42;
19
    const AURA          = 51;
20
    const ELO           = 60;
21
    const GOODCARD      = 61;
22
    const JCB           = 62;
23
    const MAIS          = 63;
24
    const CABAL         = 64;
25
    const SOROCRED      = 65;
26
    const SICREDI       = 66;
27
    const COOPERCRED    = 67;
28
    const AVISTA        = 68;
29
30
    /**
31
     *
32
     * @var numeric
33
     */
34
    private $number;
35
36
    /**
37
     *
38
     * @var DateTime
39
     */
40
    private $validate;
41
42
    /**
43
     *
44
     * @var numeric
45
     */
46
    private $security;
47
48
    /**
49
     * @var numeric
50
     */
51
    private $flag;
52
53
    /**
54
     * Constructor
55
     */
56 8
    public function __construct(DateTime $validate = null)
57
    {
58 8
        $this->validate = $validate ?? new DateTime();
59 8
    }
60
61
    /**
62
     * @return the $number
63
     */
64 1
    public function getNumber(): string
65
    {
66 1
        return $this->number;
67
    }
68
69
    /**
70
     * @param string $number
71
     */
72 1
    public function setNumber(string $number)
73
    {
74 1
        $this->number = $number;
0 ignored issues
show
Documentation Bug introduced by
It seems like $number of type string is incompatible with the declared type object<MrPrompt\ShipmentCommon\Base\numeric> of property $number.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
75 1
    }
76
77
    /**
78
     * @return the $validate
79
     */
80 1
    public function getValidate(): DateTime
81
    {
82 1
        return $this->validate;
83
    }
84
85
    /**
86
     * @param DateTime $validate
87
     */
88 1
    public function setValidate(DateTime $validate)
89
    {
90 1
        $this->validate = $validate;
91 1
    }
92
93
    /**
94
     * @return the $security
95
     */
96 1
    public function getSecurityNumber(): string
97
    {
98 1
        return $this->security;
99
    }
100
101
    /**
102
     * @param string $security
103
     */
104 1
    public function setSecurityNumber(string $security)
105
    {
106 1
        $this->security = $security;
0 ignored issues
show
Documentation Bug introduced by
It seems like $security of type string is incompatible with the declared type object<MrPrompt\ShipmentCommon\Base\numeric> of property $security.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
107 1
    }
108
109
    /**
110
     * @return int
111
     */
112 1
    public function getFlag(): int
113
    {
114 1
        return $this->flag;
115
    }
116
117
    /**
118
     * @param int $flag
119
     */
120 1
    public function setFlag(int $flag)
121
    {
122 1
        $this->flag = $flag;
0 ignored issues
show
Documentation Bug introduced by
It seems like $flag of type integer is incompatible with the declared type object<MrPrompt\ShipmentCommon\Base\numeric> of property $flag.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
123 1
    }
124
}
125