You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The value of $site_path doesn't change while we iterate over files in the filesystem, but we're checking the value each time.
Since if we have a non-string value for $site_path we won't ever get any files, it would be better to pull this check out before the iterator an simply short-circuit the iterator and return an empty array if $site_path is not a string.
The text was updated successfully, but these errors were encountered:
bookwyrm
changed the title
Optimization: Don't check unchanging value
Optimization: Don't repeatedly check unchanging value
Sep 22, 2021
https://github.com/leonstafford/wp2static/blob/84f1d33bcadbe0a7c485a72c8528b5703f147454/src/FilesHelper.php#L60
The value of
$site_path
doesn't change while we iterate over files in the filesystem, but we're checking the value each time.Since if we have a non-string value for
$site_path
we won't ever get any files, it would be better to pull this check out before the iterator an simply short-circuit the iterator and return an empty array if$site_path
is not a string.The text was updated successfully, but these errors were encountered: