Code Duplication    Length = 14-15 lines in 12 locations

src/PhpSpreadsheet/Style/Alignment.php 4 locations

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

src/PhpSpreadsheet/Style/Borders.php 1 location

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

src/PhpSpreadsheet/Style/NumberFormat.php 1 location

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

src/PhpSpreadsheet/Style/Color.php 1 location

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

src/PhpSpreadsheet/Style/Font.php 5 locations

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