Completed
Pull Request — master (#602)
by Tom
06:21
created

SecondLevelCacheConfiguration   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 121
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 1
dl 0
loc 121
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineORMModule\Options;
6
7
use Laminas\Stdlib\AbstractOptions;
8
9
/**
10
 * Configuration options for Second Level Cache
11
 *
12
 * @link    http://www.doctrine-project.org/
13
 */
14
class SecondLevelCacheConfiguration extends AbstractOptions
15
{
16
    /**
17
     * Enable the second level cache configuration
18
     */
19
    protected bool $enabled = false;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
20
21
    /**
22
     * Default lifetime
23
     */
24
    protected int $defaultLifetime = 3600;
25
26
    /**
27
     * Default lock lifetime
28
     */
29
    protected int $defaultLockLifetime = 60;
30
31
    /**
32
     * The file lock region directory (needed for some cache usage)
33
     */
34
    protected string $fileLockRegionDirectory = '';
35
36
    /**
37
     * Configure the lifetime and lock lifetime per region. You must pass an associative array like this:
38
     *
39
     * [
40
     *     'My\Region' => ['lifetime' => 200, 'lock_lifetime' => 400],
41
     * ]
42
     *
43
     * @var mixed[]
44
     */
45
    protected array $regions = [];
46
47
    public function setEnabled(bool $enabled) : void
48
    {
49
        $this->enabled = (bool) $enabled;
50
    }
51
52
    public function isEnabled() : bool
53
    {
54
        return $this->enabled;
55
    }
56
57
    public function setDefaultLifetime(int $defaultLifetime) : void
58
    {
59
        $this->defaultLifetime = (int) $defaultLifetime;
60
    }
61
62
    public function getDefaultLifetime() : int
63 1
    {
64
        return $this->defaultLifetime;
65 1
    }
66 1
67
    public function setDefaultLockLifetime(int $defaultLockLifetime) : void
68
    {
69
        $this->defaultLockLifetime = (int) $defaultLockLifetime;
70
    }
71 86
72
    public function getDefaultLockLifetime() : int
73 86
    {
74
        return $this->defaultLockLifetime;
75
    }
76
77
    public function setFileLockRegionDirectory(string $fileLockRegionDirectory) : void
78
    {
79 1
        $this->fileLockRegionDirectory = (string) $fileLockRegionDirectory;
80
    }
81 1
82 1
    public function getFileLockRegionDirectory() : string
83
    {
84
        return $this->fileLockRegionDirectory;
85
    }
86
87 1
    /**
88
     * @param mixed[] $regions
89 1
     */
90
    public function setRegions(array $regions) : void
91
    {
92
        $this->regions = $regions;
93
    }
94
95 1
    /**
96
     * @return mixed[]
97 1
     */
98 1
    public function getRegions() : array
99
    {
100
        return $this->regions;
101
    }
102
}
103