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