Code Duplication    Length = 14-14 lines in 4 locations

src/PhpSpreadsheet/Style/Border.php 1 location

@@ 225-238 (lines=14) @@
222
     *
223
     * @return Border
224
     */
225
    public function setColor(Color $pValue)
226
    {
227
        // make sure parameter is a real color and not a supervisor
228
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
229
230
        if ($this->isSupervisor) {
231
            $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
232
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
233
        } else {
234
            $this->color = $color;
235
        }
236
237
        return $this;
238
    }
239
240
    /**
241
     * Get hash code.

src/PhpSpreadsheet/Style/Fill.php 2 locations

@@ 247-260 (lines=14) @@
244
     *
245
     * @return Fill
246
     */
247
    public function setStartColor(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->getStartColor()->getStyleArray(['argb' => $color->getARGB()]);
254
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
255
        } else {
256
            $this->startColor = $color;
257
        }
258
259
        return $this;
260
    }
261
262
    /**
263
     * Get End Color.
@@ 281-294 (lines=14) @@
278
     *
279
     * @return Fill
280
     */
281
    public function setEndColor(Color $pValue)
282
    {
283
        // make sure parameter is a real color and not a supervisor
284
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
285
286
        if ($this->isSupervisor) {
287
            $styleArray = $this->getEndColor()->getStyleArray(['argb' => $color->getARGB()]);
288
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
289
        } else {
290
            $this->endColor = $color;
291
        }
292
293
        return $this;
294
    }
295
296
    /**
297
     * Get hash code.

src/PhpSpreadsheet/Style/Font.php 1 location

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