ContaRecebimentoLancamento::setIntencaoVenda()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Integracao\ControlPay\Model;
4
use Integracao\ControlPay\Helpers\SerializerHelper;
5
6
/**
7
 * Class ContaRecebimentoLancamento
8
 * @package Integracao\ControlPay\Model
9
 */
10
class ContaRecebimentoLancamento implements \JsonSerializable
11
{
12
    /**
13
     * @var integer
14
     */
15
    private $id;
16
17
    /**
18
     * @var ContaRecebimento
19
     */
20
    private $contaRecebimento;
21
22
    /**
23
     * @var ContaPayLancamento
24
     */
25
    private $contaPayLancamento;
26
27
    /**
28
     * @var Pagamento
29
     */
30
    private $pagamento;
31
32
    /**
33
     * @var LancamentoTipo
34
     */
35
    private $lancamentoTipo;
36
37
    /**
38
     * @var \DateTime
39
     */
40
    private $data;
41
42
    /**
43
     * @var double
44
     */
45
    private $valorBruto;
46
47
    /**
48
     * @var double
49
     */
50
    private $valorLiquido;
51
52
    /**
53
     * @var double
54
     */
55
    private $tarifaValor;
56
57
    /**
58
     * @var double
59
     */
60
    private $tarifaPercentual;
61
62
    /**
63
     * @var IntencaoVenda
64
     */
65
    private $intencaoVenda;
66
67
    /**
68
     * ContaRecebimentoLancamento constructor.
69
     */
70
    public function __construct()
71
    {
72
    }
73
74
    /**
75
     * @return int
76
     */
77
    public function getId()
78
    {
79
        return $this->id;
80
    }
81
82
    /**
83
     * @param int $id
84
     * @return ContaRecebimentoLancamento
85
     */
86
    public function setId($id)
87
    {
88
        $this->id = $id;
89
        return $this;
90
    }
91
92
    /**
93
     * @return ContaRecebimento
94
     */
95
    public function getContaRecebimento()
96
    {
97
        return $this->contaRecebimento;
98
    }
99
100
    /**
101
     * @param ContaRecebimento $contaRecebimento
102
     * @return ContaRecebimentoLancamento
103
     */
104
    public function setContaRecebimento($contaRecebimento)
105
    {
106
        $this->contaRecebimento = $contaRecebimento;
107
108
        if(is_array($this->contaRecebimento))
109
            $this->contaRecebimento = SerializerHelper::denormalize($this->contaRecebimento, ContaRecebimento::class);
110
111
        return $this;
112
    }
113
114
    /**
115
     * @return ContaPayLancamento
116
     */
117
    public function getContaPayLancamento()
118
    {
119
        return $this->contaPayLancamento;
120
    }
121
122
    /**
123
     * @param ContaPayLancamento $contaPayLancamento
124
     * @return ContaRecebimentoLancamento
125
     */
126
    public function setContaPayLancamento($contaPayLancamento)
127
    {
128
        $this->contaPayLancamento = $contaPayLancamento;
129
130
        if(is_array($this->contaPayLancamento))
131
            $this->contaPayLancamento = SerializerHelper::denormalize($this->contaPayLancamento, ContaPayLancamento::class);
132
133
        return $this;
134
    }
135
136
    /**
137
     * @return Pagamento
138
     */
139
    public function getPagamento()
140
    {
141
        return $this->pagamento;
142
    }
143
144
    /**
145
     * @param Pagamento $pagamento
146
     * @return ContaRecebimentoLancamento
147
     */
148
    public function setPagamento($pagamento)
149
    {
150
        $this->pagamento = $pagamento;
151
152
        if(is_array($this->pagamento))
153
            $this->pagamento = SerializerHelper::denormalize($this->pagamento, Pagamento::class);
154
155
        return $this;
156
    }
157
158
    /**
159
     * @return LancamentoTipo
160
     */
161
    public function getLancamentoTipo()
162
    {
163
        return $this->lancamentoTipo;
164
    }
165
166
    /**
167
     * @param LancamentoTipo $lancamentoTipo
168
     * @return ContaRecebimentoLancamento
169
     */
170
    public function setLancamentoTipo($lancamentoTipo)
171
    {
172
        $this->lancamentoTipo = $lancamentoTipo;
173
174
        if(is_array($this->lancamentoTipo))
175
            $this->lancamentoTipo = SerializerHelper::denormalize($this->lancamentoTipo, LancamentoTipo::class);
176
177
        return $this;
178
    }
179
180
    /**
181
     * @return \DateTime
182
     */
183
    public function getData()
184
    {
185
        return $this->data;
186
    }
187
188
    /**
189
     * @param \DateTime $data
190
     * @return ContaRecebimentoLancamento
191
     */
192
    public function setData($data)
193
    {
194
        $this->data = \DateTime::createFromFormat('d/m/Y H:i:s.u', $data);
0 ignored issues
show
Documentation Bug introduced by
It seems like \DateTime::createFromFor...'d/m/Y H:i:s.u', $data) can also be of type false. However, the property $data is declared as type object<DateTime>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
195
        return $this;
196
    }
