File tree 1 file changed +4
-24
lines changed
1 file changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -53,22 +53,22 @@ class Sale implements SaleInterface
53
53
54
54
protected ?DateTimeImmutable $ closeTime = null ;
55
55
56
- protected ?string $ data = null ;
56
+ protected ?array $ data = null ;
57
57
58
58
public function __construct (
59
59
$ id ,
60
60
TargetInterface $ target ,
61
61
CustomerInterface $ customer ,
62
62
?PlanInterface $ plan = null ,
63
63
?DateTimeImmutable $ time = null ,
64
- $ data = null ,
64
+ ? array $ data = null ,
65
65
) {
66
66
$ this ->id = $ id ;
67
67
$ this ->target = $ target ;
68
68
$ this ->customer = $ customer ;
69
69
$ this ->plan = $ plan ;
70
70
$ this ->time = $ time ?? new DateTimeImmutable ();
71
- $ this ->data = $ this -> setData ( $ data) ;
71
+ $ this ->data = $ data ;
72
72
}
73
73
74
74
public function getId ()
@@ -130,29 +130,9 @@ public function setId($id)
130
130
$ this ->id = $ id ;
131
131
}
132
132
133
- public function setData ($ data ): self
134
- {
135
- if (empty ($ data )) {
136
- $ this ->data = null ;
137
- return $ this ;
138
- }
139
-
140
- if (is_string ($ data ) && json_validate ($ data )) {
141
- $ this ->data = $ data ;
142
- return $ this ;
143
- }
144
-
145
- if (is_array ($ data )) {
146
- $ this ->data = Json::encode ($ data );
147
- return $ this ;
148
- }
149
-
150
- throw new \Exception ("Cannot assign data " );
151
- }
152
-
153
133
public function getData (): ?array
154
134
{
155
- return !empty ($ this ->data ) ? Json:: decode ( $ this ->data , true ) : null ;
135
+ return !empty ($ this ->data ) ? $ this ->data : null ;
156
136
}
157
137
158
138
public function jsonSerialize (): array
You can’t perform that action at this time.
0 commit comments