Code Duplication    Length = 13-13 lines in 2 locations

src/PhpSpreadsheet/Writer/Excel5.php 2 locations

@@ 707-719 (lines=13) @@
704
                    $dataSection_Content .= pack('V', 0x0001);
705
                }
706
                $dataSection_Content_Offset += 4 + 4;
707
            } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
708
                // Null-terminated string
709
                $dataProp['data']['data'] .= chr(0);
710
                $dataProp['data']['length'] += 1;
711
                // Complete the string with null string for being a %4
712
                $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4));
713
                $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
714
715
                $dataSection_Content .= pack('V', $dataProp['data']['length']);
716
                $dataSection_Content .= $dataProp['data']['data'];
717
718
                $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
719
            } elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
720
                $dataSection_Content .= $dataProp['data']['data'];
721
722
                $dataSection_Content_Offset += 4 + 8;
@@ 902-914 (lines=13) @@
899
                $dataSection_Content .= pack('V', $dataProp['data']['data']);
900
901
                $dataSection_Content_Offset += 4 + 4;
902
            } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
903
                // Null-terminated string
904
                $dataProp['data']['data'] .= chr(0);
905
                $dataProp['data']['length'] += 1;
906
                // Complete the string with null string for being a %4
907
                $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4));
908
                $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
909
910
                $dataSection_Content .= pack('V', $dataProp['data']['length']);
911
                $dataSection_Content .= $dataProp['data']['data'];
912
913
                $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
914
            } elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
915
                $dataSection_Content .= $dataProp['data']['data'];
916
917
                $dataSection_Content_Offset += 4 + 8;