Code Duplication    Length = 22-23 lines in 2 locations

src/PhpSpreadsheet/Reader/Xls.php 2 locations

@@ 3094-3116 (lines=23) @@
3091
    /**
3092
     * Read HEADER record
3093
     */
3094
    private function readHeader()
3095
    {
3096
        $length = self::getInt2d($this->data, $this->pos + 2);
3097
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
3098
3099
        // move stream pointer to next record
3100
        $this->pos += 4 + $length;
3101
3102
        if (!$this->readDataOnly) {
3103
            // offset: 0; size: var
3104
            // realized that $recordData can be empty even when record exists
3105
            if ($recordData) {
3106
                if ($this->version == self::XLS_BIFF8) {
3107
                    $string = self::readUnicodeStringLong($recordData);
3108
                } else {
3109
                    $string = $this->readByteStringShort($recordData);
3110
                }
3111
3112
                $this->phpSheet->getHeaderFooter()->setOddHeader($string['value']);
3113
                $this->phpSheet->getHeaderFooter()->setEvenHeader($string['value']);
3114
            }
3115
        }
3116
    }
3117
3118
    /**
3119
     * Read FOOTER record
@@ 3121-3142 (lines=22) @@
3118
    /**
3119
     * Read FOOTER record
3120
     */
3121
    private function readFooter()
3122
    {
3123
        $length = self::getInt2d($this->data, $this->pos + 2);
3124
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
3125
3126
        // move stream pointer to next record
3127
        $this->pos += 4 + $length;
3128
3129
        if (!$this->readDataOnly) {
3130
            // offset: 0; size: var
3131
            // realized that $recordData can be empty even when record exists
3132
            if ($recordData) {
3133
                if ($this->version == self::XLS_BIFF8) {
3134
                    $string = self::readUnicodeStringLong($recordData);
3135
                } else {
3136
                    $string = $this->readByteStringShort($recordData);
3137
                }
3138
                $this->phpSheet->getHeaderFooter()->setOddFooter($string['value']);
3139
                $this->phpSheet->getHeaderFooter()->setEvenFooter($string['value']);
3140
            }
3141
        }
3142
    }
3143
3144
    /**
3145
     * Read HCENTER record