Code Duplication    Length = 14-16 lines in 4 locations

src/PhpSpreadsheet/Reader/Xls/Escher.php 4 locations

@@ 193-206 (lines=14) @@
190
    /**
191
     * Read DggContainer record (Drawing Group Container)
192
     */
193
    private function readDggContainer()
194
    {
195
        $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4);
196
        $recordData = substr($this->data, $this->pos + 8, $length);
197
198
        // move stream pointer to next record
199
        $this->pos += 8 + $length;
200
201
        // record is a container, read contents
202
        $dggContainer = new \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer();
203
        $this->object->setDggContainer($dggContainer);
204
        $reader = new self($dggContainer);
205
        $reader->load($recordData);
206
    }
207
208
    /**
209
     * Read Dgg record (Drawing Group)
@@ 223-236 (lines=14) @@
220
    /**
221
     * Read BstoreContainer record (Blip Store Container)
222
     */
223
    private function readBstoreContainer()
224
    {
225
        $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4);
226
        $recordData = substr($this->data, $this->pos + 8, $length);
227
228
        // move stream pointer to next record
229
        $this->pos += 8 + $length;
230
231
        // record is a container, read contents
232
        $bstoreContainer = new \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer();
233
        $this->object->setBstoreContainer($bstoreContainer);
234
        $reader = new self($bstoreContainer);
235
        $reader->load($recordData);
236
    }
237
238
    /**
239
     * Read BSE record
@@ 437-450 (lines=14) @@
434
    /**
435
     * Read DgContainer record (Drawing Container)
436
     */
437
    private function readDgContainer()
438
    {
439
        $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4);
440
        $recordData = substr($this->data, $this->pos + 8, $length);
441
442
        // move stream pointer to next record
443
        $this->pos += 8 + $length;
444
445
        // record is a container, read contents
446
        $dgContainer = new \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer();
447
        $this->object->setDgContainer($dgContainer);
448
        $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls\Escher($dgContainer);
449
        $escher = $reader->load($recordData);
450
    }
451
452
    /**
453
     * Read Dg record (Drawing)
@@ 495-510 (lines=16) @@
492
    /**
493
     * Read SpContainer record (Shape Container)
494
     */
495
    private function readSpContainer()
496
    {
497
        $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4);
498
        $recordData = substr($this->data, $this->pos + 8, $length);
499
500
        // add spContainer to spgrContainer
501
        $spContainer = new \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer\SpContainer();
502
        $this->object->addChild($spContainer);
503
504
        // move stream pointer to next record
505
        $this->pos += 8 + $length;
506
507
        // record is a container, read contents
508
        $reader = new self($spContainer);
509
        $escher = $reader->load($recordData);
510
    }
511
512
    /**
513
     * Read Spgr record (Shape Group)