Code Duplication    Length = 14-14 lines in 4 locations

src/PhpSpreadsheet/Style/Border.php 1 location

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

src/PhpSpreadsheet/Style/Font.php 1 location

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

src/PhpSpreadsheet/Style/Fill.php 2 locations

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