Completed
Push — develop ( e95e4d...4fd8e7 )
by Adrien
61:55
created

Escher::readDg()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 8
loc 8
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
4
5
use PhpOffice\PhpSpreadsheet\Cell;
6
use PhpOffice\PhpSpreadsheet\Reader\Xls;
7
use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer;
8
use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer;
9
use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer\SpContainer;
10
use PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer;
11
use PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer;
12
use PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE;
13
use PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE\Blip;
14
15
class Escher
16
{
17
    const DGGCONTAINER = 0xF000;
18
    const BSTORECONTAINER = 0xF001;
19
    const DGCONTAINER = 0xF002;
20
    const SPGRCONTAINER = 0xF003;
21
    const SPCONTAINER = 0xF004;
22
    const DGG = 0xF006;
23
    const BSE = 0xF007;
24
    const DG = 0xF008;
25
    const SPGR = 0xF009;
26
    const SP = 0xF00A;
27
    const OPT = 0xF00B;
28
    const CLIENTTEXTBOX = 0xF00D;
29
    const CLIENTANCHOR = 0xF010;
30
    const CLIENTDATA = 0xF011;
31
    const BLIPJPEG = 0xF01D;
32
    const BLIPPNG = 0xF01E;
33
    const SPLITMENUCOLORS = 0xF11E;
34
    const TERTIARYOPT = 0xF122;
35
36
    /**
37
     * Escher stream data (binary).
38
     *
39
     * @var string
40
     */
41
    private $data;
42
43
    /**
44
     * Size in bytes of the Escher stream data.
45
     *
46
     * @var int
47
     */
48
    private $dataSize;
49
50
    /**
51
     * Current position of stream pointer in Escher stream data.
52
     *
53
     * @var int
54
     */
55
    private $pos;
56
57
    /**
58
     * The object to be returned by the reader. Modified during load.
59
     *
60
     * @var mixed
61
     */
62
    private $object;
63
64
    /**
65
     * Create a new Escher instance.
66
     *
67
     * @param mixed $object
68
     */
69 3
    public function __construct($object)
70
    {
71 3
        $this->object = $object;
72 3
    }
73
74
    /**
75
     * Load Escher stream data. May be a partial Escher stream.
76
     *
77
     * @param string $data
78
     */
79 3
    public function load($data)
80
    {
81 3
        $this->data = $data;
82
83
        // total byte size of Excel data (workbook global substream + sheet substreams)
84 3
        $this->dataSize = strlen($this->data);
85
86 3
        $this->pos = 0;
87
88
        // Parse Escher stream
89 3
        while ($this->pos < $this->dataSize) {
90
            // offset: 2; size: 2: Record Type
91 3
            $fbt = Xls::getUInt2d($this->data, $this->pos + 2);
92
93
            switch ($fbt) {
94 3
                case self::DGGCONTAINER:
95 3
                    $this->readDggContainer();
96 3
97 3
                    break;
98 3
                case self::DGG:
99 3
                    $this->readDgg();
100 3
101 3
                    break;
102 3
                case self::BSTORECONTAINER:
103 3
                    $this->readBstoreContainer();
104 3
105 3
                    break;
106 3
                case self::BSE:
107 3
                    $this->readBSE();
108 3
109 3
                    break;
110 3
                case self::BLIPJPEG:
111 3
                    $this->readBlipJPEG();
112 3
113 3
                    break;
114 3
                case self::BLIPPNG:
115 3
                    $this->readBlipPNG();
116
117
                    break;
118 3
                case self::OPT:
119 2
                    $this->readOPT();
120 2
121 3
                    break;
122 3
                case self::TERTIARYOPT:
123 3
                    $this->readTertiaryOPT();
124 3
125 3
                    break;
126 3
                case self::SPLITMENUCOLORS:
127 3
                    $this->readSplitMenuColors();
128 3
129 3
                    break;
130 3
                case self::DGCONTAINER:
131 3
                    $this->readDgContainer();
132 3
133 3
                    break;
134 3
                case self::DG:
135 3
                    $this->readDg();
136 3
137 3
                    break;
138 3
                case self::SPGRCONTAINER:
139 3
                    $this->readSpgrContainer();
140 1
141 1
                    break;
142 3
                case self::SPCONTAINER:
143 3
                    $this->readSpContainer();
144 3
145 3
                    break;
146 3
                case self::SPGR:
147 3
                    $this->readSpgr();
148
149
                    break;
150
                case self::SP:
151
                    $this->readSp();
152
153
                    break;
154 3
                case self::CLIENTTEXTBOX:
155
                    $this->readClientTextbox();
156
157
                    break;
158
                case self::CLIENTANCHOR:
159
                    $this->readClientAnchor();
160
161
                    break;
162
                case self::CLIENTDATA:
163
                    $this->readClientData();
164
165
                    break;
166
                default:
167
                    $this->readDefault();
168
169
                    break;
170
            }
171
        }
172
173
        return $this->object;
174
    }
175
176
    /**
177
     * Read a generic record.
178
     */
179
    private function readDefault()
180
    {
181 3
        // offset 0; size: 2; recVer and recInstance
182
        $verInstance = Xls::getUInt2d($this->data, $this->pos);
183 3
184 3
        // offset: 2; size: 2: Record Type
185
        $fbt = Xls::getUInt2d($this->data, $this->pos + 2);
0 ignored issues
show
Unused Code introduced by
$fbt is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
186
187 3
        // bit: 0-3; mask: 0x000F; recVer
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
188
        $recVer = (0x000F & $verInstance) >> 0;
0 ignored issues
show
Unused Code introduced by
$recVer is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
189
190 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
191 3
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
192 3
193 3
        // move stream pointer to next record
194 3
        $this->pos += 8 + $length;
195
    }
196
197
    /**
198
     * Read DggContainer record (Drawing Group Container).
199 3
     */
200 View Code Duplication
    private function readDggContainer()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
201 3
    {
202 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
203
        $recordData = substr($this->data, $this->pos + 8, $length);
204
205 3
        // move stream pointer to next record
206 3
        $this->pos += 8 + $length;
207
208
        // record is a container, read contents
209
        $dggContainer = new DggContainer();
210
        $this->object->setDggContainer($dggContainer);
211 3
        $reader = new self($dggContainer);
212
        $reader->load($recordData);
213 3
    }
214 3
215
    /**
216
     * Read Dgg record (Drawing Group).
217 3
     */
218 View Code Duplication
    private function readDgg()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
219
    {
220 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
221 3
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
222 3
223 3
        // move stream pointer to next record
224 3
        $this->pos += 8 + $length;
225
    }
226
227
    /**
228
     * Read BstoreContainer record (Blip Store Container).
229 3
     */
230 View Code Duplication
    private function readBstoreContainer()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
231
    {
232
        $length = Xls::getInt4d($this->data, $this->pos + 4);
233
        $recordData = substr($this->data, $this->pos + 8, $length);
234 3
235
        // move stream pointer to next record
236 3
        $this->pos += 8 + $length;
237 3
238
        // record is a container, read contents
239
        $bstoreContainer = new BstoreContainer();
240 3
        $this->object->setBstoreContainer($bstoreContainer);
241
        $reader = new self($bstoreContainer);
242
        $reader->load($recordData);
243 3
    }
244 3
245
    /**
246 3
     * Read BSE record.
247
     */
248
    private function readBSE()
249 3
    {
250
        // offset: 0; size: 2; recVer and recInstance
251
252 3
        // bit: 4-15; mask: 0xFFF0; recInstance
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
253
        $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
254
255 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
256
        $recordData = substr($this->data, $this->pos + 8, $length);
257
258 3
        // move stream pointer to next record
259
        $this->pos += 8 + $length;
260
261 3
        // add BSE to BstoreContainer
262
        $BSE = new BSE();
263
        $this->object->addBSE($BSE);
264 3
265
        $BSE->setBLIPType($recInstance);
266
267 3
        // offset: 0; size: 1; btWin32 (MSOBLIPTYPE)
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
268
        $btWin32 = ord($recordData[0]);
0 ignored issues
show
Unused Code introduced by
$btWin32 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
269
270 3
        // offset: 1; size: 1; btWin32 (MSOBLIPTYPE)
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
271
        $btMacOS = ord($recordData[1]);
0 ignored issues
show
Unused Code introduced by
$btMacOS is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
272
273 3
        // offset: 2; size: 16; MD4 digest
274
        $rgbUid = substr($recordData, 2, 16);
0 ignored issues
show
Unused Code introduced by
$rgbUid is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
275
276 3
        // offset: 18; size: 2; tag
277
        $tag = Xls::getUInt2d($recordData, 18);
0 ignored issues
show
Unused Code introduced by
$tag is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
278
279 3
        // offset: 20; size: 4; size of BLIP in bytes
280
        $size = Xls::getInt4d($recordData, 20);
0 ignored issues
show
Unused Code introduced by
$size is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
281
282 3
        // offset: 24; size: 4; number of references to this BLIP
283
        $cRef = Xls::getInt4d($recordData, 24);
0 ignored issues
show
Unused Code introduced by
$cRef is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
284
285 3
        // offset: 28; size: 4; MSOFO file offset
286
        $foDelay = Xls::getInt4d($recordData, 28);
0 ignored issues
show
Unused Code introduced by
$foDelay is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
287
288 3
        // offset: 32; size: 1; unused1
289 3
        $unused1 = ord($recordData[32]);
0 ignored issues
show
Unused Code introduced by
$unused1 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
290 3
291
        // offset: 33; size: 1; size of nameData in bytes (including null terminator)
292
        $cbName = ord($recordData[33]);
293
294
        // offset: 34; size: 1; unused2
295 3
        $unused2 = ord($recordData[34]);
0 ignored issues
show
Unused Code introduced by
$unused2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
296
297
        // offset: 35; size: 1; unused3
298
        $unused3 = ord($recordData[35]);
0 ignored issues
show
Unused Code introduced by
$unused3 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
299
300 3
        // offset: 36; size: $cbName; nameData
301
        $nameData = substr($recordData, 36, $cbName);
0 ignored issues
show
Unused Code introduced by
$nameData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
302 3
303 3
        // offset: 36 + $cbName, size: var; the BLIP data
304
        $blipData = substr($recordData, 36 + $cbName);
305
306 3
        // record is a container, read contents
307
        $reader = new self($BSE);
308 3
        $reader->load($blipData);
309
    }
310
311 3
    /**
312 3
     * Read BlipJPEG record. Holds raw JPEG image data.
313
     */
314 View Code Duplication
    private function readBlipJPEG()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
315 3
    {
316
        // offset: 0; size: 2; recVer and recInstance
317
318
        // bit: 4-15; mask: 0xFFF0; recInstance
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
319
        $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
320
321 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
322 3
        $recordData = substr($this->data, $this->pos + 8, $length);
323
324
        // move stream pointer to next record
325 3
        $this->pos += 8 + $length;
326
327 3
        $pos = 0;
328 3
329
        // offset: 0; size: 16; rgbUid1 (MD4 digest of)
330 3
        $rgbUid1 = substr($recordData, 0, 16);
0 ignored issues
show
Unused Code introduced by
$rgbUid1 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
331 3
        $pos += 16;
332
333
        // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
0 ignored issues
show
Unused Code Comprehensibility introduced by
37% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
334
        if (in_array($recInstance, [0x046B, 0x06E3])) {
335
            $rgbUid2 = substr($recordData, 16, 16);
0 ignored issues
show
Unused Code introduced by
$rgbUid2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
336 3
            $pos += 16;
337
        }
338
339
        // offset: var; size: 1; tag
340
        $tag = ord($recordData[$pos]);
0 ignored issues
show
Unused Code introduced by
$tag is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
341 3
        $pos += 1;
342
343 3
        // offset: var; size: var; the raw image data
344 3
        $data = substr($recordData, $pos);
345
346
        $blip = new Blip();
347 3
        $blip->setData($data);
348
349 3
        $this->object->setBlip($blip);
350
    }
351
352 3
    /**
353 3
     * Read BlipPNG record. Holds raw PNG image data.
354
     */
355 View Code Duplication
    private function readBlipPNG()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
356 3
    {
357
        // offset: 0; size: 2; recVer and recInstance
358
359
        // bit: 4-15; mask: 0xFFF0; recInstance
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
360
        $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
361
362 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
363 3
        $recordData = substr($this->data, $this->pos + 8, $length);
364
365
        // move stream pointer to next record
366 3
        $this->pos += 8 + $length;
367
368 3
        $pos = 0;
369 3
370
        // offset: 0; size: 16; rgbUid1 (MD4 digest of)
371 3
        $rgbUid1 = substr($recordData, 0, 16);
0 ignored issues
show
Unused Code introduced by
$rgbUid1 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
372 3
        $pos += 16;
373
374
        // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
0 ignored issues
show
Unused Code Comprehensibility introduced by
37% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
375
        if ($recInstance == 0x06E1) {
376
            $rgbUid2 = substr($recordData, 16, 16);
0 ignored issues
show
Unused Code introduced by
$rgbUid2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
377 3
            $pos += 16;
378
        }
379
380
        // offset: var; size: 1; tag
381
        $tag = ord($recordData[$pos]);
0 ignored issues
show
Unused Code introduced by
$tag is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
382 3
        $pos += 1;
383
384 3
        // offset: var; size: var; the raw image data
385 3
        $data = substr($recordData, $pos);
386
387
        $blip = new Blip();
388 3
        $blip->setData($data);
389
390 3
        $this->object->setBlip($blip);
391 3
    }
392
393
    /**
394
     * Read OPT record. This record may occur within DggContainer record or SpContainer.
395
     */
396 View Code Duplication
    private function readOPT()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
397
    {
398
        // offset: 0; size: 2; recVer and recInstance
399
400
        // bit: 4-15; mask: 0xFFF0; recInstance
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
401
        $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
402
403
        $length = Xls::getInt4d($this->data, $this->pos + 4);
404
        $recordData = substr($this->data, $this->pos + 8, $length);
405
406
        // move stream pointer to next record
407
        $this->pos += 8 + $length;
408
409
        $this->readOfficeArtRGFOPTE($recordData, $recInstance);
410
    }
411
412
    /**
413 2
     * Read TertiaryOPT record.
414
     */
415 2 View Code Duplication
    private function readTertiaryOPT()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
416 2
    {
417
        // offset: 0; size: 2; recVer and recInstance
418
419 2
        // bit: 4-15; mask: 0xFFF0; recInstance
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
420 2
        $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
0 ignored issues
show
Unused Code introduced by
$recInstance is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
421
422
        $length = Xls::getInt4d($this->data, $this->pos + 4);
423
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
424
425 3
        // move stream pointer to next record
426
        $this->pos += 8 + $length;
427 3
    }
428 3
429
    /**
430
     * Read SplitMenuColors record.
431 3
     */
432 View Code Duplication
    private function readSplitMenuColors()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
433
    {
434 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
435 3
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
436 3
437 3
        // move stream pointer to next record
438 3
        $this->pos += 8 + $length;
439
    }
440
441
    /**
442
     * Read DgContainer record (Drawing Container).
443 3
     */
444 View Code Duplication
    private function readDgContainer()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
445 3
    {
446 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
447
        $recordData = substr($this->data, $this->pos + 8, $length);
448
449 3
        // move stream pointer to next record
450 3
        $this->pos += 8 + $length;
451
452
        // record is a container, read contents
453
        $dgContainer = new DgContainer();
454
        $this->object->setDgContainer($dgContainer);
455 3
        $reader = new self($dgContainer);
456
        $escher = $reader->load($recordData);
0 ignored issues
show
Unused Code introduced by
$escher is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
457
    }
458
459 3
    /**
460 3
     * Read Dg record (Drawing).
461
     */
462 View Code Duplication
    private function readDg()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
463 3
    {
464
        $length = Xls::getInt4d($this->data, $this->pos + 4);
465
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
466 3
467
        // move stream pointer to next record
468 3
        $this->pos += 8 + $length;
469
    }
470 3
471
    /**
472
     * Read SpgrContainer record (Shape Group Container).
473
     */
474
    private function readSpgrContainer()
475
    {
476 3
        // context is either context DgContainer or SpgrContainer
477 3
478 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
479
        $recordData = substr($this->data, $this->pos + 8, $length);
480
481
        // move stream pointer to next record
482
        $this->pos += 8 + $length;
483 3
484
        // record is a container, read contents
485 3
        $spgrContainer = new SpgrContainer();
486 3
487
        if ($this->object instanceof DgContainer) {
488
            // DgContainer
489 3
            $this->object->setSpgrContainer($spgrContainer);
490 3
        } else {
491
            // SpgrContainer
492
            $this->object->addChild($spgrContainer);
493 3
        }
494
495
        $reader = new self($spgrContainer);
496 3
        $escher = $reader->load($recordData);
0 ignored issues
show
Unused Code introduced by
$escher is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
497 3
    }
498 3
499
    /**
500
     * Read SpContainer record (Shape Container).
501
     */
502 View Code Duplication
    private function readSpContainer()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
503 3
    {
504
        $length = Xls::getInt4d($this->data, $this->pos + 4);
505 3
        $recordData = substr($this->data, $this->pos + 8, $length);
506 3
507
        // add spContainer to spgrContainer
508
        $spContainer = new SpContainer();
509 3
        $this->object->addChild($spContainer);
510 3
511
        // move stream pointer to next record
512
        $this->pos += 8 + $length;
513
514
        // record is a container, read contents
515 3
        $reader = new self($spContainer);
516
        $escher = $reader->load($recordData);
0 ignored issues
show
Unused Code introduced by
$escher is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
517
    }
518
519
    /**
520 3
     * Read Spgr record (Shape Group).
521
     */
522 3 View Code Duplication
    private function readSpgr()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
523 3
    {
524
        $length = Xls::getInt4d($this->data, $this->pos + 4);
525
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
526 3
527 3
        // move stream pointer to next record
528
        $this->pos += 8 + $length;
529
    }
530
531
    /**
532 1
     * Read Sp record (Shape).
533
     */
534 View Code Duplication
    private function readSp()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
535
    {
536
        // offset: 0; size: 2; recVer and recInstance
537 1
538
        // bit: 4-15; mask: 0xFFF0; recInstance
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
539 1
        $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
0 ignored issues
show
Unused Code introduced by
$recInstance is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
540 1
541
        $length = Xls::getInt4d($this->data, $this->pos + 4);
542
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
543 1
544 1
        // move stream pointer to next record
545
        $this->pos += 8 + $length;
546
    }
547
548
    /**
549 3
     * Read ClientTextbox record.
550
     */
551 3 View Code Duplication
    private function readClientTextbox()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
552 3
    {
553
        // offset: 0; size: 2; recVer and recInstance
554
555 3
        // bit: 4-15; mask: 0xFFF0; recInstance
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
556
        $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4;
0 ignored issues
show
Unused Code introduced by
$recInstance is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
557
558 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
559
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
560
561 3
        // move stream pointer to next record
562
        $this->pos += 8 + $length;
563
    }
564 3
565
    /**
566
     * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet.
567 3
     */
568
    private function readClientAnchor()
569
    {
570 3
        $length = Xls::getInt4d($this->data, $this->pos + 4);
571
        $recordData = substr($this->data, $this->pos + 8, $length);
572
573 3
        // move stream pointer to next record
574
        $this->pos += 8 + $length;
575
576 3
        // offset: 2; size: 2; upper-left corner column index (0-based)
577
        $c1 = Xls::getUInt2d($recordData, 2);
578
579 3
        // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width
580
        $startOffsetX = Xls::getUInt2d($recordData, 4);
581
582 3
        // offset: 6; size: 2; upper-left corner row index (0-based)
583
        $r1 = Xls::getUInt2d($recordData, 6);
584
585 3
        // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height
586
        $startOffsetY = Xls::getUInt2d($recordData, 8);
587
588 3
        // offset: 10; size: 2; bottom-right corner column index (0-based)
589
        $c2 = Xls::getUInt2d($recordData, 10);
590
591 3
        // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width
592
        $endOffsetX = Xls::getUInt2d($recordData, 12);
593
594 3
        // offset: 14; size: 2; bottom-right corner row index (0-based)
595
        $r2 = Xls::getUInt2d($recordData, 14);
596
597 3
        // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height
598 3
        $endOffsetY = Xls::getUInt2d($recordData, 16);
599
600
        // set the start coordinates
601
        $this->object->setStartCoordinates(Cell::stringFromColumnIndex($c1) . ($r1 + 1));
602
603 3
        // set the start offsetX
604
        $this->object->setStartOffsetX($startOffsetX);
605 3
606 3
        // set the start offsetY
607
        $this->object->setStartOffsetY($startOffsetY);
608
609 3
        // set the end coordinates
610 3
        $this->object->setEndCoordinates(Cell::stringFromColumnIndex($c2) . ($r2 + 1));
611
612
        // set the end offsetX
613
        $this->object->setEndOffsetX($endOffsetX);
614
615
        // set the end offsetY
616
        $this->object->setEndOffsetY($endOffsetY);
617
    }
618 3
619
    /**
620 3
     * Read ClientData record.
621
     */
622 View Code Duplication
    private function readClientData()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
623 3
    {
624
        $length = Xls::getInt4d($this->data, $this->pos + 4);
625 3
        $recordData = substr($this->data, $this->pos + 8, $length);
0 ignored issues
show
Unused Code introduced by
$recordData is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
626
627
        // move stream pointer to next record
628 3
        $this->pos += 8 + $length;
629
    }
630
631 3
    /**
632
     * Read OfficeArtRGFOPTE table of property-value pairs.
633
     *
634 3
     * @param string $data Binary data
635
     * @param int $n Number of properties
636
     */
637 3
    private function readOfficeArtRGFOPTE($data, $n)
638
    {
639
        $splicedComplexData = substr($data, 6 * $n);
640 3
641
        // loop through property-value pairs
642 3
        for ($i = 0; $i < $n; ++$i) {
643 2
            // read 6 bytes at a time
644 2
            $fopte = substr($data, 6 * $i, 6);
645
646
            // offset: 0; size: 2; opid
647 2
            $opid = Xls::getUInt2d($fopte, 0);
648
649
            // bit: 0-13; mask: 0x3FFF; opid.opid
650 3
            $opidOpid = (0x3FFF & $opid) >> 0;
651
652
            // bit: 14; mask 0x4000; 1 = value in op field is BLIP identifier
653 3
            $opidFBid = (0x4000 & $opid) >> 14;
0 ignored issues
show
Unused Code introduced by
$opidFBid is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
654
655 3
            // bit: 15; mask 0x8000; 1 = this is a complex property, op field specifies size of complex data
656
            $opidFComplex = (0x8000 & $opid) >> 15;
657
658
            // offset: 2; size: 4; the value for this property
659
            $op = Xls::getInt4d($fopte, 2);
660
661
            if ($opidFComplex) {
662
                $complexData = substr($splicedComplexData, 0, $op);
663
                $splicedComplexData = substr($splicedComplexData, $op);
664
665
                // we store string value with complex data
666
                $value = $complexData;
667
            } else {
668
                // we store integer value
669
                $value = $op;
670
            }
671
672
            $this->object->setOPT($opidOpid, $value);
673
        }
674
    }
675
}
676