Completed
Pull Request — master (#235)
by
unknown
02:46
created

Sheet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 6
Bugs 1 Features 1
Metric Value
wmc 4
c 6
b 1
f 1
lcom 0
cbo 1
dl 0
loc 54
rs 10
ccs 9
cts 12
cp 0.75

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getRowIterator() 0 4 1
A getIndex() 0 4 1
A getName() 0 4 1
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