Code Duplication    Length = 14-14 lines in 4 locations

src/PhpSpreadsheet/Style/Border.php 1 location

@@ 259-272 (lines=14) @@
256
     *
257
     * @return Border
258
     */
259
    public function setColor(Color $pValue)
260
    {
261
        // make sure parameter is a real color and not a supervisor
262
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
263
264
        if ($this->isSupervisor) {
265
            $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
266
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
267
        } else {
268
            $this->color = $color;
269
        }
270
271
        return $this;
272
    }
273
274
    /**
275
     * Get hash code.

src/PhpSpreadsheet/Style/Fill.php 2 locations

@@ 267-280 (lines=14) @@
264
     *
265
     * @return Fill
266
     */
267
    public function setStartColor(Color $pValue)
268
    {
269
        // make sure parameter is a real color and not a supervisor
270
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
271
272
        if ($this->isSupervisor) {
273
            $styleArray = $this->getStartColor()->getStyleArray(['argb' => $color->getARGB()]);
274
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
275
        } else {
276
            $this->startColor = $color;
277
        }
278
279
        return $this;
280
    }
281
282
    /**
283
     * Get End Color.
@@ 301-314 (lines=14) @@
298
     *
299
     * @return Fill
300
     */
301
    public function setEndColor(Color $pValue)
302
    {
303
        // make sure parameter is a real color and not a supervisor
304
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
305
306
        if ($this->isSupervisor) {
307
            $styleArray = $this->getEndColor()->getStyleArray(['argb' => $color->getARGB()]);
308
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
309
        } else {
310
            $this->endColor = $color;
311
        }
312
313
        return $this;
314
    }
315
316
    /**
317
     * Get hash code.

src/PhpSpreadsheet/Style/Font.php 1 location

@@ 531-544 (lines=14) @@
528
     *
529
     * @return Font
530
     */
531
    public function setColor(Color $pValue)
532
    {
533
        // make sure parameter is a real color and not a supervisor
534
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
535
536
        if ($this->isSupervisor) {
537
            $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
538
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
539
        } else {
540
            $this->color = $color;
541
        }
542
543
        return $this;
544
    }
545
546
    /**
547
     * Get hash code.