Completed
Push — master ( 4a6546...7f8b95 )
by Adrien
02:30
created

Sheet::isActive()   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
    /**
28
     * @param string $filePath Path of the XLSX file being read
29
     * @param string $sheetDataXMLFilePath Path of the sheet data XML file as in [Content_Types].xml
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 \Box\Spout\Reader\XLSX\ReaderOptions $options Reader's current options
34
     * @param Helper\SharedStringsHelper Helper to work with shared strings
35
     */
36 96
    public function __construct($filePath, $sheetDataXMLFilePath, $sheetIndex, $sheetName, $isSheetActive, $options, $sharedStringsHelper)
37
    {
38 96
        $this->rowIterator = new RowIterator($filePath, $sheetDataXMLFilePath, $options, $sharedStringsHelper);
39 96
        $this->index = $sheetIndex;
40 96
        $this->name = $sheetName;
41 96
        $this->isActive = $isSheetActive;
42 96
    }
43
44
    /**
45
     * @api
46
     * @return \Box\Spout\Reader\XLSX\RowIterator
47
     */
48 96
    public function getRowIterator()
49
    {
50 96
        return $this->rowIterator;
51
    }
52
53
    /**
54
     * @api
55
     * @return int Index of the sheet, based on order in the workbook (zero-based)
56
     */
57 3
    public function getIndex()
58
    {
59 3
        return $this->index;
60
    }
61
62
    /**
63
     * @api
64
     * @return string Name of the sheet
65
     */
66 3
    public function getName()
67
    {
68 3
        return $this->name;
69
    }
70
71
    /**
72
     * @api
73
     * @return bool Whether the sheet was defined as active
74
     */
75 3
    public function isActive()
76
    {
77 3
        return $this->isActive;
78
    }
79
}
80