Code Duplication    Length = 14-15 lines in 12 locations

src/PhpSpreadsheet/Style/Alignment.php 4 locations

@@ 197-211 (lines=15) @@
194
     *
195
     * @return Alignment
196
     */
197
    public function setHorizontal($pValue)
198
    {
199
        if ($pValue == '') {
200
            $pValue = self::HORIZONTAL_GENERAL;
201
        }
202
203
        if ($this->isSupervisor) {
204
            $styleArray = $this->getStyleArray(['horizontal' => $pValue]);
205
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
206
        } else {
207
            $this->horizontal = $pValue;
208
        }
209
210
        return $this;
211
    }
212
213
    /**
214
     * Get Vertical.
@@ 234-248 (lines=15) @@
231
     *
232
     * @return Alignment
233
     */
234
    public function setVertical($pValue)
235
    {
236
        if ($pValue == '') {
237
            $pValue = self::VERTICAL_BOTTOM;
238
        }
239
240
        if ($this->isSupervisor) {
241
            $styleArray = $this->getStyleArray(['vertical' => $pValue]);
242
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
243
        } else {
244
            $this->vertical = $pValue;
245
        }
246
247
        return $this;
248
    }
249
250
    /**
251
     * Get TextRotation.
@@ 316-329 (lines=14) @@
313
     *
314
     * @return Alignment
315
     */
316
    public function setWrapText($pValue)
317
    {
318
        if ($pValue == '') {
319
            $pValue = false;
320
        }
321
        if ($this->isSupervisor) {
322
            $styleArray = $this->getStyleArray(['wrapText' => $pValue]);
323
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
324
        } else {
325
            $this->wrapText = $pValue;
326
        }
327
328
        return $this;
329
    }
330
331
    /**
332
     * Get Shrink to fit.
@@ 352-365 (lines=14) @@
349
     *
350
     * @return Alignment
351
     */
352
    public function setShrinkToFit($pValue)
353
    {
354
        if ($pValue == '') {
355
            $pValue = false;
356
        }
357
        if ($this->isSupervisor) {
358
            $styleArray = $this->getStyleArray(['shrinkToFit' => $pValue]);
359
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
360
        } else {
361
            $this->shrinkToFit = $pValue;
362
        }
363
364
        return $this;
365
    }
366
367
    /**
368
     * Get indent.

src/PhpSpreadsheet/Style/Borders.php 1 location

@@ 385-398 (lines=14) @@
382
     *
383
     * @return Borders
384
     */
385
    public function setDiagonalDirection($pValue)
386
    {
387
        if ($pValue == '') {
388
            $pValue = self::DIAGONAL_NONE;
389
        }
390
        if ($this->isSupervisor) {
391
            $styleArray = $this->getStyleArray(['diagonalDirection' => $pValue]);
392
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
393
        } else {
394
            $this->diagonalDirection = $pValue;
395
        }
396
397
        return $this;
398
    }
399
400
    /**
401
     * Get hash code.

src/PhpSpreadsheet/Style/Color.php 1 location

@@ 136-149 (lines=14) @@
133
     *
134
     * @return Color
135
     */
136
    public function setARGB($pValue)
137
    {
138
        if ($pValue == '') {
139
            $pValue = self::COLOR_BLACK;
140
        }
141
        if ($this->isSupervisor) {
142
            $styleArray = $this->getStyleArray(['argb' => $pValue]);
143
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
144
        } else {
145
            $this->argb = $pValue;
146
        }
147
148
        return $this;
149
    }
150
151
    /**
152
     * Get RGB.

src/PhpSpreadsheet/Style/Font.php 5 locations

@@ 295-308 (lines=14) @@
292
     *
293
     * @return Font
294
     */
295
    public function setBold($pValue)
296
    {
297
        if ($pValue == '') {
298
            $pValue = false;
299
        }
300
        if ($this->isSupervisor) {
301
            $styleArray = $this->getStyleArray(['bold' => $pValue]);
302
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
303
        } else {
304
            $this->bold = $pValue;
305
        }
306
307
        return $this;
308
    }
309
310
    /**
311
     * Get Italic.
@@ 331-344 (lines=14) @@
328
     *
329
     * @return Font
330
     */
331
    public function setItalic($pValue)
332
    {
333
        if ($pValue == '') {
334
            $pValue = false;
335
        }
336
        if ($this->isSupervisor) {
337
            $styleArray = $this->getStyleArray(['italic' => $pValue]);
338
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
339
        } else {
340
            $this->italic = $pValue;
341
        }
342
343
        return $this;
344
    }
345
346
    /**
347
     * Get Superscript.
@@ 367-381 (lines=15) @@
364
     *
365
     * @return Font
366
     */
367
    public function setSuperscript($pValue)
368
    {
369
        if ($pValue == '') {
370
            $pValue = false;
371
        }
372
        if ($this->isSupervisor) {
373
            $styleArray = $this->getStyleArray(['superscript' => $pValue]);
374
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
375
        } else {
376
            $this->superscript = $pValue;
377
            $this->subscript = !$pValue;
378
        }
379
380
        return $this;
381
    }
382
383
    /**
384
     * Get Subscript.
@@ 404-418 (lines=15) @@
401
     *
402
     * @return Font
403
     */
404
    public function setSubscript($pValue)
405
    {
406
        if ($pValue == '') {
407
            $pValue = false;
408
        }
409
        if ($this->isSupervisor) {
410
            $styleArray = $this->getStyleArray(['subscript' => $pValue]);
411
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
412
        } else {
413
            $this->subscript = $pValue;
414
            $this->superscript = !$pValue;
415
        }
416
417
        return $this;
418
    }
419
420
    /**
421
     * Get Underline.
@@ 481-494 (lines=14) @@
478
     *
479
     * @return Font
480
     */
481
    public function setStrikethrough($pValue)
482
    {
483
        if ($pValue == '') {
484
            $pValue = false;
485
        }
486
        if ($this->isSupervisor) {
487
            $styleArray = $this->getStyleArray(['strike' => $pValue]);
488
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
489
        } else {
490
            $this->strikethrough = $pValue;
491
        }
492
493
        return $this;
494
    }
495
496
    /**
497
     * Get Color.

src/PhpSpreadsheet/Style/NumberFormat.php 1 location

@@ 177-191 (lines=15) @@
174
     *
175
     * @return NumberFormat
176
     */
177
    public function setFormatCode($pValue)
178
    {
179
        if ($pValue == '') {
180
            $pValue = self::FORMAT_GENERAL;
181
        }
182
        if ($this->isSupervisor) {
183
            $styleArray = $this->getStyleArray(['formatCode' => $pValue]);
184
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
185
        } else {
186
            $this->formatCode = $pValue;
187
            $this->builtInFormatCode = self::builtInFormatCodeIndex($pValue);
188
        }
189
190
        return $this;
191
    }
192
193
    /**
194
     * Get Built-In Format Code.