Completed
Push — master ( fef7a6...aff413 )
by Arne
02:38
created

VaultConfiguration::setOperationListBuilder()   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 $storageDriver;
20
21
    /**
22
     * Identifier for the lock adapter to use.
23
     *
24
     * @var string
25
     */
26
    protected $lockAdapter = 'storage';
27
28
    /**
29
     * Identifier for the index merger to be used.
30
     * Refers to identifiers known to the IndexMergerFactory.
31
     *
32
     * @var string
33
     */
34
    protected $indexMerger = 'standard';
35
36
    /**
37
     * Identifier for the conflict handler to use.
38
     * Refers to identifiers known to the ConflictHandlerFactory.
39
     *
40
     * @var string
41
     */
42
    protected $conflictHandler = 'panicking';
43
44
    /**
45
     * Identifier for the operation list builder to use.
46
     * Refers to identifiers known to the OperationListBuilderFactory.
47
     *
48
     * @var string
49
     */
50
    protected $operationListBuilder = 'standard';
51
52
    /**
53
     * Map with additional storageDriver- or lockAdapter-specific settings.
54
     *
55
     * @var array
56
     */
57
    protected $settings;
58
59
    public function __construct(string $storageDriver)
60
    {
61
        $this->storageDriver = $storageDriver;
62
63
        $this->setTitle($storageDriver);
64
    }
65
66
    public function getTitle(): string
67
    {
68
        return $this->title;
69
    }
70
71
    public function setTitle(string $title): VaultConfiguration
72
    {
73
        $this->title = $title;
74
75
        return $this;
76
    }
77
78
    public function getStorageDriver(): string
79
    {
80
        return $this->storageDriver;
81
    }
82
83
    public function setStorageDriver(string $storageDriver): VaultConfiguration
84
    {
85
        $this->storageDriver = $storageDriver;
86
87
        return $this;
88
    }
89
90
    public function getLockAdapter(): string
91
    {
92
        return $this->lockAdapter;
93
    }
94
95
    public function setLockAdapter(string $lockAdapter): VaultConfiguration
96
    {
97
        $this->lockAdapter = $lockAdapter;
98
99
        return $this;
100
    }
101
102
    public function getIndexMerger(): string
103
    {
104
        return $this->indexMerger;
105
    }
106
107
    public function setIndexMerger(string $indexMerger): VaultConfiguration
108
    {
109
        $this->indexMerger = $indexMerger;
110
111
        return $this;
112
    }
113
114
    public function getConflictHandler(): string
115
    {
116
        return $this->conflictHandler;
117
    }
118
119
    public function setConflictHandler(string $conflictHandler): VaultConfiguration
120
    {
121
        $this->conflictHandler = $conflictHandler;
122
123
        return $this;
124
    }
125
126
    public function getOperationListBuilder(): string
127
    {
128
        return $this->operationListBuilder;
129
    }
130
131
    public function setOperationListBuilder(string $operationListBuilder): VaultConfiguration
132
    {
133
        $this->operationListBuilder = $operationListBuilder;
134
135
        return $this;
136
    }
137
138
    public function getSettings(): array
139
    {
140
        return $this->settings;
141
    }
142
143
    public function getSetting(string $name)
144
    {
145
        return isset($this->settings[$name]) ? $this->settings[$name] : null;
146
    }
147
148
    public function setSettings(array $settings): VaultConfiguration
149
    {
150
        $this->settings = $settings;
151
152
        return $this;
153
    }
154
155
    public function setSetting(string $name, $value): VaultConfiguration
156
    {
157
        $this->settings[$name] = $value;
158
159
        return $this;
160
    }
161
}
162