Passed
Pull Request — develop_3.0 (#489)
by Adrien
02:40
created

EntityFactory::createWorkbook()   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 0
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\Sheet;
8
use Box\Spout\Writer\Common\Entity\Style\Style;
9
use Box\Spout\Writer\Common\Entity\Workbook;
10
use Box\Spout\Writer\Common\Entity\Worksheet;
11
use Box\Spout\Writer\Common\Manager\RowManager;
12
use Box\Spout\Writer\Common\Manager\SheetManager;
13
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
14
15
/**
16
 * Class EntityFactory
17
 * Factory to create external entities
18
 */
19
class EntityFactory
20
{
21
    /**
22
     * @param mixed $cellValue
23
     * @param Style|null $cellStyle
24
     * @return Cell
25
     */
26 75
    public static function createCell($cellValue, Style $cellStyle = null)
27
    {
28 75
        return new Cell($cellValue, $cellStyle);
29
    }
30
31
    /**
32
     * @param array $cells
33
     * @param Style|null $rowStyle
34
     * @return Row
35
     */
36 75
    public static function createRow(array $cells = [], Style $rowStyle = null)
37
    {
38 75
        $styleMerger = new StyleMerger();
39 75
        $rowManager = new RowManager($styleMerger);
40
41 75
        return new Row($cells, $rowStyle, $rowManager);
42
    }
43
}
44