code: private static function addSegmentsToPath($path, $segments)
      {
          $segments = Arr::toArray($segments);
          if (count($segments) > 0) {
              $path .= '/' . implode('/', $segments);
          }
          return $path;
      }
docs: Add segments to path.
  
  @param string $path
  @param @param string|array $segments Dot notation is supported in string.
  @return string