Closed LeisureLarry closed 2 years ago
When you add a new file to the SephpaMultiFile
container using SephpaMultiFile::addFile()
you get back a reference to this fie object. In order to make anything with the file you have to store this reference somewhere, e.g. in an array. So this should already do what you need.
Yes, but it is somewhat annoying to store an extra array which is already present in SephpaMultiFile.
Using the references returned by SephpaMultiFile::addFile()
ensures that you have the right reference to your file. Using the privately stored array contains the files in some order with only a numeric key by the order the files are added which may or may not change some time.
So I don't see much value in this getter function.
$sephpaMultiFile = new SephpaMultiFile(...);
$files = [];
$files[0] = sephpaMultiFile->addFile(...);
$files[1] = sephpaMultiFile->addFile(...);
$files[2] = sephpaMultiFile->addFile(...);
$files[3] = sephpaMultiFile->addFile(...);
would become
$sephpaMultiFile = new SephpaMultiFile(...);
$files[0] = sephpaMultiFile->addFile(...);
$files[1] = sephpaMultiFile->addFile(...);
$files[2] = sephpaMultiFile->addFile(...);
$files[3] = sephpaMultiFile->addFile(...);
$files = $sephpaMultFile->getData();
The code does not get shorter or easier, but you lose control over the structure of the array and so the getter function opens potential for bugs and errors.
For a project I need the possibility to get all files. Would be really great if you could add the getter.