Code Duplication    Length = 13-14 lines in 7 locations

src/PhpSpreadsheet/Style/Alignment.php 2 locations

@@ 341-353 (lines=13) @@
338
     *
339
     * @return Alignment
340
     */
341
    public function setWrapText($pValue = false)
342
    {
343
        if ($pValue == '') {
344
            $pValue = false;
345
        }
346
        if ($this->isSupervisor) {
347
            $styleArray = $this->getStyleArray(['wrap' => $pValue]);
348
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
349
        } else {
350
            $this->wrapText = $pValue;
351
        }
352
353
        return $this;
354
    }
355
356
    /**
@@ 377-389 (lines=13) @@
374
     *
375
     * @return Alignment
376
     */
377
    public function setShrinkToFit($pValue = false)
378
    {
379
        if ($pValue == '') {
380
            $pValue = false;
381
        }
382
        if ($this->isSupervisor) {
383
            $styleArray = $this->getStyleArray(['shrinkToFit' => $pValue]);
384
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
385
        } else {
386
            $this->shrinkToFit = $pValue;
387
        }
388
389
        return $this;
390
    }
391
392
    /**

src/PhpSpreadsheet/Style/Font.php 5 locations

@@ 315-327 (lines=13) @@
312
     *
313
     * @return Font
314
     */
315
    public function setBold($pValue = false)
316
    {
317
        if ($pValue == '') {
318
            $pValue = false;
319
        }
320
        if ($this->isSupervisor) {
321
            $styleArray = $this->getStyleArray(['bold' => $pValue]);
322
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
323
        } else {
324
            $this->bold = $pValue;
325
        }
326
327
        return $this;
328
    }
329
330
    /**
@@ 351-363 (lines=13) @@
348
     *
349
     * @return Font
350
     */
351
    public function setItalic($pValue = false)
352
    {
353
        if ($pValue == '') {
354
            $pValue = false;
355
        }
356
        if ($this->isSupervisor) {
357
            $styleArray = $this->getStyleArray(['italic' => $pValue]);
358
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
359
        } else {
360
            $this->italic = $pValue;
361
        }
362
363
        return $this;
364
    }
365
366
    /**
@@ 387-400 (lines=14) @@
384
     *
385
     * @return Font
386
     */
387
    public function setSuperScript($pValue = false)
388
    {
389
        if ($pValue == '') {
390
            $pValue = false;
391
        }
392
        if ($this->isSupervisor) {
393
            $styleArray = $this->getStyleArray(['superScript' => $pValue]);
394
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
395
        } else {
396
            $this->superScript = $pValue;
397
            $this->subScript = !$pValue;
398
        }
399
400
        return $this;
401
    }
402
403
    /**
@@ 424-437 (lines=14) @@
421
     *
422
     * @return Font
423
     */
424
    public function setSubScript($pValue = false)
425
    {
426
        if ($pValue == '') {
427
            $pValue = false;
428
        }
429
        if ($this->isSupervisor) {
430
            $styleArray = $this->getStyleArray(['subScript' => $pValue]);
431
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
432
        } else {
433
            $this->subScript = $pValue;
434
            $this->superScript = !$pValue;
435
        }
436
437
        return $this;
438
    }
439
440
    /**
@@ 501-513 (lines=13) @@
498
     *
499
     * @return Font
500
     */
501
    public function setStrikethrough($pValue = false)
502
    {
503
        if ($pValue == '') {
504
            $pValue = false;
505
        }
506
        if ($this->isSupervisor) {
507
            $styleArray = $this->getStyleArray(['strike' => $pValue]);
508
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
509
        } else {
510
            $this->strikethrough = $pValue;
511
        }
512
513
        return $this;
514
    }
515
516
    /**