Code Duplication    Length = 5-5 lines in 3 locations

core/helpers/XLSXWriter.php 3 locations

@@ 485-489 (lines=5) @@
482
                if (isset($style['border-style']) && in_array($style['border-style'], $border_style_allowed)) {
483
                    $border_value['style'] = $style['border-style'];
484
                }
485
                if (isset($style['border-color']) && is_string($style['border-color']) && $style['border-color'][0] == '#') {
486
                    $v = substr($style['border-color'], 1, 6);
487
                    $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
488
                    $border_value['color'] = "FF" . strtoupper($v);
489
                }
490
                $style_indexes[$i]['border_idx'] = self::add_to_list_get_index($borders, json_encode($border_value));
491
            }
492
            if (isset($style['fill']) && is_string($style['fill']) && $style['fill'][0] == '#') {
@@ 492-496 (lines=5) @@
489
                }
490
                $style_indexes[$i]['border_idx'] = self::add_to_list_get_index($borders, json_encode($border_value));
491
            }
492
            if (isset($style['fill']) && is_string($style['fill']) && $style['fill'][0] == '#') {
493
                $v = substr($style['fill'], 1, 6);
494
                $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
495
                $style_indexes[$i]['fill_idx'] = self::add_to_list_get_index($fills, "FF" . strtoupper($v));
496
            }
497
            if (isset($style['halign']) && in_array($style['halign'], $horizontal_allowed)) {
498
                $style_indexes[$i]['alignment'] = true;
499
                $style_indexes[$i]['halign'] = $style['halign'];
@@ 540-544 (lines=5) @@
537
                    $font['underline'] = true;
538
                }
539
            }
540
            if (isset($style['color']) && is_string($style['color']) && $style['color'][0] == '#') {
541
                $v = substr($style['color'], 1, 6);
542
                $v = strlen($v) == 3 ? $v[0] . $v[0] . $v[1] . $v[1] . $v[2] . $v[2] : $v;// expand cf0 => ccff00
543
                $font['color'] = "FF" . strtoupper($v);
544
            }
545
            if ($font != $default_font) {
546
                $style_indexes[$i]['font_idx'] = self::add_to_list_get_index($fonts, json_encode($font));
547
            }