Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Introduce a Reader range #568

Closed
wants to merge 1 commit into from
Closed

Introduce a Reader range #568

wants to merge 1 commit into from

Conversation

madflow
Copy link
Contributor

@madflow madflow commented Jun 15, 2018

This PR introduces a range for readers like discussed here: #561 (comment)

The range can be defined on a Reader by setting a zero based start - and end column index. This can be done before or after a reader has been opened.

The reader will only yield data starting at the start index - and stop reading after the end index.

If an end index is provided missing cells are filled with empty values so there is always the same range.

Given the CSV:

'csv--11', 'csv--12', 'csv--13'
'csv--21', 'csv--22'
'csv--31'
$reader->open($csv);
$reader->setStartColumnIndex(0);
$reader->setEndColumnIndex(1);

Outputs:

array(3) {
  [0]=>
  array(2) {
    [0]=>
    string(7) "csv--11"
    [1]=>
    string(7) "csv--12"
  }
  [1]=>
  array(2) {
    [0]=>
    string(7) "csv--21"
    [1]=>
    string(7) "csv--22"
  }
  [2]=>
  array(2) {
    [0]=>
    string(7) "csv--31"
    [1]=>
    string(0) ""
  }
}

I only did this for the CSV reader for RFC purposes.

@boxcla
Copy link

boxcla commented Jun 15, 2018

Verified that @madflow has signed the CLA. Thanks for the pull request!

@madflow
Copy link
Contributor Author

madflow commented Jun 15, 2018

Maybe naming the exposed setter "setRange" and keeping the column indexes internal would be a better option...?

@adrilo adrilo added this to the 3.1.0 milestone May 17, 2019
@adrilo adrilo changed the base branch from develop_3.0 to master May 24, 2019 07:50
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@madflow
Copy link
Contributor Author

madflow commented Mar 4, 2020

I have no plans on working on this PR anymore. Closing...

@madflow madflow closed this Mar 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants