Completed
Pull Request — master (#557)
by Adrien
03:10
created

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