Code Duplication    Length = 14-14 lines in 4 locations

src/PhpSpreadsheet/Style/Border.php 1 location

@@ 206-219 (lines=14) @@
203
     *
204
     * @return Border
205
     */
206
    public function setColor(Color $pValue)
207
    {
208
        // make sure parameter is a real color and not a supervisor
209
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
210
211
        if ($this->isSupervisor) {
212
            $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
213
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
214
        } else {
215
            $this->color = $color;
216
        }
217
218
        return $this;
219
    }
220
221
    /**
222
     * Get hash code.

src/PhpSpreadsheet/Style/Fill.php 2 locations

@@ 256-269 (lines=14) @@
253
     *
254
     * @return Fill
255
     */
256
    public function setStartColor(Color $pValue)
257
    {
258
        // make sure parameter is a real color and not a supervisor
259
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
260
261
        if ($this->isSupervisor) {
262
            $styleArray = $this->getStartColor()->getStyleArray(['argb' => $color->getARGB()]);
263
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
264
        } else {
265
            $this->startColor = $color;
266
        }
267
268
        return $this;
269
    }
270
271
    /**
272
     * Get End Color.
@@ 290-303 (lines=14) @@
287
     *
288
     * @return Fill
289
     */
290
    public function setEndColor(Color $pValue)
291
    {
292
        // make sure parameter is a real color and not a supervisor
293
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
294
295
        if ($this->isSupervisor) {
296
            $styleArray = $this->getEndColor()->getStyleArray(['argb' => $color->getARGB()]);
297
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
298
        } else {
299
            $this->endColor = $color;
300
        }
301
302
        return $this;
303
    }
304
305
    /**
306
     * Get hash code.

src/PhpSpreadsheet/Style/Font.php 1 location

@@ 515-528 (lines=14) @@
512
     *
513
     * @return Font
514
     */
515
    public function setColor(Color $pValue)
516
    {
517
        // make sure parameter is a real color and not a supervisor
518
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
519
520
        if ($this->isSupervisor) {
521
            $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
522
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
523
        } else {
524
            $this->color = $color;
525
        }
526
527
        return $this;
528
    }
529
530
    /**
531
     * Get hash code.