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

ApcuCacheFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
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