Code Duplication    Length = 5-5 lines in 3 locations

core/helpers/XLSXWriter.php 3 locations

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