Passed
Push — master ( 859573...a81ea2 )
by Gabriel
03:21
created

PathGeneratorFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 5
c 2
b 1
f 1
dl 0
loc 18
ccs 3
cts 4
cp 0.75
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 3
1
<?php
2
3
namespace ByTIC\MediaLibrary\PathGenerator;
4
5
/**
6
 * Class PathGeneratorFactory.
7
 */
8
class PathGeneratorFactory
9
{
10
    /**
11
     * @return AbstractPathGenerator
12
     */
13 7
    public static function create()
14
    {
15
        $pathGeneratorClass = BasePathGenerator::class;
16
//        $customPathClass = config('medialibrary.custom_path_generator_class');
17
//        if ($customPathClass) {
18
//            $pathGeneratorClass = $customPathClass;
19
//        }
20
//        static::guardAgainstInvalidPathGenerator($pathGeneratorClass);
21 7
        if (function_exists('app') && app()) {
22 7
            return app($pathGeneratorClass);
23
        }
24
25
        return new $pathGeneratorClass();
26
    }
27
}
28