-
Notifications
You must be signed in to change notification settings - Fork 2
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
Convert filenames to SplFileInfo objects #35
Comments
To get this working, we'd have to involve something like Symfony/finder (or parts of it). Finder offers a lot of extra functionality, which might be overkill, but in the end, it delivers an easy way to point to a config file directory (or directories) and get SPLFileInfo results for all of the files in those directories. From a usability perspective, I'd also think pointing to directories and saying "go get anything in them and load them", is the simplest solution. Obviously, single files should also be "loadable". https://github.com/symfony/Finder Scott |
I didn't mean something so complex. I just meant "take the string with a filepath and swap it for an SplFileInfo object with that same file. Not a finder or recursive thing. They can already use Finder optionally for that. What I'm thinking would really only be a few lines of code 😸 |
Sure. But again, to me, from a user perspective, the input should be a directory path holding any number of config files. That would be simpler, more user friendly.
Scott |
Ah, I see what you mean. I am talking about individual files and you are talking about directories. I would think that warrants to different methods. I don't know that I want to deal with recursive searching of files in Manager, its too complicated across systems. I'd rather give the option to use So, they would have a couple options to load files: $manager->loadFiles('some/directory/file.json');
$manager->loadFiles([
'some/directory/file.json',
'some/directory/other.json',
'some/file.php'
]);
$manager->loadFiles($finderInstance); // for all recursive directories, masking and glory If that is not simple enough, it may be worth thinking about an additional method |
My thinking is, as a user, I wouldn't want to have to list out my config files at all. If I add or remove files, then I have to remember to also change the values going into the Scott |
Wouldn't that be the perfect option to use |
Yes. Maybe a list of files would be a feature not really needed? Scott |
Closed. |
As it stands, the user MUST pass an instance of
SplFileInfo
into theFileLoader
. This is good, but it should be easy enough to add a little magic to this:This would apply to the
LoadsFilesTrait
and theFileLoader
itself, though it may be best to do the actual work inFileBag
and just pass values down to that.The text was updated successfully, but these errors were encountered: