Code Duplication    Length = 23-23 lines in 3 locations

docs/Examples/Reader/exampleReader11.php 1 location

@@ 32-54 (lines=23) @@
29
$inputFileName = './sampleData/example2.xls';
30
31
/**  Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter  */
32
class chunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
33
{
34
    private $_startRow = 0;
35
36
    private $_endRow = 0;
37
38
    /**
39
     * We expect a list of the rows that we want to read to be passed into the constructor.
40
     *
41
     * @param mixed $startRow
42
     * @param mixed $chunkSize
43
     */
44
    public function __construct($startRow, $chunkSize)
45
    {
46
        $this->_startRow = $startRow;
47
        $this->_endRow = $startRow + $chunkSize;
48
    }
49
50
    public function readCell($column, $row, $worksheetName = '')
51
    {
52
        //  Only read the heading row, and the rows that were configured in the constructor
53
        if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
54
            return true;
55
        }
56
57
        return false;

docs/Examples/Reader/exampleReader12.php 1 location

@@ 32-54 (lines=23) @@
29
$inputFileName = './sampleData/example2.xls';
30
31
/**  Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter  */
32
class chunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
33
{
34
    private $_startRow = 0;
35
36
    private $_endRow = 0;
37
38
    /**
39
     * Set the list of rows that we want to read.
40
     *
41
     * @param mixed $startRow
42
     * @param mixed $chunkSize
43
     */
44
    public function setRows($startRow, $chunkSize)
45
    {
46
        $this->_startRow = $startRow;
47
        $this->_endRow = $startRow + $chunkSize;
48
    }
49
50
    public function readCell($column, $row, $worksheetName = '')
51
    {
52
        //  Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
53
        if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
54
            return true;
55
        }
56
57
        return false;

docs/Examples/Reader/exampleReader14.php 1 location

@@ 28-50 (lines=23) @@
25
$inputFileName = './sampleData/example2.csv';
26
27
/**  Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter  */
28
class chunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
29
{
30
    private $_startRow = 0;
31
32
    private $_endRow = 0;
33
34
    /**
35
     * Set the list of rows that we want to read.
36
     *
37
     * @param mixed $startRow
38
     * @param mixed $chunkSize
39
     */
40
    public function setRows($startRow, $chunkSize)
41
    {
42
        $this->_startRow = $startRow;
43
        $this->_endRow = $startRow + $chunkSize;
44
    }
45
46
    public function readCell($column, $row, $worksheetName = '')
47
    {
48
        //  Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
49
        if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
50
            return true;
51
        }
52
53
        return false;