Completed
Branch master (d475ac)
by Once
02:59
created
src/XlsxWriter.class.php 2 patches
Spacing   +30 added lines, -32 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     public function writeToFile($filename)
190 190
     {
191 191
         foreach ($this->sheets as $sheetName => $sheet) {
192
-            self::finalizeSheet($sheetName);//making sure all footers have been written
192
+            self::finalizeSheet($sheetName); //making sure all footers have been written
193 193
         }
194 194
 
195 195
         if (file_exists($filename)) {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             $zip->addFile($sheet->filename, "xl/worksheets/" . $sheet->xmlname);
217 217
         }
218 218
         $zip->addFromString("xl/workbook.xml", XlsxBuilder::buildWorkbookXML($this->sheets));
219
-        $zip->addFile($this->writeStylesXML(), "xl/styles.xml");  //$zip->addFromString("xl/styles.xml", self::buildStylesXML() );
219
+        $zip->addFile($this->writeStylesXML(), "xl/styles.xml"); //$zip->addFromString("xl/styles.xml", self::buildStylesXML() );
220 220
         $zip->addFromString("[Content_Types].xml", XlsxBuilder::buildContentTypesXML($this->sheets));
221 221
         $zip->addEmptyDir("xl/_rels/");
222 222
         $zip->addFromString("xl/_rels/workbook.xml.rels", self::buildWorkbookRelsXML());
@@ -242,8 +242,7 @@  discard block
 block discarded – undo
242 242
             );
243 243
             foreach ($headerRow as $c => $v) {
244 244
                 $cellStyleIdx = empty($style) ?
245
-                    $sheet->columns[$c]['default_cell_style'] :
246
-                    $this->addCellStyle('GENERAL', json_encode(isset($style[0]) ? $style[$c] : $style));
245
+                    $sheet->columns[$c]['default_cell_style'] : $this->addCellStyle('GENERAL', json_encode(isset($style[0]) ? $style[$c] : $style));
247 246
                 $sheet->writeCell(0, $c, $v, 'n_string', $cellStyleIdx);
248 247
             }
249 248
             $writer->write('</row>');
@@ -257,7 +256,7 @@  discard block
 block discarded – undo
257 256
             $numberFormat = Support::numberFormatStandardized($v);
258 257
             $cellStyleIdx = $this->addCellStyle($numberFormat, $styleString = null);
259 258
             $columns[] = [
260
-                'number_format' => $numberFormat,      //contains excel format like 'YYYY-MM-DD HH:MM:SS'
259
+                'number_format' => $numberFormat, //contains excel format like 'YYYY-MM-DD HH:MM:SS'
261 260
                 'number_format_type' => Support::determineNumberFormatType($numberFormat), //contains friendly format like 'datetime'
262 261
                 'default_cell_style' => $cellStyleIdx,
263 262
             ];
@@ -331,7 +330,7 @@  discard block
 block discarded – undo
331 330
             $numberFormat_type = self::determineNumberFormatType($numberFormat);
332 331
             $cellStyleIdx = $this->addCellStyle($numberFormat, $styleString = null);
333 332
             $column_types[] = [
334
-                'number_format' => $numberFormat,      //contains excel format like 'YYYY-MM-DD HH:MM:SS'
333
+                'number_format' => $numberFormat, //contains excel format like 'YYYY-MM-DD HH:MM:SS'
335 334
                 'number_format_type' => $numberFormat_type, //contains friendly format like 'datetime'
336 335
                 'default_cell_style' => $cellStyleIdx,
337 336
             ];
@@ -387,7 +386,7 @@  discard block
 block discarded – undo
387 386
         /* @var $sheet Sheet */
388 387
         $sheet = $this->sheets[$sheetName];
389 388
         if (count($sheet->columns) < count($row)) {
390
-            $default_column_types = $this->initColumnsTypes(array_fill($from = 0, $until = count($row), 'GENERAL'));//will map to n_auto
389
+            $default_column_types = $this->initColumnsTypes(array_fill($from = 0, $until = count($row), 'GENERAL')); //will map to n_auto
391 390
             $sheet->columns = array_merge((array)$sheet->columns, $default_column_types);
392 391
         }
393 392
 
@@ -407,8 +406,7 @@  discard block
 block discarded – undo
407 406
 
408 407
             $numberFormat = $sheet->columns[$c]['number_format'];
409 408
             $numberFormatType = $sheet->columns[$c]['number_format_type'];
410
-            $cellStyleIdx = empty($style) ? $sheet->columns[$c]['default_cell_style'] :
411
-                $this->addCellStyle($numberFormat, json_encode(isset($style[0]) ? $style[$c] : $style));
409
+            $cellStyleIdx = empty($style) ? $sheet->columns[$c]['default_cell_style'] : $this->addCellStyle($numberFormat, json_encode(isset($style[0]) ? $style[$c] : $style));
412 410
             $this->writeCell($sheet->fileWriter, $sheet->rowCount, $c, $v, $numberFormatType, $cellStyleIdx);
413 411
             $c++;
414 412
         }
@@ -532,12 +530,12 @@  discard block
 block discarded – undo
