CreditCard::setValidate()   A
last analyzed

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
     * @param int $number
57
     * @param int $security
58
     * @param int $flag
59
     * @param DateTime $validate
60
     */
61 8
    public function __construct(
62
        int $number = 0, 
63
        int $security = 0, 
64
        int $flag = 0, 
65
        DateTime $validate = null
66
    ) {
67 8
        $this->number = $number;
0 ignored issues
show
Documentation Bug introduced by
It seems like $number of type integer 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...
68 8
        $this->security = $security;
0 ignored issues
show
Documentation Bug introduced by
It seems like $security of type integer 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...
69 8
        $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...
70 8
        $this->validate = $validate ?? new DateTime();
71 8
    }
72
73
    /**
74
     * @return the $number
75
     */
76 1
    public function getNumber(): int
77
    {
78 1
        return $this->number;
79
    }
80
81
    /**
82
     * @param int $number
83
     */
84 1
    public function setNumber(int $number)
85
    {
86 1
        $this->number = $number;
0 ignored issues
show
Documentation Bug introduced by
It seems like $number of type integer 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...
87 1
    }
88
89
    /**
90
     * @return the $validate
91
     */
92 1
    public function getValidate(): DateTime
93
    {
94 1
        return $this->validate;
95
    }
96
97
    /**
98
     * @param DateTime $validate
99
     */
100 1
    public function setValidate(DateTime $validate)
101
    {
102 1
        $this->validate = $validate;
103 1
    }
104
105
    /**
106
     * @return the $security
107
     */
108 1
    public function getSecurityNumber(): int
109
    {
110 1
        return $this->security;
111
    }
112
113
    /**
114
     * @param int $security
115
     */
116 1
    public function setSecurityNumber(int $security)
117
    {
118 1
        $this->security = $security;
0 ignored issues
show
Documentation Bug introduced by
It seems like $security of type integer 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...
119 1
    }
120
121
    /**
122
     * @return int
123
     */
124 1
    public function getFlag(): int
125
    {
126 1
        return $this->flag;
127
    }
128
129
    /**
130
     * @param int $flag
131
     */
132 1
    public function setFlag(int $flag)
133
    {
134 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...
135 1
    }
136
}
137