-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getHeaders() #52
getHeaders() #52
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make the code a bit simpler!
My understanding is the spreadsheet needs to be opened and the headers processed after any of the fluent methods are called ( |
I think the clearest things to do, would be to have I really don't mind that the file is opened twice, the performance impact will probably be negligible. Typing this message likely takes more time 🙂 |
src/SimpleExcelReader.php
Outdated
@@ -154,6 +161,31 @@ public function getRows(): LazyCollection | |||
}); | |||
} | |||
|
|||
public function getHeaders(): ?array | |||
{ | |||
if ($this->processHeader && ! $this->headers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a big piece of indented code here. I can be simplified by first checking if headers is set to something. If it is, we can already return the headers.
Thank you! |
Is there a reason why $reader is created in the getHeaders()? |
PR for #51.
Love this package, and thanks for all the value you've added to the community (Laravel Beyond Crud has had a huge impact on our company 🙌🏻 ).