Completed
Pull Request — develop_3.0 (#458)
by Adrien
01:54
created

EntityFactory::createCell()   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 1
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\Sheet;
7
use Box\Spout\Writer\Common\Entity\Workbook;
8
use Box\Spout\Writer\Common\Entity\Worksheet;
9
use Box\Spout\Writer\Common\Manager\SheetManager;
10
11
/**
12
 * Class EntityFactory
13
 * Factory to create entities
14
 *
15
 * @package Box\Spout\Writer\Common\Creator
16
 */
17
class EntityFactory
18
{
19
    /**
20
     * @return Workbook
21
     */
22 89
    public function createWorkbook()
23
    {
24 89
        return new Workbook();
25
    }
26
27
    /**
28
     * @param string $worksheetFilePath
29
     * @param Sheet $externalSheet
30
     * @return Worksheet
31
     */
32 89
    public function createWorksheet($worksheetFilePath, Sheet $externalSheet)
33
    {
34 89
        return new Worksheet($worksheetFilePath, $externalSheet);
35
    }
36
37
    /**
38
     * @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based)
39
     * @param string $associatedWorkbookId ID of the sheet's associated workbook
40
     * @param SheetManager $sheetManager To manage sheets
41
     * @return Sheet
42
     */
43 89
    public function createSheet($sheetIndex, $associatedWorkbookId, $sheetManager)
44
    {
45 89
        return new Sheet($sheetIndex, $associatedWorkbookId, $sheetManager);
46
    }
47
48
    /**
49
     * @param mixed $cellValue
50
     * @return Cell
51
     */
52 60
    public function createCell($cellValue)
53
    {
54 60
        return new Cell($cellValue);
55
    }
56
57
    /**
58
     * @return \ZipArchive
59
     */
60 70
    public function createZipArchive()
61
    {
62 70
        return new \ZipArchive();
63
    }
64
}
65