barryvdh / elfinder-flysystem-driver

elFinder driver for Flysystem
183 stars 41 forks source link

Why instanceof instead of isFile() #88

Open powerpbx opened 2 years ago

powerpbx commented 2 years ago

https://github.com/barryvdh/elfinder-flysystem-driver/blob/064d5b2c89ca185f3736e7e5c906d76d3632b30c/src/Driver.php#L228

Why are you using instanceof instead of isFile() like you used just before that? https://github.com/barryvdh/elfinder-flysystem-driver/blob/064d5b2c89ca185f3736e7e5c906d76d3632b30c/src/Driver.php#L225

Unless I am missing something, it looks like both accomplish the same thing.

You could also just use if ($meta['type'] === 'file'), which would avoid the redundant operation alltogether.

I think the microseconds can add up in this function because it could be trying to scan a large number of files/folder.