Completed
Pull Request — master (#446)
by
unknown
04:51 queued 02:50
created

Sheet::getIndex()   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 0
crap 1
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
 * @package Box\Spout\Reader\XLSX
12
 */
13
class Sheet implements SheetInterface
14
{
15
    /** @var \Box\Spout\Reader\XLSX\RowIterator To iterate over sheet's rows */
16
    protected $rowIterator;
17
18
    /** @var int Index of the sheet, based on order in the workbook (zero-based) */
19
    protected $index;
20
21
    /** @var string Name of the sheet */
22
    protected $name;
23
24
    /** @var bool Whether the sheet was the active one */
25
    protected $isActive;
26
27
    /** @var bool Whether the sheet is visible or not */
28
    protected $isVisible;
29
30
    /**
31
     * @param string $filePath Path of the XLSX file being read
32
     * @param string $sheetDataXMLFilePath Path of the sheet data XML file as in [Content_Types].xml
33
     * @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based)
34
     * @param string $sheetName Name of the sheet
35
     * @param bool $isSheetVisible Whether the sheet is visible or not
36
     * @param bool $isSheetActive Whether the sheet was defined as active
37
     * @param \Box\Spout\Reader\XLSX\ReaderOptions $options Reader's current options
38
     * @param Helper\SharedStringsHelper Helper to work with shared strings
39
     */
40 102
    public function __construct($filePath, $sheetDataXMLFilePath, $sheetIndex, $sheetName, $isSheetActive, $isSheetVisible, $options, $sharedStringsHelper)
41
    {
42 102
        $this->rowIterator = new RowIterator($filePath, $sheetDataXMLFilePath, $options, $sharedStringsHelper);
43 102
        $this->index = $sheetIndex;
44 102
        $this->name = $sheetName;
45 102
        $this->isActive = $isSheetActive;
46 102
        $this->isVisible = $isSheetVisible;
47 102
    }
48
49
    /**
50
     * @api
51
     * @return \Box\Spout\Reader\XLSX\RowIterator
52
     */
53 102
    public function getRowIterator()
54
    {
55 102
        return $this->rowIterator;
56
    }
57
58
    /**
59
     * @api
60
     * @return int Index of the sheet, based on order in the workbook (zero-based)
61
     */
62 3
    public function getIndex()
63
    {
64 3
        return $this->index;
65
    }
66
67
    /**
68
     * @api
69
     * @return string Name of the sheet
70
     */
71 3
    public function getName()
72
    {
73 3
        return $this->name;
74
    }
75
76
    /**
77
     * @api
78
     * @return bool Whether the sheet was defined as active
79
     */
80 3
    public function isActive()
81
    {
82 3
        return $this->isActive;
83
    }
84
85
     /**
86
     * @api
87
     * @return bool Whether the sheet is visible or not
88
     */
89 3
    public function isVisible()
90
    {
91 3
        return $this->isVisible;
92
    }
93
}
94