GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( 3622e1...27b5b8 )
by
unknown
05:51
created

BatchInsertItems   B

Complexity

Total Complexity 43

Size/Duplication

Total Lines 138
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 43
eloc 86
dl 0
loc 138
c 0
b 0
f 0
rs 8.96

1 Method

Rating   Name   Duplication   Size   Complexity  
D withItemInfo() 0 130 43

How to fix   Complexity   

Complex Class

Complex classes like BatchInsertItems often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use BatchInsertItems, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace AlibabaCloud\Cloudesl\V20180801;
4
5
use AlibabaCloud\Client\Resolver\ApiResolver;
6
7
/**
8
 * @method ActivateApService activateApService(array $options = [])
9
 * @method ActivateApService2 activateApService2(array $options = [])
10
 * @method BatchInsertItems batchInsertItems(array $options = [])
11
 * @method BindApStoreService bindApStoreService(array $options = [])
12
 * @method BindEslDevice bindEslDevice(array $options = [])
13
 * @method BindEslDeviceShelf bindEslDeviceShelf(array $options = [])
14
 * @method CreateStore createStore(array $options = [])
15
 * @method DeleteApService deleteApService(array $options = [])
16
 * @method DeleteEslDevice deleteEslDevice(array $options = [])
17
 * @method DeleteItem deleteItem(array $options = [])
18
 * @method DeleteItemBySkuId deleteItemBySkuId(array $options = [])
19
 * @method DeleteStore deleteStore(array $options = [])
20
 * @method DescribeAlarms describeAlarms(array $options = [])
21
 * @method DescribeCompany describeCompany(array $options = [])
22
 * @method DescribeEslDevices describeEslDevices(array $options = [])
23
 * @method DescribeItems describeItems(array $options = [])
24
 * @method DescribeStores describeStores(array $options = [])
25
 * @method DescribeUserOperationLog describeUserOperationLog(array $options = [])
26
 * @method DescribeUserRamPolicy describeUserRamPolicy(array $options = [])
27
 * @method SearchApService searchApService(array $options = [])
28
 * @method UnbindEslDevice unbindEslDevice(array $options = [])
29
 * @method UnbindEslDeviceShelf unbindEslDeviceShelf(array $options = [])
30
 * @method UpdateStore updateStore(array $options = [])
31
 */
32
class CloudeslApiResolver extends ApiResolver
33
{
34
}
35
36
class Rpc extends \AlibabaCloud\Client\Resolver\Rpc
37
{
38
    /** @var string */
39
    public $product = 'cloudesl';
40
41
    /** @var string */
42
    public $version = '2018-08-01';
43
44
    /** @var string */
45
    public $method = 'POST';
46
47
    /** @var string */
48
    public $serviceCode = 'cloudesl';
49
}
50
51
/**
52
 * @method string getApMac()
53
 * @method $this withApMac($value)
54
 * @method string getStoreId()
55
 * @method $this withStoreId($value)
56
 */
57
class ActivateApService extends Rpc
58
{
59
}
60
61
/**
62
 * @method string getApMac()
63
 * @method $this withApMac($value)
64
 * @method string getStoreId()
65
 * @method $this withStoreId($value)
66
 */
67
class ActivateApService2 extends Rpc
68
{
69
}
70
71
/**
72
 * @method string getStoreId()
73
 * @method $this withStoreId($value)
74
 * @method array getItemInfo()
75
 */
