Escher::close()   F
last analyzed

Complexity

Conditions 27
Paths 32

Size

Total Lines 432
Code Lines 250

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 242
CRAP Score 27.0004

Importance

Changes 0
Metric Value
eloc 250
dl 0
loc 432
ccs 242
cts 244
cp 0.9918
rs 3.3333
c 0
b 0
f 0
cc 27
nc 32
nop 0
crap 27.0004

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Writer\Xls;
4
5
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
6
use PhpOffice\PhpSpreadsheet\Shared\Escher as SharedEscher;
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
    /**
18
     * The object we are writing.
19
     */
20
    private Blip|BSE|BstoreContainer|DgContainer|DggContainer|Escher|SpContainer|SpgrContainer|SharedEscher $object;
21
22
    /**
23
     * The written binary data.
24
     */
25
    private string $data;
26
27
    /**
28
     * Shape offsets. Positions in binary stream where a new shape record begins.
29
     */
30
    private array $spOffsets;
31
32
    /**
33
     * Shape types.
34
     */
35
    private array $spTypes;
36
37
    /**
38
     * Constructor.
39
     */
40 14
    public function __construct(Blip|BSE|BstoreContainer|DgContainer|DggContainer|self|SpContainer|SpgrContainer|SharedEscher $object)
41
    {
42 14
        $this->object = $object;
43
    }
44
45
    /**
46
     * Process the object to be written.
47
     */
48 14
    public function close(): string
