At the moment, we extract the most useful bits of data (filename, (un)compressed size, offset, CRC, etc) and populate the public array.
However, if we start to implement features such as #12, then we will want to also be able to access other information from the Central Directory Headers at arbitrary points (i.e when ZipRangeReader::getStream is called, and it would be stupid to have to re-retrieve the CDR each time.
In order to make this cleaner for end users, it might be better to hide that data, otherwise the files array could start to get very messy.
This is where the discussion comes in - there are basically three options.
- Populate
files with all the data from the CDRs and hope the end user doesn't get too confused. This would be adding 15 new pieces of data per file, some of which would be unprintable bytestrings.
- Add a
internal_data key to the generated arrays, and stick everything in there, along with a warning to the user in the documentation to just ignore it.
- Write a class for
ZipFileInformation, in which we could store all the information, and then populate the files array with instantiated objects of that class. This would allow us to use getters for all the data, meaning a) we could keep the useful information in public vars, and the end user could do $zip_info->files["MyFile"]->CRC and b) we could keep internally useful data in protected vars and have helper methods that return it when needed (via any logic that needs to be done)
At the moment, we extract the most useful bits of data (filename, (un)compressed size, offset, CRC, etc) and populate the public array.
However, if we start to implement features such as #12, then we will want to also be able to access other information from the Central Directory Headers at arbitrary points (i.e when
ZipRangeReader::getStreamis called, and it would be stupid to have to re-retrieve the CDR each time.In order to make this cleaner for end users, it might be better to hide that data, otherwise the
filesarray could start to get very messy.This is where the discussion comes in - there are basically three options.
fileswith all the data from the CDRs and hope the end user doesn't get too confused. This would be adding 15 new pieces of data per file, some of which would be unprintable bytestrings.internal_datakey to the generated arrays, and stick everything in there, along with a warning to the user in the documentation to just ignore it.ZipFileInformation, in which we could store all the information, and then populate thefilesarray with instantiated objects of that class. This would allow us to use getters for all the data, meaning a) we could keep the useful information in public vars, and the end user could do$zip_info->files["MyFile"]->CRCand b) we could keep internally useful data in protected vars and have helper methods that return it when needed (via any logic that needs to be done)