@@ -41,22 +41,23 @@ public function execute(
41
41
42
42
if ($ payloadCount === 0 || $ payloadCount === 1 ) {
43
43
$ properties = $ pipeline ->execute ($ payloads [0 ] ?? [], $ creationContext );
44
- } else {
45
- $ properties = [];
46
44
47
- foreach ($ payloads as $ payload ) {
48
- foreach ($ pipeline ->execute ($ payload , $ creationContext ) as $ key => $ value ) {
49
- if (array_key_exists ($ key , $ properties ) && ($ value === null || $ value instanceof Optional)) {
50
- continue ;
51
- }
45
+ return $ this ->dataFromArray ($ class , $ creationContext , $ payloads , $ properties );
46
+ }
47
+
48
+ $ properties = [];
52
49
53
- $ properties [$ key ] = $ value ;
50
+ foreach ($ payloads as $ payload ) {
51
+ foreach ($ pipeline ->execute ($ payload , $ creationContext ) as $ key => $ value ) {
52
+ if (array_key_exists ($ key , $ properties ) && ($ value === null || $ value instanceof Optional)) {
53
+ continue ;
54
54
}
55
+
56
+ $ properties [$ key ] = $ value ;
55
57
}
56
58
}
57
59
58
- return $ this ->propertyMorphedData ($ class , $ creationContext , $ payloads , $ properties )
59
- ?? $ this ->dataFromArrayResolver ->execute ($ class , $ properties );
60
+ return $ this ->dataFromArray ($ class , $ creationContext , $ payloads , $ properties );
60
61
}
61
62
62
63
protected function createFromCustomCreationMethod (
@@ -117,12 +118,12 @@ protected function createFromCustomCreationMethod(
117
118
return $ class ::$ methodName (...$ payloads );
118
119
}
119
120
120
- protected function propertyMorphedData (
121
+ protected function dataFromArray (
121
122
string $ class ,
122
123
CreationContext $ creationContext ,
123
124
array $ payloads ,
124
125
array $ properties ,
125
- ): ? BaseData {
126
+ ): BaseData {
126
127
$ dataClass = $ this ->dataConfig ->getDataClass ($ class );
127
128
128
129
if ($ dataClass ->isAbstract && $ dataClass ->propertyMorphable ) {
@@ -134,6 +135,6 @@ protected function propertyMorphedData(
134
135
}
135
136
}
136
137
137
- return null ;
138
+ return $ this -> dataFromArrayResolver -> execute ( $ class , $ properties ) ;
138
139
}
139
140
}
0 commit comments