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

PathGeneratorFactory::create()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 13
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3.1406

Importance

Changes 2
Bugs 1 Features 1
Metric Value
cc 3
eloc 4
c 2
b 1
f 1
nc 2
nop 0
dl 0
loc 13
ccs 3
cts 4
cp 0.75
crap 3.1406
rs 10
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