public static function cleanFileName(string $fileName, array $rulesets = self::FILE_NAME_RULESETS, string $separator = '-'): string {
    $slugify   = new Slugify(['rulesets' => $rulesets, 'separator' => $separator]);
    $name      = $slugify->slugify(pathinfo($fileName, PATHINFO_FILENAME));
    $extension = pathinfo($fileName, PATHINFO_EXTENSION);

    if (empty($name)) {
      $name = uniqid(self::EMPTY_FILE_NAME_PREFIX, true);
    }

    return mb_strtolower($name . '.' . $extension);
  }
public static function cleanFileName(string $fileName, array $rulesets = self::FILE_NAME_RULESETS, string $separator = '-'): string {
    $slugify   = new Slugify(['rulesets' => $rulesets, 'separator' => $separator]);
    $name      = $slugify->slugify(pathinfo($fileName, PATHINFO_FILENAME));
    $extension = pathinfo($fileName, PATHINFO_EXTENSION);

    if (empty($name)) {
      $name = uniqid(self::EMPTY_FILE_NAME_PREFIX, true);
    }

    return mb_strtolower($name . '.' . $extension);
  }
public static function cleanFileName ( string $ fileName , array $ rulesets = self :: FILE_NAME_RULESETS , string $ separator = '-' ) : string { $ slugify = new Slugify ( [ 'rulesets' => $ rulesets , 'separator' => $ separator ] ) ; $ name = $ slugify -> slugify ( pathinfo ( $ fileName , PATHINFO_FILENAME ) ) ; $ extension = pathinfo ( $ fileName , PATHINFO_EXTENSION ) ; if ( empty ( $ name ) ) { $ name = uniqid ( self :: EMPTY_FILE_NAME_PREFIX , true ) ; } return mb_strtolower ( $ name . '.' . $ extension ) ; }
Cleans a file name.

@param string $fileName The file name
@param array $rulesets The optional rulesets, defaults to `FileService::FILE_NAME_RULESETS`
@param string $separator The optional separator, defaults to `-`
@return string The cleaned file name
Cleans a file name .