Passed
Push — master ( 14435c...49ec85 )
by ma
02:03
created
src/Excel/TWorkSheet.php 1 patch
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -106,7 +106,10 @@  discard block
 block discarded – undo
106 106
         $this->fileTitle = [];
107 107
         $this->data = [];
108 108
         $this->field = [];
109
-        if($this->freezePane) $this->workSheet->freezePane($this->freezePane); //冻结窗格
109
+        if($this->freezePane) {
110
+            $this->workSheet->freezePane($this->freezePane);
111
+        }
112
+        //冻结窗格
110 113
     }
111 114
 
112 115
     /**
@@ -131,7 +134,7 @@  discard block
 block discarded – undo
131 134
             $this->title_row = $fileTitle['title_row']??1;
132 135
             $this->group_left = $fileTitle['group_left']??[];
133 136
             $titleData = $fileTitle['title']??[];
134
-        }else{
137
+        } else{
135 138
             /**
136 139
              *  $fileTitle = [
137 140
              *       '姓名'=>'name',
@@ -142,7 +145,7 @@  discard block
 block discarded – undo
142 145
         // 根据字段映射方式处理 title
143 146
         if ($this->fieldMappingMethod === ConstCode::FIELD_MAPPING_METHOD_FIELD_CORRESPONDING_NAME) {
144 147
             $this->fileTitle = array_flip($titleData);// 字段对应名称方式 - 需要将键值对调
145
-        }else{
148
+        } else{
146 149
             $this->fileTitle = $titleData;// 名称对应字段方式 - 保持原样
147 150
         }
148 151
         $this->data = $data;
@@ -161,7 +164,7 @@  discard block
 block discarded – undo
161 164
                 foreach ($val as $k => $v){
162 165
                     $this->field[] = $v;
163 166
                 }
164
-            }else{
167
+            } else{
165 168
                 $this->field[] = $val;
166 169
             }
167 170
         }
@@ -182,7 +185,7 @@  discard block
 block discarded – undo
182 185
             foreach ($this->data as $key => $val){
183 186
                 $this->excelSetCellValue($val);
184 187
             }
185
-        }else{   //根据设置分组字段进行分组
188
+        } else{   //根据设置分组字段进行分组
186 189
             /** 数据分组 **/
187 190
             $data = [];
188 191
             $group_left_count = count($this->group_left);
@@ -197,13 +200,13 @@  discard block
 block discarded – undo
197 200
                     ];
198 201
                 }
199 202
                 $this->excelGroupLeft($data, $group_left_count);
200
-            }elseif($group_left_count == 2){
203
+            } elseif($group_left_count == 2){
201 204
                 foreach ($this->data as $v) {
202 205
                     $data[$v[$this->group_left[0]]][$v[$this->group_left[1]]][] = $v;
203 206
                 }
204 207
                 $this->data = $this->arrayCount($data);
205 208
                 $this->excelGroupLeft($this->data, $group_left_count);
206
-            }else{
209
+            } else{
207 210
                 throw new TinymengException(StatusCode::COMMON_PARAM_INVALID,
208 211
                     '左侧分组过多,导出失败!'
209 212
                 );
@@ -244,7 +247,7 @@  discard block
 block discarded – undo
244 247
                     $this->workSheet->setCellValue($this->cellName($_cols) . ($this->_row+1), $k);
245 248
                     if(!empty($this->titleWidth)) {
246 249
                         $this->workSheet->getColumnDimension($this->cellName($_cols))->setWidth($this->titleWidth); //列宽度
247
-                    }else{
250
+                    } else{
248 251
                         $this->workSheet->getColumnDimension($this->cellName($_cols))->setAutoSize(true); //自动计算宽度
249 252
                     }
250 253
                     if ($num < count($val)) {
@@ -262,7 +265,7 @@  discard block
 block discarded – undo
262 265
                 $this->workSheet->setCellValue($rowName . $this->_row, $key);//设置值
263 266
                 if(!empty($this->titleWidth)){
264 267
                     $this->workSheet->getColumnDimension($rowName)->setWidth($this->titleWidth); //列宽度
265
-                }else{
268
+                } else{
266 269
                     $this->workSheet->getColumnDimension($rowName)->setAutoSize(true); //自动计算宽度
267 270
                 }
268 271
             }
@@ -293,9 +296,9 @@  discard block
 block discarded – undo
293 296
                 for ($i=0;$i<count($v);$i++){
294 297
                     $content = $content[$v[$i]]??'';
295 298
                 }
296
-            }elseif($v == '_id'){
299
+            } elseif($v == '_id'){
297 300
                 $content = $this->_row-$this->title_row;//自增序号列
298
-            }else{
301
+            } else{
299 302
                 $content = ($val[$v]??'');
300 303
             }
301 304
             if(is_array($content) && isset($content['type']) && isset($content['content'])){
@@ -319,15 +322,15 @@  discard block
 block discarded – undo
319 322
                     $drawing->setCoordinates($rowName.$this->_row);
320 323
                     $drawing->setWorksheet($this->workSheet);
321 324
                 }
322
-            }else {
325
+            } else {
323 326
                 $content = $this->formatValue($content);//格式化数据
324 327
                 if (is_numeric($content)){
325 328
                     if($this->autoDataType && strlen($content)<11){
326 329
                         $this->workSheet->setCellValueExplicit($rowName.$this->_row, $content,DataType::TYPE_NUMERIC);
327
-                    }else{
330
+                    } else{
328 331
                         $this->workSheet->setCellValueExplicit($rowName.$this->_row, $content,DataType::TYPE_STRING2);
329 332
                     }
330
-                }else{
333
+                } else{
331 334
                     $this->workSheet->setCellValueExplicit($rowName.$this->_row, $content,DataType::TYPE_STRING2);
332 335
                 }
333 336
             }
@@ -369,7 +372,7 @@  discard block
 block discarded – undo
369 372
                 foreach ($val['data'] as $data){
370 373
                     $this->excelSetCellValue($data);
371 374
                 }
372
-            }else{
375
+            } else{
373 376
                 $sub_group_start = $this->_row;
374 377
                 $rowName = $this->cellName($group_field_positions[1]); // 使用第二个分组字段的实际位置
375 378
                 
Please login to merge, or discard this patch.