76
class BatchInsertItems extends Rpc
77
{
78
79
    /**
80
     * @param array $itemInfo
81
     *
82
     * @return $this
83
     */
84
	public function withItemInfo(array $itemInfo)
85
	{
86
	    $this->data['ItemInfo'] = $itemInfo;
87
		foreach ($itemInfo as $depth1 => $depth1Value) {
88
			if(isset($depth1Value['MemberPrice'])){
89
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.MemberPrice'] = $depth1Value['MemberPrice'];
90
			}
91
			if(isset($depth1Value['ActionPrice'])){
92
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ActionPrice'] = $depth1Value['ActionPrice'];
93
			}
94
			if(isset($depth1Value['ProductionPlace'])){
95
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ProductionPlace'] = $depth1Value['ProductionPlace'];
96
			}
97
			if(isset($depth1Value['BeSourceCode'])){
98
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.BeSourceCode'] = $depth1Value['BeSourceCode'];
99
			}
100
			if(isset($depth1Value['StoreId'])){
101
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.StoreId'] = $depth1Value['StoreId'];
102
			}
103
			if(isset($depth1Value['BrandName'])){
104
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.BrandName'] = $depth1Value['BrandName'];
105
			}
106
			if(isset($depth1Value['PromotionStart'])){
107
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PromotionStart'] = $depth1Value['PromotionStart'];
108
			}
109
			if(isset($depth1Value['SourceCode'])){
110
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.SourceCode'] = $depth1Value['SourceCode'];
111
			}
112
			if(isset($depth1Value['ItemId'])){
113
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemId'] = $depth1Value['ItemId'];
114
			}
115
			if(isset($depth1Value['ExtraAttribute'])){
116
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ExtraAttribute'] = $depth1Value['ExtraAttribute'];
117
			}
118
			if(isset($depth1Value['CompanyId'])){
119
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CompanyId'] = $depth1Value['CompanyId'];
120
			}
121
			if(isset($depth1Value['PriceUnit'])){
122
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PriceUnit'] = $depth1Value['PriceUnit'];
123
			}
124
			if(isset($depth1Value['Rank'])){
125
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.Rank'] = $depth1Value['Rank'];
126
			}
127
			if(isset($depth1Value['ItemBarCode'])){
128
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemBarCode'] = $depth1Value['ItemBarCode'];
129
			}
130
			if(isset($depth1Value['BePromotion'])){
131
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.BePromotion'] = $depth1Value['BePromotion'];
132
			}
133
			if(isset($depth1Value['PromotionEnd'])){
134
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PromotionEnd'] = $depth1Value['PromotionEnd'];
135
			}
136
			if(isset($depth1Value['ItemTitle'])){
137
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemTitle'] = $depth1Value['ItemTitle'];
138
			}
139
			if(isset($depth1Value['OriginalPrice'])){
140
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.OriginalPrice'] = $depth1Value['OriginalPrice'];
141
			}
142
			if(isset($depth1Value['ItemShortTitle'])){
143
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemShortTitle'] = $depth1Value['ItemShortTitle'];
144
			}
145
			if(isset($depth1Value['CustomizeFeatureC'])){
146
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureC'] = $depth1Value['CustomizeFeatureC'];
147
			}
148
			if(isset($depth1Value['ItemQrCode'])){
149
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemQrCode'] = $depth1Value['ItemQrCode'];
150
			}
151
			if(isset($depth1Value['CustomizeFeatureD'])){
152
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureD'] = $depth1Value['CustomizeFeatureD'];
153
			}
154
			if(isset($depth1Value['PromotionReason'])){
155
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PromotionReason'] = $depth1Value['PromotionReason'];
156
			}
157
			if(isset($depth1Value['CustomizeFeatureE'])){
158
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureE'] = $depth1Value['CustomizeFeatureE'];
159
			}
160
			if(isset($depth1Value['CustomizeFeatureF'])){
161
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureF'] = $depth1Value['CustomizeFeatureF'];
162
			}
163
			if(isset($depth1Value['ForestSecondId'])){
164
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ForestSecondId'] = $depth1Value['ForestSecondId'];
165
			}
166
			if(isset($depth1Value['CustomizeFeatureG'])){
167
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureG'] = $depth1Value['CustomizeFeatureG'];
168
			}
169
			if(isset($depth1Value['CustomizeFeatureH'])){
170
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureH'] = $depth1Value['CustomizeFeatureH'];
171
			}
172
			if(isset($depth1Value['CustomizeFeatureI'])){
173
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureI'] = $depth1Value['CustomizeFeatureI'];
174
			}
175
			if(isset($depth1Value['CustomizeFeatureJ'])){
176
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureJ'] = $depth1Value['CustomizeFeatureJ'];
177
			}
178
			if(isset($depth1Value['OptionGroups'])){
179
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.OptionGroups'] = $depth1Value['OptionGroups'];
180
			}
181
			if(isset($depth1Value['ModelNumber'])){
182
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ModelNumber'] = $depth1Value['ModelNumber'];
183
			}
184
			if(isset($depth1Value['SaleSpec'])){
185
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.SaleSpec'] = $depth1Value['SaleSpec'];
186
			}
187
			if(isset($depth1Value['CustomizeFeatureA'])){
188
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureA'] = $depth1Value['CustomizeFeatureA'];
189
			}
190
			if(isset($depth1Value['CustomizeFeatureB'])){
191
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureB'] = $depth1Value['CustomizeFeatureB'];
192
			}
193
			if(isset($depth1Value['SuggestPrice'])){
194
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.SuggestPrice'] = $depth1Value['SuggestPrice'];
195
			}
196
			if(isset($depth1Value['ForestFirstId'])){
197
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ForestFirstId'] = $depth1Value['ForestFirstId'];
198
			}
199
			if(isset($depth1Value['CategoryName'])){
200
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CategoryName'] = $depth1Value['CategoryName'];
201
			}
202
			if(isset($depth1Value['EnergyEfficiency'])){
203
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.EnergyEfficiency'] = $depth1Value['EnergyEfficiency'];
204
			}
205
			if(isset($depth1Value['SkuId'])){
206
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.SkuId'] = $depth1Value['SkuId'];
207
			}
208
			if(isset($depth1Value['PromotionText'])){
209
				$this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PromotionText'] = $depth1Value['PromotionText'];
210
			}
211
		}
212
213
		return $this;
214
    }
215
}
216
217
/**
218
 * @method string getApMac()
219
 * @method $this withApMac($value)
220
 * @method string getStoreId()
221
 * @method $this withStoreId($value)
222
 */
