ExcelReaderFactory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 1
b 1
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Port\Excel;
4
5
use Port\Reader\ReaderFactory;
6
7
/**
8
 * Factory that creates ExcelReaders
9
 *
10
 * @author David de Boer <[email protected]>
11
 */
12
class ExcelReaderFactory implements ReaderFactory
13
{
14
    /**
15
     * @var integer
16
     */
17
    protected $headerRowNumber;
18
19
    /**
20
     * @var integer
21
     */
22
    protected $activeSheet;
23
24
    /**
25
     * @param integer $headerRowNumber
26
     * @param integer $activeSheet
27
     */
28 1
    public function __construct($headerRowNumber = null, $activeSheet = null)
29
    {
30 1
        $this->headerRowNumber = $headerRowNumber;
31 1
        $this->activeSheet = $activeSheet;
32 1
    }
33
34
    /**
35
     * @param \SplFileObject $file
36
     *
37
     * @return ExcelReader
38
     */
39 1
    public function getReader(\SplFileObject $file)
40
    {
41 1
        return new ExcelReader($file, $this->headerRowNumber, $this->activeSheet);
42
    }
43
}
44