functions.php 616 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace Illuminate\Filesystem;
  3. if (! function_exists('Illuminate\Filesystem\join_paths')) {
  4. /**
  5. * Join the given paths together.
  6. *
  7. * @param string|null $basePath
  8. * @param string ...$paths
  9. */
  10. function join_paths($basePath, ...$paths): string
  11. {
  12. foreach ($paths as $index => $path) {
  13. if (empty($path) && $path !== '0') {
  14. unset($paths[$index]);
  15. } else {
  16. $paths[$index] = DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR);
  17. }
  18. }
  19. return $basePath.implode('', $paths);
  20. }
  21. }