Code Duplication    Length = 9-12 lines in 5 locations

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

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

@@ 974-982 (lines=9) @@
971
    /**
972
     * Write Internal SUPBOOK record.
973
     */
974
    private function writeSupbookInternal()
975
    {
976
        $record = 0x01AE; // Record identifier
977
        $length = 0x0004; // Bytes to follow
978
979
        $header = pack('vv', $record, $length);
980
        $data = pack('vv', $this->spreadsheet->getSheetCount(), 0x0401);
981
982
        return $this->writeData($header . $data);
983
    }
984
985
    /**
@@ 1251-1261 (lines=11) @@
1248
     *
1249
     * @return string
1250
     */
1251
    private function writeCountry()
1252
    {
1253
        $record = 0x008C; // Record identifier
1254
        $length = 4; // Number of bytes to follow
1255
1256
        $header = pack('vv', $record, $length);
1257
        /* using the same country code always for simplicity */
1258
        $data = pack('vv', $this->countryCode, $this->countryCode);
1259
1260
        return $this->writeData($header . $data);
1261
    }
1262
1263
    /**
1264
     * Write the RECALCID record.
@@ 1268-1279 (lines=12) @@
1265
     *
1266
     * @return string
1267
     */
1268
    private function writeRecalcId()
1269
    {
1270
        $record = 0x01C1; // Record identifier
1271
        $length = 8; // Number of bytes to follow
1272
1273
        $header = pack('vv', $record, $length);
1274
1275
        // by inspection of real Excel files, MS Office Excel 2007 writes this
1276
        $data = pack('VV', 0x000001C1, 0x00001E667);
1277
1278
        return $this->writeData($header . $data);
1279
    }
1280
1281
    /**
1282
     * Stores the PALETTE biff record.