49
    {
50
        // initialize
51 14
        $this->data = '';
52
53 14
        switch ($this->object::class) {
54
            case SharedEscher::class:
55 14
                if ($dggContainer = $this->object->getDggContainer()) {
56 14
                    $writer = new self($dggContainer);
57 14
                    $this->data = $writer->close();
58 14
                } elseif ($dgContainer = $this->object->getDgContainer()) {
59 14
                    $writer = new self($dgContainer);
60 14
                    $this->data = $writer->close();
61 14
                    $this->spOffsets = $writer->getSpOffsets();
62 14
                    $this->spTypes = $writer->getSpTypes();
63
                }
64
65 14
                break;
66
            case DggContainer::class:
67
                // this is a container record
68
69
                // initialize
70 14
                $innerData = '';
71
72
                // write the dgg
73 14
                $recVer = 0x0;
74 14
                $recInstance = 0x0000;
75 14
                $recType = 0xF006;
76
77 14
                $recVerInstance = $recVer;
78 14
                $recVerInstance |= $recInstance << 4;
79
80
                // dgg data
81 14
                $dggData
82 14
                    = pack(
83 14
                        'VVVV',
84 14
                        $this->object->getSpIdMax(), // maximum shape identifier increased by one
85 14
                        $this->object->getCDgSaved() + 1, // number of file identifier clusters increased by one
86 14
                        $this->object->getCSpSaved(),
87 14
                        $this->object->getCDgSaved() // count total number of drawings saved
88 14
                    );
89
90
                // add file identifier clusters (one per drawing)
91 14
                $IDCLs = $this->object->getIDCLs();
92
93 14
                foreach ($IDCLs as $dgId => $maxReducedSpId) {
94 14
                    $dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
95
                }
96
97 14
                $header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
98 14
                $innerData .= $header . $dggData;
99
100
                // write the bstoreContainer
101 14
                if ($bstoreContainer = $this->object->getBstoreContainer()) {
0 ignored issues
show
Bug introduced by
The method getBstoreContainer() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

101
                if ($bstoreContainer = $this->object->/** @scrutinizer ignore-call */ getBstoreContainer()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
102 14
                    $writer = new self($bstoreContainer);
103 14
                    $innerData .= $writer->close();
104
                }
105
106
                // write the record
107 14
                $recVer = 0xF;
108 14
                $recInstance = 0x0000;
109 14
                $recType = 0xF000;
110 14
                $length = strlen($innerData);
111
112 14
                $recVerInstance = $recVer;
113 14
                $recVerInstance |= $recInstance << 4;
114
115 14
                $header = pack('vvV', $recVerInstance, $recType, $length);
116
117 14
                $this->data = $header . $innerData;
118
119 14
                break;
120
            case BstoreContainer::class:
121
                // this is a container record
122
123
                // initialize
124 14
                $innerData = '';
125
126
                // treat the inner data
127 14
                if ($BSECollection = $this->object->getBSECollection()) {
0 ignored issues
show
Bug introduced by
The method getBSECollection() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

127
                if ($BSECollection = $this->object->/** @scrutinizer ignore-call */ getBSECollection()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
128 11
                    foreach ($BSECollection as $BSE) {
129 11
                        $writer = new self($BSE);
130 11
                        $innerData .= $writer->close();
131
                    }
132
                }
133
134
                // write the record
135 14
                $recVer = 0xF;
136 14
                $recInstance = count($this->object->getBSECollection());
137 14
                $recType = 0xF001;
138 14
                $length = strlen($innerData);
139
140 14
                $recVerInstance = $recVer;
141 14
                $recVerInstance |= $recInstance << 4;
142
143 14
                $header = pack('vvV', $recVerInstance, $recType, $length);
144
145 14
                $this->data = $header . $innerData;
146
147 14
                break;
148
            case BSE::class:
149
                // this is a semi-container record
150
151
                // initialize
152 11
                $innerData = '';
153
154
                // here we treat the inner data
155 11
                if ($blip = $this->object->getBlip()) {
0 ignored issues
show
Bug introduced by
The method getBlip() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

155
                if ($blip = $this->object->/** @scrutinizer ignore-call */ getBlip()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
156 11
                    $writer = new self($blip);
157 11
                    $innerData .= $writer->close();
158
                }
159
160
                // initialize
161 11
                $data = '';
162
163 11
                $btWin32 = $this->object->getBlipType();
0 ignored issues
show
Bug introduced by
The method getBlipType() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

163
                /** @scrutinizer ignore-call */ 
164
                $btWin32 = $this->object->getBlipType();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
164 11
                $btMacOS = $this->object->getBlipType();
165 11
                $data .= pack('CC', $btWin32, $btMacOS);
166
167 11
                $rgbUid = pack('VVVV', 0, 0, 0, 0); // todo
168 11
                $data .= $rgbUid;
169
170 11
                $tag = 0;
171 11
                $size = strlen($innerData);
172 11
                $cRef = 1;
173 11
                $foDelay = 0; //todo
174 11
                $unused1 = 0x0;
175 11
                $cbName = 0x0;
176 11
                $unused2 = 0x0;
177 11
                $unused3 = 0x0;
178 11
                $data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
179
180 11
                $data .= $innerData;
181
182
                // write the record
183 11
                $recVer = 0x2;
184 11
                $recInstance = $this->object->getBlipType();
185 11
                $recType = 0xF007;
186 11
                $length = strlen($data);
187
188 11
                $recVerInstance = $recVer;
189 11
                $recVerInstance |= $recInstance << 4;
190
191 11
                $header = pack('vvV', $recVerInstance, $recType, $length);
192
193 11
                $this->data = $header;
194
195 11
                $this->data .= $data;
196
197 11
                break;
198
            case Blip::class:
199
                // this is an atom record
200
201
                // write the record
202 11
                switch ($this->object->getParent()->getBlipType()) {
0 ignored issues
show
Bug introduced by
The method getParent() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

202
                switch ($this->object->/** @scrutinizer ignore-call */ getParent()->getBlipType()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
203
                    case BSE::BLIPTYPE_JPEG:
204
                        // initialize
205 9
                        $innerData = '';
206
207 9
                        $rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo
208 9
                        $innerData .= $rgbUid1;
209
210 9
                        $tag = 0xFF; // todo
211 9
                        $innerData .= pack('C', $tag);
212
213 9
                        $innerData .= $this->object->getData();
0 ignored issues
show
Bug introduced by
The method getData() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

213
                        $innerData .= $this->object->/** @scrutinizer ignore-call */ getData();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
214
215 9
                        $recVer = 0x0;
216 9
                        $recInstance = 0x46A;
217 9
                        $recType = 0xF01D;
218 9
                        $length = strlen($innerData);
219
220 9
                        $recVerInstance = $recVer;
221 9
                        $recVerInstance |= $recInstance << 4;
222
223 9
                        $header = pack('vvV', $recVerInstance, $recType, $length);
224
225 9
                        $this->data = $header;
226
227 9
                        $this->data .= $innerData;
228
229 9
                        break;
230
                    case BSE::BLIPTYPE_PNG:
231
                        // initialize
232 11
                        $innerData = '';
233
234 11
                        $rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo
235 11
                        $innerData .= $rgbUid1;
236
237 11
                        $tag = 0xFF; // todo
238 11
                        $innerData .= pack('C', $tag);
239
240 11
                        $innerData .= $this->object->getData();
241
242 11
                        $recVer = 0x0;
243 11
                        $recInstance = 0x6E0;
244 11
                        $recType = 0xF01E;
245 11
                        $length = strlen($innerData);
246
247 11
                        $recVerInstance = $recVer;
248 11
                        $recVerInstance |= $recInstance << 4;
249
250 11
                        $header = pack('vvV', $recVerInstance, $recType, $length);
251
252 11
                        $this->data = $header;
253
254 11
                        $this->data .= $innerData;
255
256 11
                        break;
257
                }
258
259 11
                break;
260
            case DgContainer::class:
261
                // this is a container record
262
263
                // initialize
264 14
                $innerData = '';
265
266
                // write the dg
267 14
                $recVer = 0x0;
268 14
                $recInstance = $this->object->getDgId();
0 ignored issues
show
Bug introduced by
The method getDgId() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

268
                /** @scrutinizer ignore-call */ 
269
                $recInstance = $this->object->getDgId();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
269 14
                $recType = 0xF008;
270 14
                $length = 8;
271
272 14
                $recVerInstance = $recVer;
273 14
                $recVerInstance |= $recInstance << 4;
274
275 14
                $header = pack('vvV', $recVerInstance, $recType, $length);
276
277
                // number of shapes in this drawing (including group shape)
278 14
                $countShapes = count($this->object->getSpgrContainerOrThrow()->getChildren());
0 ignored issues
show
Bug introduced by
The method getSpgrContainerOrThrow() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

278
                $countShapes = count($this->object->/** @scrutinizer ignore-call */ getSpgrContainerOrThrow()->getChildren());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
279 14
                $innerData .= $header . pack('VV', $countShapes, $this->object->getLastSpId());
0 ignored issues
show
Bug introduced by
The method getLastSpId() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

279
                $innerData .= $header . pack('VV', $countShapes, $this->object->/** @scrutinizer ignore-call */ getLastSpId());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
280
281
                // write the spgrContainer
282 14
                if ($spgrContainer = $this->object->getSpgrContainer()) {
0 ignored issues
show
Bug introduced by
The method getSpgrContainer() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. Did you maybe mean getDggContainer()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

282
                if ($spgrContainer = $this->object->/** @scrutinizer ignore-call */ getSpgrContainer()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
283 14
                    $writer = new self($spgrContainer);
284 14
                    $innerData .= $writer->close();
285
286
                    // get the shape offsets relative to the spgrContainer record
287 14
                    $spOffsets = $writer->getSpOffsets();
288 14
                    $spTypes = $writer->getSpTypes();
289
290
                    // save the shape offsets relative to dgContainer
291 14
                    foreach ($spOffsets as &$spOffset) {
292 14
                        $spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
293
                    }
294
295 14
                    $this->spOffsets = $spOffsets;
296 14
                    $this->spTypes = $spTypes;
297
                }
298
299
                // write the record
300 14
                $recVer = 0xF;
301 14
                $recInstance = 0x0000;
302 14
                $recType = 0xF002;
303 14
                $length = strlen($innerData);
304
305 14
                $recVerInstance = $recVer;
306 14
                $recVerInstance |= $recInstance << 4;
307
308 14
                $header = pack('vvV', $recVerInstance, $recType, $length);
309
310 14
                $this->data = $header . $innerData;
311
312 14
                break;
313
            case SpgrContainer::class:
314
                // this is a container record
315
316
                // initialize
317 14
                $innerData = '';
318
319
                // initialize spape offsets
320 14
                $totalSize = 8;
321 14
                $spOffsets = [];
322 14
                $spTypes = [];
323
324
                // treat the inner data
325 14
                foreach ($this->object->getChildren() as $spContainer) {
0 ignored issues
show
Bug introduced by
The method getChildren() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

325
                foreach ($this->object->/** @scrutinizer ignore-call */ getChildren() as $spContainer) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
326 14
                    $writer = new self($spContainer);
327 14
                    $spData = $writer->close();
328 14
                    $innerData .= $spData;
329
330
                    // save the shape offsets (where new shape records begin)
331 14
                    $totalSize += strlen($spData);
332 14
                    $spOffsets[] = $totalSize;
333
334 14
                    $spTypes = array_merge($spTypes, $writer->getSpTypes());
335
                }
336
337
                // write the record
338 14
                $recVer = 0xF;
339 14
                $recInstance = 0x0000;
340 14
                $recType = 0xF003;
341 14
                $length = strlen($innerData);
342
343 14
                $recVerInstance = $recVer;
344 14
                $recVerInstance |= $recInstance << 4;
345
346 14
                $header = pack('vvV', $recVerInstance, $recType, $length);
347
348 14
                $this->data = $header . $innerData;
349 14
                $this->spOffsets = $spOffsets;
350 14
                $this->spTypes = $spTypes;
351
352 14
                break;
353
            case SpContainer::class:
354
                // initialize
355 14
                $data = '';
356
357
                // build the data
358
359
                // write group shape record, if necessary?
360 14
                if ($this->object->getSpgr()) {
0 ignored issues
show
Bug introduced by
The method getSpgr() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

360
                if ($this->object->/** @scrutinizer ignore-call */ getSpgr()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
361 14
                    $recVer = 0x1;
362 14
                    $recInstance = 0x0000;
363 14
                    $recType = 0xF009;
364 14
                    $length = 0x00000010;
365
366 14
                    $recVerInstance = $recVer;
367 14
                    $recVerInstance |= $recInstance << 4;
368
369 14
                    $header = pack('vvV', $recVerInstance, $recType, $length);
370
371 14
                    $data .= $header . pack('VVVV', 0, 0, 0, 0);
372
                }
373 14
                $this->spTypes[] = ($this->object->getSpType());
0 ignored issues
show
Bug introduced by
The method getSpType() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

373
                /** @scrutinizer ignore-call */ 
374
                $this->spTypes[] = ($this->object->getSpType());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
374
375
                // write the shape record
376 14
                $recVer = 0x2;
377 14
                $recInstance = $this->object->getSpType(); // shape type
378 14
                $recType = 0xF00A;
379 14
                $length = 0x00000008;
380
381 14
                $recVerInstance = $recVer;
382 14
                $recVerInstance |= $recInstance << 4;
383
384 14
                $header = pack('vvV', $recVerInstance, $recType, $length);
385
386 14
                $data .= $header . pack('VV', $this->object->getSpId(), $this->object->getSpgr() ? 0x0005 : 0x0A00);
0 ignored issues
show
Bug introduced by
The method getSpId() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

386
                $data .= $header . pack('VV', $this->object->/** @scrutinizer ignore-call */ getSpId(), $this->object->getSpgr() ? 0x0005 : 0x0A00);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
387
388
                // the options
389 14
                if ($this->object->getOPTCollection()) {
0 ignored issues
show
Bug introduced by
The method getOPTCollection() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

389
                if ($this->object->/** @scrutinizer ignore-call */ getOPTCollection()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
390 14
                    $optData = '';
391
392 14
                    $recVer = 0x3;
393 14
                    $recInstance = count($this->object->getOPTCollection());
394 14
                    $recType = 0xF00B;
395 14
                    foreach ($this->object->getOPTCollection() as $property => $value) {
396 14
                        $optData .= pack('vV', $property, $value);
397
                    }
398 14
                    $length = strlen($optData);
399
400 14
                    $recVerInstance = $recVer;
401 14
                    $recVerInstance |= $recInstance << 4;
402
403 14
                    $header = pack('vvV', $recVerInstance, $recType, $length);
404 14
                    $data .= $header . $optData;
405
                }
406
407
                // the client anchor
408 14
                if ($this->object->getStartCoordinates()) {
0 ignored issues
show
Bug introduced by
The method getStartCoordinates() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

408
                if ($this->object->/** @scrutinizer ignore-call */ getStartCoordinates()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
409 14
                    $recVer = 0x0;
410 14
                    $recInstance = 0x0;
411 14
                    $recType = 0xF010;
412
413
                    // start coordinates
414 14
                    [$column, $row] = Coordinate::indexesFromString($this->object->getStartCoordinates());
415 14
                    $c1 = $column - 1;
416 14
                    $r1 = $row - 1;
417
418
                    // start offsetX
419 14
                    $startOffsetX = $this->object->getStartOffsetX();
0 ignored issues
show
Bug introduced by
The method getStartOffsetX() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

419
                    /** @scrutinizer ignore-call */ 
420
                    $startOffsetX = $this->object->getStartOffsetX();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
420
421
                    // start offsetY
422 14
                    $startOffsetY = $this->object->getStartOffsetY();
0 ignored issues
show
Bug introduced by
The method getStartOffsetY() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

422
                    /** @scrutinizer ignore-call */ 
423
                    $startOffsetY = $this->object->getStartOffsetY();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
423
424
                    // end coordinates
425 14
                    [$column, $row] = Coordinate::indexesFromString($this->object->getEndCoordinates());
0 ignored issues
show
Bug introduced by
The method getEndCoordinates() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

425
                    [$column, $row] = Coordinate::indexesFromString($this->object->/** @scrutinizer ignore-call */ getEndCoordinates());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
426 14
                    $c2 = $column - 1;
427 14
                    $r2 = $row - 1;
428
429
                    // end offsetX
430 14
                    $endOffsetX = $this->object->getEndOffsetX();
0 ignored issues
show
Bug introduced by
The method getEndOffsetX() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

430
                    /** @scrutinizer ignore-call */ 
431
                    $endOffsetX = $this->object->getEndOffsetX();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
431
432
                    // end offsetY
433 14
                    $endOffsetY = $this->object->getEndOffsetY();
0 ignored issues
show
Bug introduced by
The method getEndOffsetY() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

433
                    /** @scrutinizer ignore-call */ 
434
                    $endOffsetY = $this->object->getEndOffsetY();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
434
435 14
                    $clientAnchorData = pack('vvvvvvvvv', $this->object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);
0 ignored issues
show
Bug introduced by
The method getSpFlag() does not exist on PhpOffice\PhpSpreadsheet\Shared\Escher. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

435
                    $clientAnchorData = pack('vvvvvvvvv', $this->object->/** @scrutinizer ignore-call */ getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
436
437 14
                    $length = strlen($clientAnchorData);
438
439 14
                    $recVerInstance = $recVer;
440 14
                    $recVerInstance |= $recInstance << 4;
441
442 14
                    $header = pack('vvV', $recVerInstance, $recType, $length);
443 14
                    $data .= $header . $clientAnchorData;
444
                }
445
446
                // the client data, just empty for now
447 14
                if (!$this->object->getSpgr()) {
448 14
                    $clientDataData = '';
449
450 14
                    $recVer = 0x0;
451 14
                    $recInstance = 0x0;
452 14
                    $recType = 0xF011;
453
454 14
                    $length = strlen($clientDataData);
455
456 14
                    $recVerInstance = $recVer;
457 14
                    $recVerInstance |= $recInstance << 4;
458
459 14
                    $header = pack('vvV', $recVerInstance, $recType, $length);
460 14
                    $data .= $header . $clientDataData;
461
                }
462
463
                // write the record
464 14
                $recVer = 0xF;
465 14
                $recInstance = 0x0000;
466 14
                $recType = 0xF004;
467 14
                $length = strlen($data);
468
469 14
                $recVerInstance = $recVer;
470 14
                $recVerInstance |= $recInstance << 4;
471
472 14
                $header = pack('vvV', $recVerInstance, $recType, $length);
473
474 14
                $this->data = $header . $data;
475
476 14
                break;
477
        }
478
479 14
        return $this->data;
480
    }
481
482
    /**
483
     * Gets the shape offsets.
484
     */
485 14
    public function getSpOffsets(): array
486
    {
487 14
        return $this->spOffsets;
488
    }
489
490
    /**
491
     * Gets the shape types.
492
     */
493 14
    public function getSpTypes(): array
494
    {
495 14
        return $this->spTypes;
496
    }
497
}
498