Passed
Push — master ( fce2ec...34bcb7 )
by William
09:40 queued 07:12
created

ApcuCacheFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

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