Passed
Push — develop_3.0 ( ca5962...2d2151 )
by Adrien
02:58
created

EntityFactory::createWorksheet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Box\Spout\Writer\Common\Creator;
4
5
use Box\Spout\Writer\Common\Entity\Cell;
6
use Box\Spout\Writer\Common\Entity\Row;
7
use Box\Spout\Writer\Common\Entity\Style\Style;
8
use Box\Spout\Writer\Common\Manager\RowManager;
9
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
10
11
/**
12
 * Class EntityFactory
13
 * Factory to create external entities
14
 */
15
class EntityFactory
16
{
17
    /**
18
     * @param mixed $cellValue
19
     * @param Style|null $cellStyle
20
     * @return Cell
21
     */
22 75
    public static function createCell($cellValue, Style $cellStyle = null)
23
    {
24 75
        return new Cell($cellValue, $cellStyle);
25
    }
26
27
    /**
28
     * @param array $cells
29
     * @param Style|null $rowStyle
30
     * @return Row
31
     */
32 75
    public static function createRow(array $cells = [], Style $rowStyle = null)
33
    {
34 75
        $styleMerger = new StyleMerger();
35 75
        $rowManager = new RowManager($styleMerger);
36
37 75
        return new Row($cells, $rowStyle, $rowManager);
38
    }
39
}
40