Completed
Pull Request — master (#6648)
by Ingo
08:49
created

FilesystemCacheFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\Core\Cache;
4
5
use SilverStripe\Core\Injector\Injector;
6
use Symfony\Component\Cache\Simple\FilesystemCache;
7
8
class FilesystemCacheFactory implements CacheFactory
9
{
10
11
    /**
12
     * @var string Absolute directory path
13
     */
14
    protected $directory;
15
16
    /**
17
     * @param string $directory
18
     */
19
    public function __construct($directory)
20
    {
21
        $this->directory = $directory;
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function create($service, array $params = array())
28
    {
29
        return Injector::inst()->create(FilesystemCache::class, false, [
30
            (isset($args['namespace'])) ? $args['namespace'] : '',
0 ignored issues
show
Bug introduced by
The variable $args seems to never exist, and therefore isset should always return false. Did you maybe rename this variable?

This check looks for calls to isset(...) or empty() on variables that are yet undefined. These calls will always produce the same result and can be removed.

This is most likely caused by the renaming of a variable or the removal of a function/method parameter.

Loading history...
31
            (isset($args['defaultLifetime'])) ? $args['defaultLifetime'] : 0,
32
            $this->directory
33
        ]);
34
    }
35
}
36