532 530
         } elseif ($numFormatType == 'n_datetime') {
533 531
             $file->write('<c r="' . $cell_name . '" s="' . $cellStyleIdx . '" t="n"><v>' . self::convertDateTime($value) . '</v></c>');
534 532
         } elseif ($numFormatType == 'n_numeric') {
535
-            $file->write('<c r="' . $cell_name . '" s="' . $cellStyleIdx . '" t="n"><v>' . self::xmlSpecialChars($value) . '</v></c>');//int,float,currency
533
+            $file->write('<c r="' . $cell_name . '" s="' . $cellStyleIdx . '" t="n"><v>' . self::xmlSpecialChars($value) . '</v></c>'); //int,float,currency
536 534
         } elseif ($numFormatType == 'n_string') {
537 535
             $file->write('<c r="' . $cell_name . '" s="' . $cellStyleIdx . '" t="inlineStr"><is><t>' . self::xmlSpecialChars($value) . '</t></is></c>');
538 536
         } elseif ($numFormatType == 'n_auto' || 1) { //auto-detect unknown column types
539 537
             if (!is_string($value) || $value == '0' || ($value[0] != '0' && ctype_digit($value)) || preg_match("/^\-?(0|[1-9][0-9]*)(\.[0-9]+)?$/", $value)) {
540
-                $file->write('<c r="' . $cell_name . '" s="' . $cellStyleIdx . '" t="n"><v>' . self::xmlSpecialChars($value) . '</v></c>');//int,float,currency
538
+                $file->write('<c r="' . $cell_name . '" s="' . $cellStyleIdx . '" t="n"><v>' . self::xmlSpecialChars($value) . '</v></c>'); //int,float,currency
541 539
             } else { //implied: ($cell_format=='string')
542 540
                 $file->write('<c r="' . $cell_name . '" s="' . $cellStyleIdx . '" t="inlineStr"><is><t>' . self::xmlSpecialChars($value) . '</t></is></c>');
543 541
             }
@@ -554,9 +552,9 @@  discard block
 block discarded – undo
554 552
         static $horizontal_allowed = array('general', 'left', 'right', 'justify', 'center');
555 553
         static $vertical_allowed = array('bottom', 'center', 'distributed', 'top');
556 554
         $default_font = array('size' => '10', 'name' => 'Arial', 'family' => '2');
557
-        $fills = array('', '');//2 placeholders for static xml later
558
-        $fonts = array('', '', '', '');//4 placeholders for static xml later
559
-        $borders = array('');//1 placeholder for static xml later
555
+        $fills = array('', ''); //2 placeholders for static xml later
556
+        $fonts = array('', '', '', ''); //4 placeholders for static xml later
557
+        $borders = array(''); //1 placeholder for static xml later
560 558
         $style_indexes = array();
561 559
         foreach ($this->cellStyles as $i => $cellStyleString) {
562 560
             $semi_colon_pos = strpos($cellStyleString, ";");
@@ -564,7 +562,7 @@  discard block
 block discarded – undo
564 562
             $style_json_string = substr($cellStyleString, $semi_colon_pos + 1);
565 563
             $style = @json_decode($style_json_string, $as_assoc = true);
566 564
 
567
-            $style_indexes[$i] = array('num_fmt_idx' => $numberFormatIdx);//initialize entry
565
+            $style_indexes[$i] = array('num_fmt_idx' => $numberFormatIdx); //initialize entry
568 566
             if (isset($style['border']) && is_string($style['border']))//border is a comma delimited str
569 567
             {
570 568
                 $border_value['side'] = array_intersect(explode(",", $style['border']), $border_allowed);
@@ -573,14 +571,14 @@  discard block
 block discarded – undo
573 571
                 }
574 572
                 if (isset($style['border-color']) && is_string($style['border-color']) && $style['border-color'][0] == '#') {
575 573
                     $v = substr($style['border-color'], 1, 6);
576
-                    $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
574
+                    $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v; // expand cf0 => ccff00
577 575
                     $border_value['color'] = "FF" . strtoupper($v);
578 576
                 }
579 577
                 $style_indexes[$i]['border_idx'] = self::add2listGetIndex($borders, json_encode($border_value));
580 578
             }
581 579
             if (isset($style['fill']) && is_string($style['fill']) && $style['fill'][0] == '#') {
582 580
                 $v = substr($style['fill'], 1, 6);
583
-                $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
581
+                $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v; // expand cf0 => ccff00
584 582
                 $style_indexes[$i]['fill_idx'] = self::add2listGetIndex($fills, "FF" . strtoupper($v));
585 583
             }
586 584
             if (isset($style['halign']) && in_array($style['halign'], $horizontal_allowed)) {
@@ -598,7 +596,7 @@  discard block
 block discarded – undo
598 596
 
599 597
             $font = $default_font;
600 598
             if (isset($style['font-size'])) {
601
-                $font['size'] = floatval($style['font-size']);//floatval to allow "10.5" etc
599
+                $font['size'] = floatval($style['font-size']); //floatval to allow "10.5" etc
602 600
             }
603 601
             if (isset($style['font']) && is_string($style['font'])) {
604 602
                 if ($style['font'] == 'Comic Sans MS') {
@@ -628,7 +626,7 @@  discard block
 block discarded – undo
628 626
             }
629 627
             if (isset($style['color']) && is_string($style['color']) && $style['color'][0] == '#') {
630 628
                 $v = substr($style['color'], 1, 6);
631
-                $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
629
+                $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v; // expand cf0 => ccff00
632 630
                 $font['color'] = "FF" . strtoupper($v);
633 631
             }
634 632
             if ($font != $default_font) {
@@ -799,7 +797,7 @@  discard block
 block discarded – undo
799 797
         $coreXml = "";
800 798
         $coreXml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
801 799
         $coreXml .= '<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
802
-        $coreXml .= '<dcterms:created xsi:type="dcterms:W3CDTF">' . date("Y-m-d\TH:i:s.00\Z") . '</dcterms:created>';//$date_time = '2014-10-25T15:54:37.00Z';
800
+        $coreXml .= '<dcterms:created xsi:type="dcterms:W3CDTF">' . date("Y-m-d\TH:i:s.00\Z") . '</dcterms:created>'; //$date_time = '2014-10-25T15:54:37.00Z';
803 801
         $coreXml .= '<dc:title>' . self::xmlSpecialChars($this->title) . '</dc:title>';
804 802
         $coreXml .= '<dc:subject>' . self::xmlSpecialChars($this->subject) . '</dc:subject>';
805 803
         $coreXml .= '<dc:creator>' . self::xmlSpecialChars($this->author) . '</dc:creator>';
@@ -948,7 +946,7 @@  discard block
 block discarded – undo
948 946
         static $goodchars = '        ';
949 947
         $sheetname = strtr($sheetname, $badchars, $goodchars);
950 948
         $sheetname = mb_substr($sheetname, 0, 31);
951
-        $sheetname = trim(trim(trim($sheetname), "'"));//trim before and after trimming single quotes
949
+        $sheetname = trim(trim(trim($sheetname), "'")); //trim before and after trimming single quotes
952 950
 
953 951
         return !empty($sheetname) ? $sheetname : 'Sheet' . ((rand() % 900) + 100);
954 952
     }
@@ -966,7 +964,7 @@  discard block
 block discarded – undo
966 964
         static $badchars = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f";
967 965
         static $goodchars = "                              ";
968 966
 
969
-        return strtr(htmlspecialchars($val, ENT_QUOTES | ENT_XML1), $badchars, $goodchars);//strtr appears to be faster than str_replace
967
+        return strtr(htmlspecialchars($val, ENT_QUOTES | ENT_XML1), $badchars, $goodchars); //strtr appears to be faster than str_replace
970 968
     }
971 969
 
972 970
     /**
@@ -1108,7 +1106,7 @@  discard block
 block discarded – undo
1108 1106
      */
1109 1107
     public static function convertDateTime($dateInput)
1110 1108
     {
1111
-        $seconds = 0;    # Time expressed as fraction of 24h hours in seconds
1109
+        $seconds = 0; # Time expressed as fraction of 24h hours in seconds
1112 1110
         $year = $month = $day = 0;
1113 1111
 
1114 1112
         $date_time = $dateInput;
@@ -1123,9 +1121,9 @@  discard block
 block discarded – undo
1123 1121
 
1124 1122
         //using 1900 as epoch, not 1904, ignoring 1904 special case
1125 1123
         # Special cases for Excel.
1126
-        if ("$year-$month-$day" == '1899-12-31') return $seconds;    # Excel 1900 epoch
1127
-        if ("$year-$month-$day" == '1900-01-00') return $seconds;    # Excel 1900 epoch
1128
-        if ("$year-$month-$day" == '1900-02-29') return 60 + $seconds;    # Excel false leapday
1124
+        if ("$year-$month-$day" == '1899-12-31') return $seconds; # Excel 1900 epoch
1125
+        if ("$year-$month-$day" == '1900-01-00') return $seconds; # Excel 1900 epoch
1126
+        if ("$year-$month-$day" == '1900-02-29') return 60 + $seconds; # Excel false leapday
1129 1127
         # We calculate the date by calculating the number of days since the epoch
1130 1128
         # and adjust for the number of leap days. We calculate the number of leap
1131 1129
         # days by normalising the year in relation to the epoch. Thus the year 2000
@@ -1142,13 +1140,13 @@  discard block
 block discarded – undo
1142 1140
         if ($month < 1 || $month > 12) return 0;
1143 1141
         if ($day < 1 || $day > $mdays[$month - 1]) return 0;
1144 1142
         # Accumulate the number of days since the epoch.
1145
-        $days = $day;    # Add days for current month
1146
-        $days += array_sum(array_slice($mdays, 0, $month - 1));    # Add days for past months
1147
-        $days += $range * 365;                      # Add days for past years
1148
-        $days += intval(($range) / 4);             # Add leapdays
1143
+        $days = $day; # Add days for current month
1144
+        $days += array_sum(array_slice($mdays, 0, $month - 1)); # Add days for past months
1145
+        $days += $range * 365; # Add days for past years
1146
+        $days += intval(($range) / 4); # Add leapdays
1149 1147
         $days -= intval(($range + $offset) / 100); # Subtract 100 year leapdays
1150
-        $days += intval(($range + $offset + $norm) / 400);  # Add 400 year leapdays
1151
-        $days -= $leap;                                      # Already counted above
1148
+        $days += intval(($range + $offset + $norm) / 400); # Add 400 year leapdays
1149
+        $days -= $leap; # Already counted above
1152 1150
         # Adjust for Excel erroneously treating 1900 as a leap year.
1153 1151
         if ($days > 59) {
1154 1152
             $days++;
Please login to merge, or discard this patch.
Braces   +81 added lines, -36 removed lines patch added patch discarded remove patch
@@ -346,8 +346,9 @@  discard block
 block discarded – undo
346 346
      */
347 347
     public function writeSheetHeader($sheetName, array $headerTypes, $colOptions = null)
348 348
     {
349
-        if (empty($sheetName) || empty($headerTypes) || !empty($this->sheets[$sheetName]))
350
-            return;
349
+        if (empty($sheetName) || empty($headerTypes) || !empty($this->sheets[$sheetName])) {
350
+                    return;
351
+        }
351 352
 
352 353
         $suppress_row = isset($colOptions['suppress_row']) ? intval($colOptions['suppress_row']) : false;
353 354
         if (is_bool($colOptions)) {
@@ -380,8 +381,9 @@  discard block
 block discarded – undo
380 381
      */
381 382
     public function writeSheetRow($sheetName, array $row, $rowOptions = null)
382 383
     {
383
-        if (empty($sheetName))
384
-            return;
384
+        if (empty($sheetName)) {
385
+                    return;
386
+        }
385 387
 
386 388
         $this->initSheet($sheetName);
387 389
         /* @var $sheet Sheet */
@@ -434,8 +436,9 @@  discard block
 block discarded – undo
434 436
      */
435 437
     protected function finalizeSheet($sheetName)
436 438
     {
437
-        if (empty($sheetName) || $this->sheets[$sheetName]->finalized)
438
-            return;
439
+        if (empty($sheetName) || $this->sheets[$sheetName]->finalized) {
440
+                    return;
441
+        }
439 442
 
440 443
         /* @var $sheet Sheet */
441 444
         $sheet = &$this->sheets[$sheetName];
@@ -482,8 +485,9 @@  discard block
 block discarded – undo
482 485
      */
483 486
     public function markMergedCell($sheetName, $startCellRow, $startCellColumn, $endCellRow, $endCellColumn)
484 487
     {
485
-        if (empty($sheetName) || $this->sheets[$sheetName]->finalized)
486
-            return;
488
+        if (empty($sheetName) || $this->sheets[$sheetName]->finalized) {
489
+                    return;
490
+        }
487 491
 
488 492
         $this->initSheet($sheetName);
489 493
         $sheet = &$this->sheets[$sheetName];
@@ -565,9 +569,11 @@  discard block
 block discarded – undo
565 569
             $style = @json_decode($style_json_string, $as_assoc = true);
566 570
 
567 571
             $style_indexes[$i] = array('num_fmt_idx' => $numberFormatIdx);//initialize entry
568
-            if (isset($style['border']) && is_string($style['border']))//border is a comma delimited str
572
+            if (isset($style['border']) && is_string($style['border'])) {
573
+                //border is a comma delimited str
569 574
             {
570 575
                 $border_value['side'] = array_intersect(explode(",", $style['border']), $border_allowed);
576
+            }
571 577
                 if (isset($style['border-style']) && in_array($style['border-style'], $border_style_allowed)) {
572 578
                     $border_value['style'] = $style['border-style'];
573 579
                 }
@@ -993,17 +999,39 @@  discard block
 block discarded – undo
993 999
     private static function determineNumberFormatType($numFormat)
994 1000
     {
995 1001
         $numFormat = preg_replace("/\[(Black|Blue|Cyan|Green|Magenta|Red|White|Yellow)\]/i", "", $numFormat);
996
-        if ($numFormat == 'GENERAL') return 'n_auto';
997
-        if ($numFormat == '@') return 'n_string';
998
-        if ($numFormat == '0') return 'n_numeric';
999
-        if (preg_match('/[H]{1,2}:[M]{1,2}(?![^"]*+")/i', $numFormat)) return 'n_datetime';
1000
-        if (preg_match('/[M]{1,2}:[S]{1,2}(?![^"]*+")/i', $numFormat)) return 'n_datetime';
1001
-        if (preg_match('/[Y]{2,4}(?![^"]*+")/i', $numFormat)) return 'n_date';
1002
-        if (preg_match('/[D]{1,2}(?![^"]*+")/i', $numFormat)) return 'n_date';
1003
-        if (preg_match('/[M]{1,2}(?![^"]*+")/i', $numFormat)) return 'n_date';
1004
-        if (preg_match('/$(?![^"]*+")/', $numFormat)) return 'n_numeric';
1005
-        if (preg_match('/%(?![^"]*+")/', $numFormat)) return 'n_numeric';
1006
-        if (preg_match('/0(?![^"]*+")/', $numFormat)) return 'n_numeric';
1002
+        if ($numFormat == 'GENERAL') {
1003
+            return 'n_auto';
1004
+        }
1005
+        if ($numFormat == '@') {
1006
+            return 'n_string';
1007
+        }
1008
+        if ($numFormat == '0') {
1009
+            return 'n_numeric';
1010
+        }
1011
+        if (preg_match('/[H]{1,2}:[M]{1,2}(?![^"]*+")/i', $numFormat)) {
1012
+            return 'n_datetime';
1013
+        }
1014
+        if (preg_match('/[M]{1,2}:[S]{1,2}(?![^"]*+")/i', $numFormat)) {
1015
+            return 'n_datetime';
1016
+        }
1017
+        if (preg_match('/[Y]{2,4}(?![^"]*+")/i', $numFormat)) {
1018
+            return 'n_date';
1019
+        }
1020
+        if (preg_match('/[D]{1,2}(?![^"]*+")/i', $numFormat)) {
1021
+            return 'n_date';
1022
+        }
1023
+        if (preg_match('/[M]{1,2}(?![^"]*+")/i', $numFormat)) {
1024
+            return 'n_date';
1025
+        }
1026
+        if (preg_match('/$(?![^"]*+")/', $numFormat)) {
1027
+            return 'n_numeric';
1028
+        }
1029
+        if (preg_match('/%(?![^"]*+")/', $numFormat)) {
1030
+            return 'n_numeric';
1031
+        }
1032
+        if (preg_match('/0(?![^"]*+")/', $numFormat)) {
1033
+            return 'n_numeric';
1034
+        }
1007 1035
         return 'n_auto';
1008 1036
 
1009 1037
         switch ($numFormat) {
@@ -1070,16 +1098,18 @@  discard block
 block discarded – undo
1070 1098
         $escaped = '';
1071 1099
         for ($i = 0, $ix = strlen($numFormat); $i < $ix; $i++) {
1072 1100
             $c = $numFormat[$i];
1073
-            if ($ignoreUntil == '' && $c == '[')
1074
-                $ignoreUntil = ']';
1075
-            else if ($ignoreUntil == '' && $c == '"')
1076
-                $ignoreUntil = '"';
1077
-            else if ($ignoreUntil == $c)
1078
-                $ignoreUntil = '';
1079
-            if ($ignoreUntil == '' && ($c == ' ' || $c == '-' || $c == '(' || $c == ')') && ($i == 0 || $numFormat[$i - 1] != '_'))
1080
-                $escaped .= "\\" . $c;
1081
-            else
1082
-                $escaped .= $c;
1101
+            if ($ignoreUntil == '' && $c == '[') {
1102
+                            $ignoreUntil = ']';
1103
+            } else if ($ignoreUntil == '' && $c == '"') {
1104
+                            $ignoreUntil = '"';
1105
+            } else if ($ignoreUntil == $c) {
1106
+                            $ignoreUntil = '';
1107
+            }
1108
+            if ($ignoreUntil == '' && ($c == ' ' || $c == '-' || $c == '(' || $c == ')') && ($i == 0 || $numFormat[$i - 1] != '_')) {
1109
+                            $escaped .= "\\" . $c;
1110
+            } else {
1111
+                            $escaped .= $c;
1112
+            }
1083 1113
         }
1084 1114
 
1085 1115
         return $escaped;
@@ -1123,9 +1153,18 @@  discard block
 block discarded – undo
1123 1153
 
1124 1154
         //using 1900 as epoch, not 1904, ignoring 1904 special case
1125 1155
         # Special cases for Excel.
1126
-        if ("$year-$month-$day" == '1899-12-31') return $seconds;    # Excel 1900 epoch
1127
-        if ("$year-$month-$day" == '1900-01-00') return $seconds;    # Excel 1900 epoch
1128
-        if ("$year-$month-$day" == '1900-02-29') return 60 + $seconds;    # Excel false leapday
1156
+        if ("$year-$month-$day" == '1899-12-31') {
1157
+            return $seconds;
1158
+        }
1159
+        # Excel 1900 epoch
1160
+        if ("$year-$month-$day" == '1900-01-00') {
1161
+            return $seconds;
1162
+        }
1163
+        # Excel 1900 epoch
1164
+        if ("$year-$month-$day" == '1900-02-29') {
1165
+            return 60 + $seconds;
1166
+        }
1167
+        # Excel false leapday
1129 1168
         # We calculate the date by calculating the number of days since the epoch
1130 1169
         # and adjust for the number of leap days. We calculate the number of leap
1131 1170
         # days by normalising the year in relation to the epoch. Thus the year 2000
@@ -1138,9 +1177,15 @@  discard block
 block discarded – undo
1138 1177
         $leap = (($year % 400 == 0) || (($year % 4 == 0) && ($year % 100))) ? 1 : 0;
1139 1178
         $mdays = array(31, ($leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
1140 1179
         # Some boundary checks
1141
-        if ($year < $epoch || $year > 9999) return 0;
1142
-        if ($month < 1 || $month > 12) return 0;
1143
-        if ($day < 1 || $day > $mdays[$month - 1]) return 0;
1180
+        if ($year < $epoch || $year > 9999) {
1181
+            return 0;
1182
+        }
1183
+        if ($month < 1 || $month > 12) {
1184
+            return 0;
1185
+        }
1186
+        if ($day < 1 || $day > $mdays[$month - 1]) {
1187
+            return 0;
1188
+        }
1144 1189
         # Accumulate the number of days since the epoch.
1145 1190
         $days = $day;    # Add days for current month
1146 1191
         $days += array_sum(array_slice($mdays, 0, $month - 1));    # Add days for past months
Please login to merge, or discard this patch.
src/Support.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         static $badchars = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f";
146 146
         static $goodchars = "                              ";
147 147
 
148
-        return strtr(htmlspecialchars($val, ENT_QUOTES | ENT_XML1), $badchars, $goodchars);//strtr appears to be faster than str_replace
148
+        return strtr(htmlspecialchars($val, ENT_QUOTES | ENT_XML1), $badchars, $goodchars); //strtr appears to be faster than str_replace
149 149
     }
150 150
 
151 151
     /**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public static function convertDateTime($dateInput)
157 157
     {
158
-        $seconds = 0;    # Time expressed as fraction of 24h hours in seconds
158
+        $seconds = 0; # Time expressed as fraction of 24h hours in seconds
159 159
         $year    = $month = $day = 0;
160 160
 
161 161
         $date_time = $dateInput;
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
         //using 1900 as epoch, not 1904, ignoring 1904 special case
172 172
         # Special cases for Excel.
173
-        if ("$year-$month-$day" == '1899-12-31') return $seconds;    # Excel 1900 epoch
174
-        if ("$year-$month-$day" == '1900-01-00') return $seconds;    # Excel 1900 epoch
175
-        if ("$year-$month-$day" == '1900-02-29') return 60 + $seconds;    # Excel false leapday
173
+        if ("$year-$month-$day" == '1899-12-31') return $seconds; # Excel 1900 epoch
174
+        if ("$year-$month-$day" == '1900-01-00') return $seconds; # Excel 1900 epoch
175
+        if ("$year-$month-$day" == '1900-02-29') return 60 + $seconds; # Excel false leapday
176 176
         # We calculate the date by calculating the number of days since the epoch
177 177
         # and adjust for the number of leap days. We calculate the number of leap
178 178
         # days by normalising the year in relation to the epoch. Thus the year 2000
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
         if ($month < 1 || $month > 12) return 0;
190 190
         if ($day < 1 || $day > $mdays[$month - 1]) return 0;
191 191
         # Accumulate the number of days since the epoch.
192
-        $days = $day;    # Add days for current month
193
-        $days += array_sum(array_slice($mdays, 0, $month - 1));    # Add days for past months
194
-        $days += $range * 365;                      # Add days for past years
195
-        $days += intval(($range) / 4);             # Add leapdays
192
+        $days = $day; # Add days for current month
193
+        $days += array_sum(array_slice($mdays, 0, $month - 1)); # Add days for past months
194
+        $days += $range * 365; # Add days for past years
195
+        $days += intval(($range) / 4); # Add leapdays
196 196
         $days -= intval(($range + $offset) / 100); # Subtract 100 year leapdays
197
-        $days += intval(($range + $offset + $norm) / 400);  # Add 400 year leapdays
198
-        $days -= $leap;                                      # Already counted above
197
+        $days += intval(($range + $offset + $norm) / 400); # Add 400 year leapdays
198
+        $days -= $leap; # Already counted above
199 199
         # Adjust for Excel erroneously treating 1900 as a leap year.
200 200
         if ($days > 59) {
201 201
             $days++;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         static $goodchars = '        ';
211 211
         $sheetname = strtr($sheetname, $badchars, $goodchars);
212 212
         $sheetname = mb_substr($sheetname, 0, 31);
213
-        $sheetname = trim(trim(trim($sheetname), "'"));//trim before and after trimming single quotes
213
+        $sheetname = trim(trim(trim($sheetname), "'")); //trim before and after trimming single quotes
214 214
 
215 215
         return !empty($sheetname) ? $sheetname : 'Sheet' . ((rand() % 900) + 100);
216 216
     }
Please login to merge, or discard this patch.
Braces   +33 added lines, -16 removed lines patch added patch discarded remove patch
@@ -76,16 +76,18 @@  discard block
 block discarded – undo
76 76
         $escaped     = '';
77 77
         for ($i = 0, $ix = strlen($numFormat); $i < $ix; $i++) {
78 78
             $c = $numFormat[$i];
79
-            if ($ignoreUntil == '' && $c == '[')
80
-                $ignoreUntil = ']';
81
-            else if ($ignoreUntil == '' && $c == '"')
82
-                $ignoreUntil = '"';
83
-            else if ($ignoreUntil == $c)
84
-                $ignoreUntil = '';
85
-            if ($ignoreUntil == '' && ($c == ' ' || $c == '-' || $c == '(' || $c == ')') && ($i == 0 || $numFormat[$i - 1] != '_'))
86
-                $escaped .= "\\" . $c;
87
-            else
88
-                $escaped .= $c;
79
+            if ($ignoreUntil == '' && $c == '[') {
80
+                            $ignoreUntil = ']';
81
+            } else if ($ignoreUntil == '' && $c == '"') {
82
+                            $ignoreUntil = '"';
83
+            } else if ($ignoreUntil == $c) {
84
+                            $ignoreUntil = '';
85
+            }
86
+            if ($ignoreUntil == '' && ($c == ' ' || $c == '-' || $c == '(' || $c == ')') && ($i == 0 || $numFormat[$i - 1] != '_')) {
87
+                            $escaped .= "\\" . $c;
88
+            } else {
89
+                            $escaped .= $c;
90
+            }
89 91
         }
90 92
 
91 93
         return $escaped;
@@ -170,9 +172,18 @@  discard block
 block discarded – undo
170 172
 
171 173
         //using 1900 as epoch, not 1904, ignoring 1904 special case
172 174
         # Special cases for Excel.
173
-        if ("$year-$month-$day" == '1899-12-31') return $seconds;    # Excel 1900 epoch
174
-        if ("$year-$month-$day" == '1900-01-00') return $seconds;    # Excel 1900 epoch
175
-        if ("$year-$month-$day" == '1900-02-29') return 60 + $seconds;    # Excel false leapday
175
+        if ("$year-$month-$day" == '1899-12-31') {
176
+            return $seconds;
177
+        }
178
+        # Excel 1900 epoch
179
+        if ("$year-$month-$day" == '1900-01-00') {
180
+            return $seconds;
181
+        }
182
+        # Excel 1900 epoch
183
+        if ("$year-$month-$day" == '1900-02-29') {
184
+            return 60 + $seconds;
185
+        }
186
+        # Excel false leapday
176 187
         # We calculate the date by calculating the number of days since the epoch
177 188
         # and adjust for the number of leap days. We calculate the number of leap
178 189
         # days by normalising the year in relation to the epoch. Thus the year 2000
@@ -185,9 +196,15 @@  discard block
 block discarded – undo
185 196
         $leap  = (($year % 400 == 0) || (($year % 4 == 0) && ($year % 100))) ? 1 : 0;
186 197
         $mdays = array(31, ($leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
187 198
         # Some boundary checks
188
-        if ($year < $epoch || $year > 9999) return 0;
189
-        if ($month < 1 || $month > 12) return 0;
190
-        if ($day < 1 || $day > $mdays[$month - 1]) return 0;
199
+        if ($year < $epoch || $year > 9999) {
200
+            return 0;
201
+        }
202
+        if ($month < 1 || $month > 12) {
203
+            return 0;
204
+        }
205
+        if ($day < 1 || $day > $mdays[$month - 1]) {
206
+            return 0;
207
+        }
191 208
         # Accumulate the number of days since the epoch.
192 209
         $days = $day;    # Add days for current month
193 210
         $days += array_sum(array_slice($mdays, 0, $month - 1));    # Add days for past months
Please login to merge, or discard this patch.
src/Writer/Style.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function styleFontIndexes(array $cellStyles)
69 69
     {
70
-        $fills        = ['', ''];//2 placeholders for static xml later
71
-        $fonts        = ['', '', '', ''];//4 placeholders for static xml later
72
-        $borders      = [''];//1 placeholder for static xml later
70
+        $fills        = ['', '']; //2 placeholders for static xml later
71
+        $fonts        = ['', '', '', '']; //4 placeholders for static xml later
72
+        $borders      = ['']; //1 placeholder for static xml later
73 73
         $styleIndexes = [];
74 74
         foreach ($cellStyles as $i => $cellStyleString) {
75 75
             $semiColonPos     = strpos($cellStyleString, ";");
76 76
             $numberFormatIdx  = substr($cellStyleString, 0, $semiColonPos);
77 77
             $styleJsonString  = substr($cellStyleString, $semiColonPos + 1);
78 78
             $style            = @json_decode($styleJsonString, true);
79
-            $styleIndexes[$i] = ['num_fmt_idx' => $numberFormatIdx];//initialize entry
79
+            $styleIndexes[$i] = ['num_fmt_idx' => $numberFormatIdx]; //initialize entry
80 80
             if (isset($style['border']) && is_string($style['border'])) { //border is a comma delimited str
81 81
                 $borderValue['side'] = array_intersect(explode(",", $style['border']), $this->borderAllowed);
82 82
                 if (isset($style['border-style']) && in_array($style['border-style'], $this->borderStyleAllowed)) {
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
                 }
85 85
                 if (isset($style['border-color']) && is_string($style['border-color']) && $style['border-color'][0] == '#') {
86 86
                     $v                     = substr($style['border-color'], 1, 6);
87
-                    $v                     = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
87
+                    $v                     = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v; // expand cf0 => ccff00
88 88
                     $border_value['color'] = "FF" . strtoupper($v);
89 89
                 }
90 90
                 $styleIndexes[$i]['border_idx'] = Support::add2listGetIndex($borders, json_encode($borderValue));
91 91
             }
92 92
             if (isset($style['fill']) && is_string($style['fill']) && $style['fill'][0] == '#') {
93 93
                 $v                            = substr($style['fill'], 1, 6);
94
-                $v                            = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
94
+                $v                            = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v; // expand cf0 => ccff00
95 95
                 $styleIndexes[$i]['fill_idx'] = Support::add2listGetIndex($fills, "FF" . strtoupper($v));
96 96
             }
97 97
             if (isset($style['halign']) && in_array($style['halign'], $this->horizontalAllowed)) {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
             $font = $this->defaultFont;
111 111
             if (isset($style['font-size'])) {
112
-                $font['size'] = floatval($style['font-size']);//floatval to allow "10.5" etc
112
+                $font['size'] = floatval($style['font-size']); //floatval to allow "10.5" etc
113 113
             }
114 114
             if (isset($style['font']) && is_string($style['font'])) {
115 115
                 if ($style['font'] == 'Comic Sans MS') {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             }
140 140
             if (isset($style['color']) && is_string($style['color']) && $style['color'][0] == '#') {
141 141
                 $v             = substr($style['color'], 1, 6);
142
-                $v             = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
142
+                $v             = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v; // expand cf0 => ccff00
143 143
                 $font['color'] = "FF" . strtoupper($v);
144 144
             }
145 145
             if ($font != $this->defaultFont) {
Please login to merge, or discard this patch.
src/Writer/XlsxBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="Calc"/><workbookPr backupFile="false" showObjects="all" date1904="false"/><workbookProtection/><bookViews><workbookView activeTab="0" firstSheet="0" showHorizontalScroll="true" showSheetTabs="true" showVerticalScroll="true" tabRatio="212" windowHeight="8192" windowWidth="16384" xWindow="0" yWindow="0"/></bookViews><sheets>
95 95
 EOF;
96 96
         foreach ($sheets as $sheetName => $sheet) {
97
-            $sheetname   = Support::sanitizeSheetname($sheet->sheetname);
97
+            $sheetname = Support::sanitizeSheetname($sheet->sheetname);
98 98
             $workbookXml .= '<sheet name="' . Support::xmlSpecialChars($sheetname) .
99 99
                 '" sheetId="' . ($i + 1) . '" state="visible" r:id="rId' . ($i + 2) . '"/>';
100 100
             $i++;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $workbookXml .= '</sheets><definedNames>';
103 103
         foreach ($sheets as $sheetName => $sheet) {
104 104
             if ($sheet->autoFilter) {
105
-                $sheetname   = Support::sanitizeSheetname($sheet->sheetname);
105
+                $sheetname = Support::sanitizeSheetname($sheet->sheetname);
106 106
                 $workbookXml .= '<definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">\'' .
107 107
                     Support::xmlSpecialChars($sheetname) . '\'!$A$1:' .
108 108
                     Support::xlsCell($sheet->rowCount - 1, count($sheet->columns) - 1, true) . '</definedName>';
Please login to merge, or discard this patch.
src/Writer/Builder.php 2 patches
Spacing   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     public function writeToFile($filename)
155 155
     {
156 156
         foreach ($this->sheets as $sheetName => $sheet) {
157
-            $this->finalizeSheet($sheetName);//making sure all footers have been written
157
+            $this->finalizeSheet($sheetName); //making sure all footers have been written
158 158
         }
159 159
 
160 160
         if (file_exists($filename)) {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             $zip->addFile($sheet->filename, "xl/worksheets/" . $sheet->xmlname);
188 188
         }
189 189
         $zip->addFromString("xl/workbook.xml", XlsxBuilder::buildWorkbookXML($this->sheets));
190
-        $zip->addFile($this->writeStylesXML(), "xl/styles.xml");  //$zip->addFromString("xl/styles.xml", self::buildStylesXML() );
190
+        $zip->addFile($this->writeStylesXML(), "xl/styles.xml"); //$zip->addFromString("xl/styles.xml", self::buildStylesXML() );
191 191
         $zip->addFromString("[Content_Types].xml", XlsxBuilder::buildContentTypesXML($this->sheets));
192 192
         $zip->addEmptyDir("xl/_rels/");
193 193
         $zip->addFromString("xl/_rels/workbook.xml.rels", XlsxBuilder::buildWorkbookRelsXML($this->sheets));
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         $this->initSheet($sheetName);
209 209
         $sheet = $this->getSheet();
210 210
         if (count($sheet->columns) < count($row)) {
211
-            $defaultColumnTypes = $this->initColumnsTypes(array_fill($from = 0, count($row), 'GENERAL'));//will map to n_auto
211
+            $defaultColumnTypes = $this->initColumnsTypes(array_fill($from = 0, count($row), 'GENERAL')); //will map to n_auto
212 212
             $sheet->columns = array_merge((array)$sheet->columns, $defaultColumnTypes);
213 213
         }
214 214
 
@@ -233,8 +233,7 @@  discard block
 block discarded – undo
233 233
         foreach ($row as $v) {
234 234
             $numberFormat = $sheet->columns[$c]['number_format'];
235 235
             $numberFormatType = $sheet->columns[$c]['number_format_type'];
236
-            $cellStyleIdx = empty($style) ? $sheet->columns[$c]['default_cell_style'] :
237
-                $this->addCellStyle($numberFormat, json_encode(isset($style[0]) ? $style[$c] : $style));
236
+            $cellStyleIdx = empty($style) ? $sheet->columns[$c]['default_cell_style'] : $this->addCellStyle($numberFormat, json_encode(isset($style[0]) ? $style[$c] : $style));
238 237
             $sheet->writeCell($sheet->rowCount, $c, $v, $numberFormatType, $cellStyleIdx);
239 238
             $c++;
240 239
         }
@@ -432,8 +431,7 @@  discard block
 block discarded – undo
432 431
             );
433 432
             foreach ($headerRow as $c => $v) {
434 433
                 $cellStyleIdx = empty($style) ?
435
-                    $sheet->columns[$c]['default_cell_style'] :
436
-                    $this->addCellStyle('GENERAL', json_encode(isset($style[0]) ? $style[$c] : $style));
434
+                    $sheet->columns[$c]['default_cell_style'] : $this->addCellStyle('GENERAL', json_encode(isset($style[0]) ? $style[$c] : $style));
437 435
                 $sheet->writeCell(0, $c, $v, 'n_string', $cellStyleIdx);
438 436
             }
439 437
             $writer->write('</row>');
@@ -447,7 +445,7 @@  discard block
 block discarded – undo
447 445
             $numberFormat = Support::numberFormatStandardized($v);
448 446
             $cellStyleIdx = $this->addCellStyle($numberFormat, $styleString = null);
449 447
             $columns[] = [
450
-                'number_format' => $numberFormat,      //contains excel format like 'YYYY-MM-DD HH:MM:SS'
448
+                'number_format' => $numberFormat, //contains excel format like 'YYYY-MM-DD HH:MM:SS'
451 449
                 'number_format_type' => Support::determineNumberFormatType($numberFormat), //contains friendly format like 'datetime'
452 450
                 'default_cell_style' => $cellStyleIdx,
453 451
             ];
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -202,8 +202,9 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function writeSheetRow($sheetName, array $row, $rowOptions = null)
204 204
     {
205
-        if (empty($sheetName))
206
-            return;
205
+        if (empty($sheetName)) {
206
+                    return;
207
+        }
207 208
 
208 209
         $this->initSheet($sheetName);
209 210
         $sheet = $this->getSheet();
@@ -249,8 +250,9 @@  discard block
 block discarded – undo
249 250
      */
250 251
     protected function finalizeSheet($sheetName)
251 252
     {
252
-        if (empty($sheetName) || $this->sheets[$sheetName]->finalized)
253
-            return;
253
+        if (empty($sheetName) || $this->sheets[$sheetName]->finalized) {
254
+                    return;
255
+        }
254 256
 
255 257
         $sheet = $this->sheets[$sheetName];
256 258
         $sheet->finallyContent();
Please login to merge, or discard this patch.
src/Writer/Sheet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                     break;
81 81
                 case 'n_numeric':
82 82
                     $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' .
83
-                        Support::xmlSpecialChars($value) . '</v></c>');//int,float,currency
83
+                        Support::xmlSpecialChars($value) . '</v></c>'); //int,float,currency
84 84
                     break;
85 85
                 case 'n_string':
86 86
                     $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="inlineStr"><is><t>' .
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $writer      = $this->getFileWriter();
117 117
         $tabSelected = $isTabSelected ? 'true' : 'false';
118
-        $maxCell     = Support::xlsCell(XlsxWriter::EXCEL_2007_MAX_ROW, XlsxWriter::EXCEL_2007_MAX_COL);//XFE1048577
118
+        $maxCell     = Support::xlsCell(XlsxWriter::EXCEL_2007_MAX_ROW, XlsxWriter::EXCEL_2007_MAX_COL); //XFE1048577
119 119
         $writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n");
120 120
         $writer->write(<<<EOF
121 121
 <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetPr filterMode="false"><pageSetUpPr fitToPage="false"/></sheetPr>
Please login to merge, or discard this patch.
example.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,9 +99,9 @@
 block discarded – undo
99 99
 {
100 100
     return [
101 101
         'SKU' => 'string',
102
-        '尺码' => 'string',  // sku
103
-        '净重' => 'string',  // sku
104
-        '单价' => 'prices',  // sku
102
+        '尺码' => 'string', // sku
103
+        '净重' => 'string', // sku
104
+        '单价' => 'prices', // sku
105 105
     ];
106 106
 }
107 107
 
Please login to merge, or discard this patch.