Conditions | 1 |
Paths | 1 |
Total Lines | 116 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
41 | public function dataDeserialize(): array |
||
42 | { |
||
43 | return [ |
||
44 | [ |
||
45 | AuthCertResponse::class, |
||
46 | json_encode( |
||
47 | [ |
||
48 | 'token' => 'test_token', |
||
49 | ] |
||
50 | ), |
||
51 | new AuthCertResponse( |
||
52 | 'test_token' |
||
53 | ), |
||
54 | ], |
||
55 | [ |
||
56 | FacadeDocListV2Response::class, |
||
57 | json_encode( |
||
58 | [ |
||
59 | 'total' => 25, |
||
60 | 'results' => [ |
||
61 | [ |
||
62 | 'number' => 'b917dfb0-523d-41e0-9e64-e8bf0052c5bd', |
||
63 | 'docDate' => '2019-01-18T06:45:35.630Z', |
||
64 | 'receivedAt' => '2019-01-19T06:45:35.630Z', |
||
65 | 'type' => 'LP_INTRODUCE_GOODS', |
||
66 | 'status' => 'CHECKED_OK', |
||
67 | 'senderName' => 'test', |
||
68 | ], |
||
69 | ], |
||
70 | ] |
||
71 | ), |
||
72 | new FacadeDocListV2Response( |
||
73 | 25, |
||
74 | [ |
||
75 | new FacadeDocListV2ItemResponse( |
||
76 | 'b917dfb0-523d-41e0-9e64-e8bf0052c5bd', |
||
77 | '2019-01-18T06:45:35.630Z', |
||
78 | '2019-01-19T06:45:35.630Z', |
||
79 | 'LP_INTRODUCE_GOODS', |
||
80 | 'CHECKED_OK', |
||
81 | 'test' |
||
82 | ), |
||
83 | ] |
||
84 | ), |
||
85 | ], |
||
86 | [ |
||
87 | FacadeMarkedProductsResponse::class, |
||
88 | json_encode( |
||
89 | [ |
||
90 | 'cis' => 'eb852349-647f-468f-bb90-d26a4d975a88', |
||
91 | 'gtin' => '04630034070029', |
||
92 | 'tnVed' => '6401100000', |
||
93 | 'productName' => 'Product name', |
||
94 | 'ownerName' => 'Owner name', |
||
95 | 'ownerInn' => '0000000000', |
||
96 | 'producerName' => 'Producer name', |
||
97 | 'producerInn' => '0000000000', |
||
98 | 'status' => 'INTRODUCED', |
||
99 | 'emissionDate' => '2019-01-18T08:14:40.344Z', |
||
100 | 'emissionType' => 'LOCAL', |
||
101 | 'statusExt' => 'WAIT_SHIPMENT', |
||
102 | 'withdrawReason' => 'RETAIL', |
||
103 | 'name' => 'Name', |
||
104 | 'brand' => 'Brand', |
||
105 | 'model' => 'Model', |
||
106 | 'certDoc' => [ |
||
107 | 'type' => 'CONFORMITY_CERT', |
||
108 | 'number' => '122', |
||
109 | 'date' => '2019-01-02T20:00:00.000Z', |
||
110 | ], |
||
111 | 'country' => 'РОССИЙСКАЯ ФЕДЕРАЦИЯ', |
||
112 | 'productTypeDesc' => 'ТАПОЧКИ', |
||
113 | 'color' => 'белый', |
||
114 | 'materialDown' => 'Текстиль', |
||
115 | 'productSize' => '52', |
||
116 | 'materialUpper' => 'Текстиль', |
||
117 | 'materialLining' => 'Текстиль', |
||
118 | 'packageType' => 'BOX', |
||
119 | 'productType' => '310000022', |
||
120 | ] |
||
121 | ), |
||
122 | new FacadeMarkedProductsResponse( |
||
123 | 'eb852349-647f-468f-bb90-d26a4d975a88', |
||
124 | '04630034070029', |
||
125 | '6401100000', |
||
126 | 'Product name', |
||
127 | 'Owner name', |
||
128 | '0000000000', |
||
129 | 'Producer name', |
||
130 | '0000000000', |
||
131 | 'INTRODUCED', |
||
132 | '2019-01-18T08:14:40.344Z', |
||
133 | 'LOCAL', |
||
134 | 'WAIT_SHIPMENT', |
||
135 | 'RETAIL', |
||
136 | 'Name', |
||
137 | 'Brand', |
||
138 | 'Model', |
||
139 | new FacadeMarkedProductsCertDoc( |
||
140 | 'CONFORMITY_CERT', |
||
141 | '122', |
||
142 | '2019-01-02T20:00:00.000Z' |
||
143 | ), |
||
144 | 'РОССИЙСКАЯ ФЕДЕРАЦИЯ', |
||
145 | 'ТАПОЧКИ', |
||
146 | 'белый', |
||
147 | 'Текстиль', |
||
148 | '52', |
||
149 | 'Текстиль', |
||
150 | 'Текстиль', |
||
151 | 'BOX', |
||
152 | '310000022' |
||
153 | ) |
||
154 | ], |
||
155 | ]; |
||
156 | } |
||
157 | |||
187 |