Skip to content
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

Arrays #8

Open
stephentkennedy opened this issue Jan 5, 2018 · 2 comments
Open

Arrays #8

stephentkennedy opened this issue Jan 5, 2018 · 2 comments

Comments

@stephentkennedy
Copy link

This is purely a data structure issue, and your taste may vary from mine.

On 113 of the class, you use the sheetId as the array key for the data returned on getSheetNames()

I can see the logic behind it, but when presented with a numeric key array, I don't expect my array to be in order and not start at 0.

@badpenguin
Copy link

$sheetNames = $xlsx->getSheetNames(); $first = reset($sheetNames);

@stephentkennedy
Copy link
Author

stephentkennedy commented Sep 28, 2018

$sheetNames = $xlsx->getSheetNames(); $first = reset($sheetNames);

Yes, thank you. I have also read the PHP manual.

My original complaint was about the structure the class returns, not a question about how to work around it.

I work at a web development company that rotates entry level developers with some regularity, so when we look to adapt code into our framework, as we have with this, we look for it to follow the same sort of standards we tend to train these developers on.

Our ugly fix was a simple de-incrementation of the keys as they are applied. Our version of line 113 looks like this:

$res[$info['sheetId'] - 1] = $sheetName;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants