Code Duplication    Length = 9-12 lines in 5 locations

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

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

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

@@ 1657-1665 (lines=9) @@
1654
     *
1655
     * @param int $count The number of external sheet references in this worksheet
1656
     */
1657
    private function writeExterncount($count)
1658
    {
1659
        $record = 0x0016; // Record identifier
1660
        $length = 0x0002; // Number of bytes to follow
1661
1662
        $header = pack('vv', $record, $length);
1663
        $data = pack('v', $count);
1664
        $this->append($header . $data);
1665
    }
1666
1667
    /**
1668
     * Writes the Excel BIFF EXTERNSHEET record. These references are used by
@@ 1999-2009 (lines=11) @@
1996
    /**
1997
     * Write the PRINTHEADERS BIFF record.
1998
     */
1999
    private function writePrintHeaders()
2000
    {
2001
        $record = 0x002a; // Record identifier
2002
        $length = 0x0002; // Bytes to follow
2003
2004
        $fPrintRwCol = $this->printHeaders; // Boolean flag
2005
2006
        $header = pack('vv', $record, $length);
2007
        $data = pack('v', $fPrintRwCol);
2008
        $this->append($header . $data);
2009
    }
2010
2011
    /**
2012
     * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the