Completed
Push — master ( a81ea2...e23c5c )
by Gabriel
03:24
created

PathGeneratorFactory::create()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 13
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.072

Importance

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