Completed
Pull Request — master (#808)
by
unknown
11:17
created

Worksheet::getSheetDataStarted()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Box\Spout\Writer\Common\Entity;
4
5
/**
6
 * Class Worksheet
7
 * Entity describing a Worksheet
8
 */
9
class Worksheet
10
{
11
    /** @var string Path to the XML file that will contain the sheet data */
12
    private $filePath;
13
14
    /** @var resource Pointer to the sheet data file (e.g. xl/worksheets/sheet1.xml) */
15
    private $filePointer;
16
17
    /** @var Sheet The "external" sheet */
18
    private $externalSheet;
19
20
    /** @var int Maximum number of columns among all the written rows */
21
    private $maxNumColumns;
22
23
    /** @var int Index of the last written row */
24
    private $lastWrittenRowIndex;
25
26
    /** @var bool has the sheet data header been written */
27
    private $sheetDataStarted = false;
28
29
    /**
30
     * Worksheet constructor.
31
     *
32 82
     * @param string $worksheetFilePath
33
     * @param Sheet $externalSheet
34 82
     */
35 82
    public function __construct($worksheetFilePath, Sheet $externalSheet)
36 82
    {
37 82
        $this->filePath = $worksheetFilePath;
38 82
        $this->filePointer = null;
39 82
        $this->externalSheet = $externalSheet;
40
        $this->maxNumColumns = 0;
41
        $this->lastWrittenRowIndex = 0;
42
        $this->sheetDataStarted = false;
43
    }
44 82
45
    /**
46 82
     * @return string
47
     */
48
    public function getFilePath()
49
    {
50
        return $this->filePath;
51
    }
52 75
53
    /**
54 75
     * @return resource
55
     */
56
    public function getFilePointer()
57
    {
58
        return $this->filePointer;
59
    }
60 82
61
    /**
62 82
     * @param resource $filePointer
63 82
     */
64
    public function setFilePointer($filePointer)
65
    {
66
        $this->filePointer = $filePointer;
67
    }
68 77
69
    /**
70 77
     * @return Sheet
71
     */
72
    public function getExternalSheet()
73
    {
74
        return $this->externalSheet;
75
    }
76 71
77
    /**
78 71
     * @return int
79
     */
80
    public function getMaxNumColumns()
81
    {
82
        return $this->maxNumColumns;
83
    }
84 68
85
    /**
86 68
     * @param int $maxNumColumns
87 68
     */
88
    public function setMaxNumColumns($maxNumColumns)
89
    {
90
        $this->maxNumColumns = $maxNumColumns;
91
    }
92 70
93
    /**
94 70
     * @return int
95
     */
96
    public function getLastWrittenRowIndex()
97
    {
98
        return $this->lastWrittenRowIndex;
99
    }
100 68
101
    /**
102 68
     * @param int $lastWrittenRowIndex
103 68
     */
104
    public function setLastWrittenRowIndex($lastWrittenRowIndex)
105
    {
106
        $this->lastWrittenRowIndex = $lastWrittenRowIndex;
107
    }
108 75
109
    /**
110
     * @return int The ID of the worksheet
111 75
     */
112
    public function getId()
113
    {
114
        // sheet index is zero-based, while ID is 1-based
115
        return $this->externalSheet->getIndex() + 1;
116
    }
117
118
    /**
119
     * @return bool
120
     */
121
    public function getSheetDataStarted()
122
    {
123
        return $this->sheetDataStarted;
124
    }
125
126
    /**
127
     * @param bool $sheetDataStarted
128
     */
129
    public function setSheetDataStarted($sheetDataStarted)
130
    {
131
        $this->sheetDataStarted = $sheetDataStarted;
132
    }
133
}
134