Passed
Push — master ( e789fa...7285b3 )
by William
02:37
created

ApcuCacheFactory::getInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
ccs 0
cts 2
cp 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpMyAdmin\MoTranslator\Cache;
6
7
use PhpMyAdmin\MoTranslator\MoParser;
8
9
final class ApcuCacheFactory implements CacheFactoryInterface
10
{
11
    /** @var int */
12
    private $ttl;
13
    /** @var bool */
14
    private $reloadOnMiss;
15
    /** @var string */
16
    private $prefix;
17
18
    public function __construct(int $ttl = 0, bool $reloadOnMiss = true, string $prefix = 'mo_')
19
    {
20
        $this->ttl = $ttl;
21
        $this->reloadOnMiss = $reloadOnMiss;
22
        $this->prefix = $prefix;
23
    }
24
25
    public function getInstance(MoParser $parser, string $locale, string $domain): CacheInterface
26
    {
27
        return new ApcuCache($parser, $locale, $domain, $this->ttl, $this->reloadOnMiss, $this->prefix);
28
    }
29
}
30