1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Integracao\ControlPay\Model; |
4
|
|
|
use Integracao\ControlPay\Helpers\SerializerHelper; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class ContaRecebimento |
8
|
|
|
* @package Integracao\ControlPay\Model |
9
|
|
|
*/ |
10
|
|
|
class ContaRecebimento implements \JsonSerializable |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var integer |
14
|
|
|
*/ |
15
|
|
|
private $id; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var Pessoa |
19
|
|
|
*/ |
20
|
|
|
private $pessoa; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var double |
24
|
|
|
*/ |
25
|
|
|
private $saldoAtual; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var \DateTime |
29
|
|
|
*/ |
30
|
|
|
private $dataInsercao; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var array |
34
|
|
|
*/ |
35
|
|
|
private $contaRecebimentoLancamentos; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* ContaRecebimento constructor. |
39
|
|
|
*/ |
40
|
|
|
public function __construct() |
41
|
|
|
{ |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return int |
46
|
|
|
*/ |
47
|
|
|
public function getId() |
48
|
|
|
{ |
49
|
|
|
return $this->id; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param int $id |
54
|
|
|
* @return ContaRecebimento |
55
|
|
|
*/ |
56
|
|
|
public function setId($id) |
57
|
|
|
{ |
58
|
|
|
$this->id = $id; |
59
|
|
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return Pessoa |
64
|
|
|
*/ |
65
|
|
|
public function getPessoa() |
66
|
|
|
{ |
67
|
|
|
return $this->pessoa; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param Pessoa $pessoa |
72
|
|
|
* @return ContaRecebimento |
73
|
|
|
*/ |
74
|
|
|
public function setPessoa($pessoa) |
75
|
|
|
{ |
76
|
|
|
$this->pessoa = $pessoa; |
77
|
|
|
|
78
|
|
|
if(is_array($this->pessoa)) |
79
|
|
|
$this->pessoa = SerializerHelper::denormalize($pessoa, Pessoa::class); |
80
|
|
|
|
81
|
|
|
return $this; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return float |
86
|
|
|
*/ |
87
|
|
|
public function getSaldoAtual() |
88
|
|
|
{ |
89
|
|
|
return $this->saldoAtual; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param float $saldoAtual |
94
|
|
|
* @return ContaRecebimento |
95
|
|
|
*/ |
96
|
|
|
public function setSaldoAtual($saldoAtual) |
97
|
|
|
{ |
98
|
|
|
$this->saldoAtual = $saldoAtual; |
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return \DateTime |
104
|
|
|
*/ |
105
|
|
|
public function getDataInsercao() |
106
|
|
|
{ |
107
|
|
|
return $this->dataInsercao; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param \DateTime $dataInsercao |
112
|
|
|
* @return ContaRecebimento |
113
|
|
|
*/ |
114
|
|
|
public function setDataInsercao($dataInsercao) |
115
|
|
|
{ |
116
|
|
|
$this->dataInsercao = \DateTime::createFromFormat('d/m/Y H:i:s.u', $dataInsercao); |
|
|
|
|
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return array |
122
|
|
|
*/ |
123
|
|
|
public function getContaRecebimentoLancamentos() |
124
|
|
|
{ |
125
|
|
|
return $this->contaRecebimentoLancamentos; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param array $contaRecebimentoLancamentos |
130
|
|
|
* @return ContaRecebimento |
131
|
|
|
*/ |
132
|
|
|
public function setContaRecebimentoLancamentos($contaRecebimentoLancamentos) |
133
|
|
|
{ |
134
|
|
|
|
135
|
|
|
foreach ($contaRecebimentoLancamentos as $contaRecebimentoLancamento) |
136
|
|
|
{ |
137
|
|
|
$this->contaRecebimentoLancamentos[] = SerializerHelper::denormalize( |
138
|
|
|
$contaRecebimentoLancamento, ContaRecebimentoLancamento::class); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
function jsonSerialize() |
145
|
|
|
{ |
146
|
|
|
return [ |
147
|
|
|
'id' => $this->id, |
148
|
|
|
'pessoa' => $this->pessoa, |
149
|
|
|
'saldoAtual' => $this->saldoAtual, |
150
|
|
|
'dataInsercao' => $this->dataInsercao, |
151
|
|
|
'contaRecebimentoLancamentos' => $this->contaRecebimentoLancamentos, |
152
|
|
|
]; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
|
156
|
|
|
} |
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 theid
property of an instance of theAccount
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.