Passed
Push — master ( 122983...91227d )
by William
02:34 queued 26s
created

ApcuCacheFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 19
ccs 6
cts 7
cp 0.8571
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getInstance() 0 3 1
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 8
    public function __construct(int $ttl = 0, bool $reloadOnMiss = true, string $prefix = 'mo_')
19
    {
20 8
        $this->ttl = $ttl;
21 8
        $this->reloadOnMiss = $reloadOnMiss;
22 8
        $this->prefix = $prefix;
23
    }
24
25 8
    public function getInstance(MoParser $parser, string $locale, string $domain): CacheInterface
26
    {
27 8
        return new ApcuCache($parser, $locale, $domain, $this->ttl, $this->reloadOnMiss, $this->prefix);
28
    }
29
}
30