223
class BindApStoreService extends Rpc
224
{
225
}
226
227
/**
228
 * @method string getStoreId()
229
 * @method $this withStoreId($value)
230
 * @method string getEslBarCode()
231
 * @method $this withEslBarCode($value)
232
 * @method string getItemBarCode()
233
 * @method $this withItemBarCode($value)
234
 */
235
class BindEslDevice extends Rpc
236
{
237
}
238
239
/**
240
 * @method string getStoreId()
241
 * @method $this withStoreId($value)
242
 * @method string getShelfCode()
243
 * @method $this withShelfCode($value)
244
 * @method string getEslBarCode()
245
 * @method $this withEslBarCode($value)
246
 */
247
class BindEslDeviceShelf extends Rpc
248
{
249
}
250
251
/**
252
 * @method string getStoreName()
253
 * @method $this withStoreName($value)
254
 * @method string getParentId()
255
 * @method $this withParentId($value)
256
 * @method string getCompanyId()
257
 * @method $this withCompanyId($value)
258
 * @method string getBrand()
259
 * @method $this withBrand($value)
260
 * @method string getComments()
261
 * @method $this withComments($value)
262
 * @method string getGroups()
263
 * @method $this withGroups($value)
264
 * @method string getPhone()
265
 * @method $this withPhone($value)
266
 * @method string getOutId()
267
 * @method $this withOutId($value)
268
 */
269
class CreateStore extends Rpc
270
{
271
}
272
273
/**
274
 * @method string getApMac()
275
 * @method $this withApMac($value)
276
 * @method string getStoreId()
277
 * @method $this withStoreId($value)
278
 */
