Code Duplication    Length = 9-12 lines in 5 locations

src/PhpSpreadsheet/Writer/Xls/Workbook.php 3 locations

@@ 963-971 (lines=9) @@
960
    /**
961
     * Write Internal SUPBOOK record.
962
     */
963
    private function writeSupbookInternal()
964
    {
965
        $record = 0x01AE; // Record identifier
966
        $length = 0x0004; // Bytes to follow
967
968
        $header = pack('vv', $record, $length);
969
        $data = pack('vv', $this->spreadsheet->getSheetCount(), 0x0401);
970
971
        return $this->writeData($header . $data);
972
    }
973
974
    /**
@@ 1240-1250 (lines=11) @@
1237
     *
1238
     * @return string
1239
     */
1240
    private function writeCountry()
1241
    {
1242
        $record = 0x008C; // Record identifier
1243
        $length = 4; // Number of bytes to follow
1244
1245
        $header = pack('vv', $record, $length);
1246
        /* using the same country code always for simplicity */
1247
        $data = pack('vv', $this->countryCode, $this->countryCode);
1248
1249
        return $this->writeData($header . $data);
1250
    }
1251
1252
    /**
1253
     * Write the RECALCID record.
@@ 1257-1268 (lines=12) @@
1254
     *
1255
     * @return string
1256
     */
1257
    private function writeRecalcId()
1258
    {
1259
        $record = 0x01C1; // Record identifier
1260
        $length = 8; // Number of bytes to follow
1261
1262
        $header = pack('vv', $record, $length);
1263
1264
        // by inspection of real Excel files, MS Office Excel 2007 writes this
1265
        $data = pack('VV', 0x000001C1, 0x00001E667);
1266
1267
        return $this->writeData($header . $data);
1268
    }
1269
1270
    /**
1271
     * Stores the PALETTE biff record.

src/PhpSpreadsheet/Writer/Xls/Worksheet.php 2 locations

@@ 1681-1689 (lines=9) @@
1678
     *
1679
     * @param int $count The number of external sheet references in this worksheet
1680
     */
1681
    private function writeExterncount($count)
1682
    {
1683
        $record = 0x0016; // Record identifier
1684
        $length = 0x0002; // Number of bytes to follow
1685
1686
        $header = pack('vv', $record, $length);
1687
        $data = pack('v', $count);
1688
        $this->append($header . $data);
1689
    }
1690
1691
    /**
1692
     * Writes the Excel BIFF EXTERNSHEET record. These references are used by
@@ 2023-2033 (lines=11) @@
2020
    /**
2021
     * Write the PRINTHEADERS BIFF record.
2022
     */
2023
    private function writePrintHeaders()
2024
    {
2025
        $record = 0x002a; // Record identifier
2026
        $length = 0x0002; // Bytes to follow
2027
2028
        $fPrintRwCol = $this->printHeaders; // Boolean flag
2029
2030
        $header = pack('vv', $record, $length);
2031
        $data = pack('v', $fPrintRwCol);
2032
        $this->append($header . $data);
2033
    }
2034
2035
    /**
2036
     * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the