Code Duplication    Length = 14-14 lines in 4 locations

src/PhpSpreadsheet/Style/Fill.php 2 locations

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

src/PhpSpreadsheet/Style/Font.php 1 location

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

src/PhpSpreadsheet/Style/Border.php 1 location

@@ 247-260 (lines=14) @@
244
     *
245
     * @return Border
246
     */
247
    public function setColor(Color $pValue)
248
    {
249
        // make sure parameter is a real color and not a supervisor
250
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
251
252
        if ($this->isSupervisor) {
253
            $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
254
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
255
        } else {
256
            $this->color = $color;
257
        }
258
259
        return $this;
260
    }
261
262
    /**
263
     * Get hash code.