279
class DeleteApService extends Rpc
280
{
281
}
282
283
/**
284
 * @method string getStoreId()
285
 * @method $this withStoreId($value)
286
 * @method string getEslBarCode()
287
 * @method $this withEslBarCode($value)
288
 */
289
class DeleteEslDevice extends Rpc
290
{
291
}
292
293
/**
294
 * @method string getStoreId()
295
 * @method $this withStoreId($value)
296
 * @method string getItemBarCode()
297
 * @method $this withItemBarCode($value)
298
 */
299
class DeleteItem extends Rpc
300
{
301
}
302
303
/**
304
 * @method string getStoreId()
305
 * @method $this withStoreId($value)
306
 * @method string getSkuId()
307
 * @method $this withSkuId($value)
308
 */
309
class DeleteItemBySkuId extends Rpc
310
{
311
}
312
313
/**
314
 * @method string getStoreId()
315
 * @method $this withStoreId($value)
316
 */
317
class DeleteStore extends Rpc
318
{
319
}
320
321
/**
322
 * @method string getStoreId()
323
 * @method $this withStoreId($value)
324
 * @method string getPageNumber()
325
 * @method $this withPageNumber($value)
326
 * @method string getFromAlarmTime()
327
 * @method $this withFromAlarmTime($value)
328
 * @method string getPageSize()
329
 * @method $this withPageSize($value)
330
 * @method string getToAlarmTime()
331
 * @method $this withToAlarmTime($value)
332
 * @method string getAlarmType()
333
 * @method $this withAlarmType($value)
334
 * @method string getAlarmStatus()
335
 * @method $this withAlarmStatus($value)
336
 * @method string getErrorType()
337
 * @method $this withErrorType($value)
338
 * @method string getAlarmId()
339
 * @method $this withAlarmId($value)
340
 */
341
class DescribeAlarms extends Rpc
342
{
343
}
344
345
class DescribeCompany extends Rpc
346
{
347
}
348
349
/**
350
 * @method string getStoreId()
351
 * @method $this withStoreId($value)
352
 * @method string getType()
353
 * @method $this withType($value)
354
 * @method string getMac()
355
 * @method $this withMac($value)
356
 * @method string getPageNumber()
357
 * @method $this withPageNumber($value)
358
 * @method string getEslBarCode()
359
 * @method $this withEslBarCode($value)
360
 * @method string getVendor()
361
 * @method $this withVendor($value)
362
 * @method string getPageSize()
363
 * @method $this withPageSize($value)
364
 * @method string getItemBarCode()
365
 * @method $this withItemBarCode($value)
366
 * @method string getEslStatus()
367
 * @method $this withEslStatus($value)
368
 * @method string getToBatteryLevel()
369
 * @method $this withToBatteryLevel($value)
370
 * @method string getFromBatteryLevel()
371
 * @method $this withFromBatteryLevel($value)
372
 * @method string getShelfCode()
373
 * @method $this withShelfCode($value)
374
 * @method string getBeBind()
375
 * @method $this withBeBind($value)
376
 */
377
class DescribeEslDevices extends Rpc
378
{
379
}
380
381
/**
382
 * @method string getStoreId()
383
 * @method $this withStoreId($value)
384
 * @method string getPageNumber()
385
 * @method $this withPageNumber($value)
386
 * @method string getItemId()
387
 * @method $this withItemId($value)
388
 * @method string getPageSize()
389
 * @method $this withPageSize($value)
390
 * @method string getItemBarCode()
391
 * @method $this withItemBarCode($value)
392
 * @method string getBePromotion()
393
 * @method $this withBePromotion($value)
394
 * @method string getItemTitle()
395
 * @method $this withItemTitle($value)
396
 * @method string getShelfCode()
397
 * @method $this withShelfCode($value)
398
 * @method string getSkuId()
399
 * @method $this withSkuId($value)
400
 */