197
198
    /**
199
     * @return float
200
     */
201
    public function getValorBruto()
202
    {
203
        return $this->valorBruto;
204
    }
205
206
    /**
207
     * @param float $valorBruto
208
     * @return ContaRecebimentoLancamento
209
     */
210
    public function setValorBruto($valorBruto)
211
    {
212
        $this->valorBruto = $valorBruto;
213
        return $this;
214
    }
215
216
    /**
217
     * @return float
218
     */
219
    public function getValorLiquido()
220
    {
221
        return $this->valorLiquido;
222
    }
223
224
    /**
225
     * @param float $valorLiquido
226
     * @return ContaRecebimentoLancamento
227
     */
228
    public function setValorLiquido($valorLiquido)
229
    {
230
        $this->valorLiquido = $valorLiquido;
231
        return $this;
232
    }
233
234
    /**
235
     * @return float
236
     */
237
    public function getTarifaValor()
238
    {
239
        return $this->tarifaValor;
240
    }
241
242
    /**
243
     * @param float $tarifaValor
244
     * @return ContaRecebimentoLancamento
245
     */
246
    public function setTarifaValor($tarifaValor)
247
    {
248
        $this->tarifaValor = $tarifaValor;
249
        return $this;
250
    }
251
252
    /**
253
     * @return float
254
     */
255
    public function getTarifaPercentual()
256
    {
257
        return $this->tarifaPercentual;
258
    }
259
260
    /**
261
     * @param float $tarifaPercentual
262
     * @return ContaRecebimentoLancamento
263
     */
264
    public function setTarifaPercentual($tarifaPercentual)
265
    {
266
        $this->tarifaPercentual = $tarifaPercentual;
267
        return $this;
268
    }
269
270
    /**
271
     * @return IntencaoVenda
272
     */
273
    public function getIntencaoVenda()
274
    {
275
        return $this->intencaoVenda;
276
    }
277
278
    /**
279
     * @param IntencaoVenda $intencaoVenda
280
     * @return ContaRecebimentoLancamento
281
     */
282
    public function setIntencaoVenda($intencaoVenda)
283
    {
284
        $this->intencaoVenda = $intencaoVenda;
285
286
        if(is_array($this->intencaoVenda))
287
            $this->intencaoVenda = SerializerHelper::denormalize($this->intencaoVenda, IntencaoVenda::class);
288
289
        return $this;
290
    }
291
292
    function jsonSerialize()
293
    {
294
        return [
295
            'id' => $this->id,
296
            'contaPayLancamento' => $this->contaPayLancamento,
297
            'contaRecebimento' => $this->contaRecebimento,
298
            'data' => $this->data,
299
            'intencaoVenda' => $this->intencaoVenda,
300
            'lancamentoTipo' => $this->lancamentoTipo,
301
            'pagamento' => $this->pagamento,
302
            'tarifaPercentual' => $this->tarifaPercentual,
303
            'tarifaValor' => $this->tarifaValor,
304
            'valorBruto' => $this->valorBruto,
305
            'valorLiquido' => $this->valorLiquido,
306
        ];
307
    }
308
309
310
}