1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Box\Spout\Reader\XLSX; |
4
|
|
|
|
5
|
|
|
use Box\Spout\Reader\SheetInterface; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class Sheet |
9
|
|
|
* Represents a sheet within a XLSX file |
10
|
|
|
*/ |
11
|
|
|
class Sheet implements SheetInterface |
12
|
|
|
{ |
13
|
|
|
/** @var \Box\Spout\Reader\XLSX\RowIterator To iterate over sheet's rows */ |
14
|
|
|
protected $rowIterator; |
15
|
|
|
|
16
|
|
|
/** @var int Index of the sheet, based on order in the workbook (zero-based) */ |
17
|
|
|
protected $index; |
18
|
|
|
|
19
|
|
|
/** @var string Name of the sheet */ |
20
|
|
|
protected $name; |
21
|
|
|
|
22
|
|
|
/** @var bool Whether the sheet was the active one */ |
23
|
|
|
protected $isActive; |
24
|
|
|
|
25
|
|
|
/** @var bool Whether the sheet is visible */ |
26
|
|
|
protected $isVisible; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param RowIterator $rowIterator The corresponding row iterator |
30
|
|
|
* @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based) |
31
|
|
|
* @param string $sheetName Name of the sheet |
32
|
|
|
* @param bool $isSheetActive Whether the sheet was defined as active |
33
|
|
|
* @param bool $isSheetVisible Whether the sheet is visible |
34
|
|
|
*/ |
35
|
35 |
|
public function __construct($rowIterator, $sheetIndex, $sheetName, $isSheetActive, $isSheetVisible) |
36
|
|
|
{ |
37
|
35 |
|
$this->rowIterator = $rowIterator; |
38
|
35 |
|
$this->index = $sheetIndex; |
39
|
35 |
|
$this->name = $sheetName; |
40
|
35 |
|
$this->isActive = $isSheetActive; |
41
|
35 |
|
$this->isVisible = $isSheetVisible; |
42
|
35 |
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return \Box\Spout\Reader\XLSX\RowIterator |
46
|
|
|
*/ |
47
|
35 |
|
public function getRowIterator() |
48
|
|
|
{ |
49
|
35 |
|
return $this->rowIterator; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return int Index of the sheet, based on order in the workbook (zero-based) |
54
|
|
|
*/ |
55
|
1 |
|
public function getIndex() |
56
|
|
|
{ |
57
|
1 |
|
return $this->index; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return string Name of the sheet |
62
|
|
|
*/ |
63
|
1 |
|
public function getName() |
64
|
|
|
{ |
65
|
1 |
|
return $this->name; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return bool Whether the sheet was defined as active |
70
|
|
|
*/ |
71
|
1 |
|
public function isActive() |
72
|
|
|
{ |
73
|
1 |
|
return $this->isActive; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return bool Whether the sheet is visible |
78
|
|
|
*/ |
79
|
1 |
|
public function isVisible() |
80
|
|
|
{ |
81
|
1 |
|
return $this->isVisible; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|