RepositoryFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 6 3
1
<?php
2
3
namespace Translation\Cache;
4
5
use Illuminate\Contracts\Cache\Store;
6
use \ReflectionClass;
7
8
class RepositoryFactory
9
{
10
    public static function make(Store $store, $cacheTag)
11
    {
12
        $cacheReflection = new ReflectionClass(get_class($store));
13
        $storeParent     = $cacheReflection->getParentClass();
14
        $parentName      = $storeParent ? $storeParent->name : '';
0 ignored issues
show
introduced by
$storeParent is of type ReflectionClass, thus it always evaluated to true.
Loading history...
15
        return $parentName == 'Illuminate\Cache\TaggableStore' ? new TaggedRepository($store, $cacheTag) : new SimpleRepository($store, $cacheTag);
16
    }
17
}
18