XLSXReader icon indicating copy to clipboard operation
XLSXReader copied to clipboard

Arrays

Open stephentkennedy opened this issue 7 years ago • 2 comments

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.

stephentkennedy avatar Jan 05 '18 15:01 stephentkennedy

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

badpenguin avatar Sep 28 '18 08:09 badpenguin

$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;

stephentkennedy avatar Sep 28 '18 14:09 stephentkennedy