13
13
use Magento \Framework \Api \SimpleDataObjectConverter ;
14
14
use Magento \Framework \App \ObjectManager ;
15
15
use Magento \Framework \Exception \InputException ;
16
- use Magento \Framework \Exception \LocalizedException ;
17
16
use Magento \Framework \Exception \SerializationException ;
18
17
use Magento \Framework \ObjectManager \ConfigInterface ;
19
18
use Magento \Framework \ObjectManagerInterface ;
@@ -98,7 +97,7 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface
98
97
private $ defaultPageSize ;
99
98
100
99
/**
101
- * @var DefaultPageSizeSetter
100
+ * @var DefaultPageSizeSetter|null
102
101
*/
103
102
private $ defaultPageSizeSetter ;
104
103
@@ -177,19 +176,19 @@ private function getNameFinder()
177
176
* @param string $serviceMethodName name of the method that we are trying to call
178
177
* @param array $inputArray data to send to method in key-value format
179
178
* @return array list of parameters that can be used to call the service method
180
- * @throws Exception
181
- * @throws LocalizedException
179
+ * @throws WebapiException
182
180
*/
183
181
public function process ($ serviceClassName , $ serviceMethodName , array $ inputArray )
184
182
{
185
183
$ inputData = [];
186
184
$ inputError = [];
187
-
188
185
foreach ($ this ->methodsMap ->getMethodParams ($ serviceClassName , $ serviceMethodName ) as $ param ) {
189
186
$ paramName = $ param [MethodsMap::METHOD_META_NAME ];
190
187
$ snakeCaseParamName = strtolower (preg_replace ("/(?<= \\w)(?=[A-Z])/ " , "_$1 " , $ paramName ));
191
188
if (isset ($ inputArray [$ paramName ]) || isset ($ inputArray [$ snakeCaseParamName ])) {
192
- $ paramValue = $ inputArray [$ paramName ] ?? $ inputArray [$ snakeCaseParamName ];
189
+ $ paramValue = isset ($ inputArray [$ paramName ])
190
+ ? $ inputArray [$ paramName ]
191
+ : $ inputArray [$ snakeCaseParamName ];
193
192
194
193
try {
195
194
$ inputData [] = $ this ->convertValue ($ paramValue , $ param [MethodsMap::METHOD_META_TYPE ]);
@@ -204,9 +203,7 @@ public function process($serviceClassName, $serviceMethodName, array $inputArray
204
203
}
205
204
}
206
205
}
207
-
208
206
$ this ->processInputError ($ inputError );
209
-
210
207
return $ inputData ;
211
208
}
212
209
@@ -217,7 +214,7 @@ public function process($serviceClassName, $serviceMethodName, array $inputArray
217
214
* @param array $data
218
215
* @return array
219
216
* @throws \ReflectionException
220
- * @throws LocalizedException
217
+ * @throws \Magento\Framework\Exception\ LocalizedException
221
218
*/
222
219
private function getConstructorData (string $ className , array $ data ): array
223
220
{
@@ -491,7 +488,7 @@ protected function _createDataObjectForTypeAndArrayValue($type, $customAttribute
491
488
* @param mixed $data
492
489
* @param string $type Convert given value to the this type
493
490
* @return mixed
494
- * @throws LocalizedException
491
+ * @throws \Magento\Framework\Exception\ LocalizedException
495
492
*/
496
493
public function convertValue ($ data , $ type )
497
494
{
0 commit comments