401
class DescribeItems extends Rpc
402
{
403
}
404
405
/**
406
 * @method string getStoreName()
407
 * @method $this withStoreName($value)
408
 * @method string getStoreId()
409
 * @method $this withStoreId($value)
410
 * @method string getPageNumber()
411
 * @method $this withPageNumber($value)
412
 * @method string getFromDate()
413
 * @method $this withFromDate($value)
414
 * @method string getToDate()
415
 * @method $this withToDate($value)
416
 * @method string getPageSize()
417
 * @method $this withPageSize($value)
418
 * @method string getBrand()
419
 * @method $this withBrand($value)
420
 * @method string getGroups()
421
 * @method $this withGroups($value)
422
 */
423
class DescribeStores extends Rpc
424
{
425
}
426
427
/**
428
 * @method string getOperateUserId()
429
 * @method $this withOperateUserId($value)
430
 * @method string getStoreId()
431
 * @method $this withStoreId($value)
432
 * @method string getPageNumber()
433
 * @method $this withPageNumber($value)
434
 * @method string getFromDate()
435
 * @method $this withFromDate($value)
436
 * @method string getItemId()
437
 * @method $this withItemId($value)
438
 * @method string getToDate()
439
 * @method $this withToDate($value)
440
 * @method string getEslBarCode()
441
 * @method $this withEslBarCode($value)
442
 * @method string getPageSize()
443
 * @method $this withPageSize($value)
444
 * @method string getItemBarCode()
445
 * @method $this withItemBarCode($value)
446
 * @method string getItemTitle()
447
 * @method $this withItemTitle($value)
448
 * @method string getOperateStatus()
449
 * @method $this withOperateStatus($value)
450
 * @method string getReverse()
451
 * @method $this withReverse($value)
452
 * @method string getOperateType()
453
 * @method $this withOperateType($value)
454
 */
455
class DescribeUserOperationLog extends Rpc
456
{
457
}
458
459
/**
460
 * @method string getUserType()
461
 * @method $this withUserType($value)
462
 * @method string getStoreId()
463
 * @method $this withStoreId($value)
464
 * @method string getCompanyId()
465
 * @method $this withCompanyId($value)
466
 */
467
class DescribeUserRamPolicy extends Rpc
468
{
469
}
470
471
/**
472
 * @method string getApMac()
473
 * @method $this withApMac($value)
474
 * @method string getStoreId()
475
 * @method $this withStoreId($value)
476
 * @method string getPageNumber()
477
 * @method $this withPageNumber($value)
478
 * @method string getPageSize()
479
 * @method $this withPageSize($value)
480
 * @method string getActivated()
481
 * @method $this withActivated($value)
482
 */
483
class SearchApService extends Rpc
484
{
485
}
486
487
/**
488
 * @method string getStoreId()
489
 * @method $this withStoreId($value)
490
 * @method string getEslBarCode()
491
 * @method $this withEslBarCode($value)
492
 * @method string getItemBarCode()
493
 * @method $this withItemBarCode($value)
494
 */
495
class UnbindEslDevice extends Rpc
496
{
497
}
498
499
/**
500
 * @method string getStoreId()
501
 * @method $this withStoreId($value)
502
 * @method string getEslBarCode()
503
 * @method $this withEslBarCode($value)
504
 */
505
class UnbindEslDeviceShelf extends Rpc
506
{
507
}
508
509
/**
510
 * @method string getComments()
511
 * @method $this withComments($value)
512
 * @method string getStoreName()
513
 * @method $this withStoreName($value)
514
 * @method string getGroups()
515
 * @method $this withGroups($value)
516
 * @method string getStoreId()
517
 * @method $this withStoreId($value)
518
 * @method string getPhone()
519
 * @method $this withPhone($value)
520
 * @method string getOutId()
521
 * @method $this withOutId($value)
522
 * @method string getBrand()
523
 * @method $this withBrand($value)
524
 */
525
class UpdateStore extends Rpc
526
{
527
}
528