Completed
Push — master ( c5a3b4...fa0d52 )
by Arne
01:49
created

VaultConfiguration::setTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Archivr;
4
5
class VaultConfiguration
6
{
7
    /**
8
     * An arbitrary user-defined title that helps to identity a vault by some user-specific information.
9
     *
10
     * @var string
11
     */
12
    protected $title;
13
14
    /**
15
     * Identifier for the vault adapter to use.
16
     *
17
     * @var string
18
     */
19
    protected $vaultAdapter;
20
21
    /**
22
     * Identifier for the lock adapter to use.
23
     *
24
     * @var string
25
     */
26
    protected $lockAdapter;
27
28
    /**
29
     * Map with additional vaultAdapter- or lockAdapter-specific settings.
30
     *
31
     * @var array
32
     */
33
    protected $settings;
34
35
    public function __construct(string $vaultAdapter, string $lockAdapter)
36
    {
37
        $this->title = $vaultAdapter;
38
        $this->vaultAdapter = $vaultAdapter;
39
        $this->lockAdapter = $lockAdapter;
40
    }
41
42
    public function getTitle(): string
43
    {
44
        return $this->title;
45
    }
46
47
    public function setTitle(string $title): VaultConfiguration
48
    {
49
        $this->title = $title;
50
51
        return $this;
52
    }
53
54
    public function getVaultAdapter(): string
55
    {
56
        return $this->vaultAdapter;
57
    }
58
59
    public function setVaultAdapter(string $vaultAdapter): VaultConfiguration
60
    {
61
        $this->vaultAdapter = $vaultAdapter;
62
63
        return $this;
64
    }
65
66
    public function getLockAdapter(): string
67
    {
68
        return $this->lockAdapter;
69
    }
70
71
    public function setLockAdapter(string $lockAdapter): VaultConfiguration
72
    {
73
        $this->lockAdapter = $lockAdapter;
74
75
        return $this;
76
    }
77
78
    public function getSettings(): array
79
    {
80
        return $this->settings;
81
    }
82
83
    public function getSetting(string $name)
84
    {
85
        return isset($this->settings[$name]) ? $this->settings[$name] : null;
86
    }
87
88
    public function setSettings(array $settings): VaultConfiguration
89
    {
90
        $this->settings = $settings;
91
92
        return $this;
93
    }
94
95
    public function setSetting(string $name, $value): VaultConfiguration
96
    {
97
        $this->settings[$name] = $value;
98
99
        return $this;
100
    }
101
}
102