DefaultFileNameGenerator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 11
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 9 1
1
<?php
2
3
4
namespace Fomvasss\MediaLibraryExtension\FilenameGenerators;
5
6
class DefaultFileNameGenerator implements FileNameGeneratorInterface
7
{
8
    public static function get(string $originalName): string
9
    {
10
        $fileName = pathinfo($originalName, PATHINFO_FILENAME);
11
12
        $fileName = \Illuminate\Support\Str::slug($fileName);
13
14
        $fileExtension = pathinfo($originalName, PATHINFO_EXTENSION);
15
16
        return $fileName . '.' . $fileExtension;
17
    }
18
}