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

InternalEntityFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 39
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

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