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

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