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

EntityFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 25
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createCell() 0 4 1
A createRow() 0 7 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