Code Duplication    Length = 9-12 lines in 5 locations

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

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

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

@@ 1668-1676 (lines=9) @@
1665
     *
1666
     * @param int $count The number of external sheet references in this worksheet
1667
     */
1668
    private function writeExterncount($count)
1669
    {
1670
        $record = 0x0016; // Record identifier
1671
        $length = 0x0002; // Number of bytes to follow
1672
1673
        $header = pack('vv', $record, $length);
1674
        $data = pack('v', $count);
1675
        $this->append($header . $data);
1676
    }
1677
1678
    /**
1679
     * Writes the Excel BIFF EXTERNSHEET record. These references are used by
@@ 2010-2020 (lines=11) @@
2007
    /**
2008
     * Write the PRINTHEADERS BIFF record.
2009
     */
2010
    private function writePrintHeaders()
2011
    {
2012
        $record = 0x002a; // Record identifier
2013
        $length = 0x0002; // Bytes to follow
2014
2015
        $fPrintRwCol = $this->printHeaders; // Boolean flag
2016
2017
        $header = pack('vv', $record, $length);
2018
        $data = pack('v', $fPrintRwCol);
2019
        $this->append($header . $data);
2020
    }
2021
2022
    /**
2023
     * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the