Passed
Push — main ( 4e94f6...3982f8 )
by Iain
04:46
created

PaymentCard::setDeletedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright Iain Cambridge 2020-2023.
7
 *
8
 * Use of this software is governed by the Business Source License included in the LICENSE file and at https://getparthenon.com/docs/next/license.
9
 *
10
 * Change Date: TBD ( 3 years after 2.2.0 release )
11
 *
12
 * On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file.
13
 */
14
15
namespace Parthenon\Billing\Entity;
16
17
use Parthenon\Athena\Entity\DeletableInterface;
18
use Symfony\Component\Serializer\Annotation\Ignore;
19
use Symfony\Component\Serializer\Annotation\SerializedName;
20
21
class PaymentCard implements DeletableInterface
22
{
23
    protected $id;
24
25
    #[Ignore]
26
    protected $customer;
27
28
    #[Ignore]
29
    protected string $provider;
30
31
    #[Ignore]
32
    protected string $storedCustomerReference;
33
34
    #[Ignore]
35
    protected string $storedPaymentReference;
36
37
    protected ?string $name = null;
38
39
    #[SerializedName('default')]
40
    protected bool $defaultPaymentOption = true;
41
42
    protected ?string $brand = null;
43
44
    #[SerializedName('last_four')]
45
    protected ?string $lastFour = null;
46
47
    #[SerializedName('expiry_month')]
48
    protected ?string $expiryMonth = null;
49
50
    #[SerializedName('expiry_year')]
51
    protected ?string $expiryYear = null;
52
53
    #[SerializedName('created_at')]
54
    protected \DateTimeInterface $createdAt;
55
56
    #[Ignore]
57
    protected bool $deleted = false;
58
59
    #[Ignore]
60
    protected ?\DateTime $deletedAt = null;
61
62
    /**
63
     * @return mixed
64
     */
65
    public function getId()
66
    {
67
        return $this->id;
68
    }
69
70
    /**
71
     * @param mixed $id
72
     */
73
    public function setId($id): void
74
    {
75
        $this->id = $id;
76
    }
77
78
    /**
79
     * @return mixed
80
     */
81
    public function getCustomer()
82
    {
83
        return $this->customer;
84
    }
85
86
    /**
87
     * @param mixed $customer
88
     */
89
    public function setCustomer($customer): void
90
    {
91
        $this->customer = $customer;
92
    }
93
94
    public function getProvider(): string
95
    {
96
        return $this->provider;
97
    }
98
99
    public function setProvider(string $provider): void
100
    {
101
        $this->provider = $provider;
102
    }
103
104
    public function getStoredPaymentReference(): string
105
    {
106
        return $this->storedPaymentReference;
107
    }
108
109
    public function setStoredPaymentReference(string $storedPaymentReference): void
110
    {
111
        $this->storedPaymentReference = $storedPaymentReference;
112
    }
113
114
    public function getName(): ?string
115
    {
116
        return $this->name;
117
    }
118
119
    public function setName(?string $name): void
120
    {
121
        $this->name = $name;
122
    }
123
124
    public function isDefaultPaymentOption(): bool
125
    {
126
        return $this->defaultPaymentOption;
127
    }
128
129
    public function setDefaultPaymentOption(bool $defaultPaymentOption): void
130
    {
131
        $this->defaultPaymentOption = $defaultPaymentOption;
132
    }
133
134
    public function getStoredCustomerReference(): string
135
    {
136
        return $this->storedCustomerReference;
137
    }
138
139
    public function setStoredCustomerReference(string $storedCustomerReference): void
140
    {
141
        $this->storedCustomerReference = $storedCustomerReference;
142
    }
143
144
    public function getBrand(): ?string
145
    {
146
        return $this->brand;
147
    }
148
149
    public function setBrand(?string $brand): void
150
    {
151
        $this->brand = $brand;
152
    }
153
154
    public function getLastFour(): ?string
155
    {
156
        return $this->lastFour;
157
    }
158
159
    public function setLastFour(?string $lastFour): void
160
    {
161
        $this->lastFour = $lastFour;
162
    }
163
164
    public function getExpiryMonth(): ?string
165
    {
166
        return $this->expiryMonth;
167
    }
168
169
    public function setExpiryMonth(?string $expiryMonth): void
170
    {
171
        $this->expiryMonth = $expiryMonth;
172
    }
173
174
    public function getExpiryYear(): ?string
175
    {
176
        return $this->expiryYear;
177
    }
178
179
    public function setExpiryYear(?string $expiryYear): void
180
    {
181
        $this->expiryYear = $expiryYear;
182
    }
183
184
    public function getCreatedAt(): \DateTimeInterface
185
    {
186
        return $this->createdAt;
187
    }
188
189
    public function setCreatedAt(\DateTimeInterface $createdAt): void
190
    {
191
        $this->createdAt = $createdAt;
192
    }
193
194
    public function isDeleted(): bool
195
    {
196
        return $this->deleted;
197
    }
198
199
    public function setDeleted(bool $deleted): void
200
    {
201
        $this->deleted = $deleted;
202
    }
203
204
    public function setDeletedAt(\DateTimeInterface $dateTime): DeletableInterface
205
    {
206
        $this->deletedAt = $dateTime;
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Parthenon\Athena\Entity\DeletableInterface. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
207
    }
208
209
    public function markAsDeleted(): DeletableInterface
210
    {
211
        $this->deletedAt = new \DateTime();
212
        $this->deleted = true;
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Parthenon\Athena\Entity\DeletableInterface. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
213
    }
214
215
    public function unmarkAsDeleted(): DeletableInterface
216
    {
217
        $this->deletedAt = null;
218
        $this->deleted = true;
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return Parthenon\Athena\Entity\DeletableInterface. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
219
    }
220
}
221