Completed
Pull Request — master (#235)
by
unknown
03:20
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.037

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
ccs 2
cts 3
cp 0.6667
cc 1
eloc 2
nc 1
nop 0
crap 1.037
1
<?php
2
3
namespace Box\Spout\Reader\ODS;
4
5
use Box\Spout\Reader\SheetInterface;
6
use Box\Spout\Reader\Wrapper\XMLReader;
7
use Box\Spout\Reader\ReaderOptions;
8
9
/**
10
 * Class Sheet
11
 * Represents a sheet within a ODS file
12
 *
13
 * @package Box\Spout\Reader\ODS
14
 */
15
class Sheet implements SheetInterface
16
{
17
    /** @var \Box\Spout\Reader\ODS\RowIterator To iterate over sheet's rows */
18
    protected $rowIterator;
19
20
    /** @var int ID of the sheet */
21
    protected $id;
22
23
    /** @var int Index of the sheet, based on order in the workbook (zero-based) */
24
    protected $index;
25
26
    /** @var string Name of the sheet */
27
    protected $name;
28
29
    /**
30
     * @param XMLReader $xmlReader XML Reader, positioned on the "<table:table>" element
31
     * @param \Box\Spout\Reader\ReaderOptions $readerOptions
32
     * @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based)
33
     * @param string $sheetName Name of the sheet
34
     */
35 84
    public function __construct($xmlReader, ReaderOptions $readerOptions, $sheetIndex, $sheetName)
36
    {
37 84
        $this->rowIterator = new RowIterator($xmlReader, $readerOptions);
38 84
        $this->index = $sheetIndex;
39 84
        $this->name = $sheetName;
40 84
    }
41
42
    /**
43
     * @api
44
     * @return \Box\Spout\Reader\ODS\RowIterator
45
     */
46 84
    public function getRowIterator()
47
    {
48 84
        return $this->rowIterator;
49
    }
50
51
    /**
52
     * @api
53
     * @return int Index of the sheet, based on order in the workbook (zero-based)
54
     */
55 3
    public function getIndex()
56
    {
57
        return $this->index;
58 3
    }
59
60
    /**
61
     * @api
62
     * @return string Name of the sheet
63
     */
64
    public function getName()
65
    {
66
        return $this->name;
67
    }
68
}
69