Code Duplication    Length = 14-14 lines in 4 locations

src/PhpSpreadsheet/Style/Border.php 1 location

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

src/PhpSpreadsheet/Style/Fill.php 2 locations

@@ 263-276 (lines=14) @@
260
     * @throws  \PhpOffice\PhpSpreadsheet\Exception
261
     * @return Fill
262
     */
263
    public function setStartColor(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->getStartColor()->getStyleArray(['argb' => $color->getARGB()]);
270
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
271
        } else {
272
            $this->startColor = $color;
273
        }
274
275
        return $this;
276
    }
277
278
    /**
279
     * Get End Color
@@ 295-308 (lines=14) @@
292
     * @throws   \PhpOffice\PhpSpreadsheet\Exception
293
     * @return Fill
294
     */
295
    public function setEndColor(Color $pValue = null)
296
    {
297
        // make sure parameter is a real color and not a supervisor
298
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
299
300
        if ($this->isSupervisor) {
301
            $styleArray = $this->getEndColor()->getStyleArray(['argb' => $color->getARGB()]);
302
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
303
        } else {
304
            $this->endColor = $color;
305
        }
306
307
        return $this;
308
    }
309
310
    /**
311
     * Get hash code

src/PhpSpreadsheet/Style/Font.php 1 location

@@ 522-535 (lines=14) @@
519
     * @throws   \PhpOffice\PhpSpreadsheet\Exception
520
     * @return Font
521
     */
522
    public function setColor(Color $pValue = null)
523
    {
524
        // make sure parameter is a real color and not a supervisor
525
        $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
526
527
        if ($this->isSupervisor) {
528
            $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
529
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
530
        } else {
531
            $this->color = $color;
532
        }
533
534
        return $this;
535
    }
536
537
    /**
538
     * Get hash code