Completed
Push — master ( d92761...e5ee26 )
by Maxence
04:52
created

IndexOptions   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 50
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getOptions() 0 3 1
A setOptions() 0 3 1
A addOption() 0 3 1
A getOption() 0 7 2
1
<?php
2
/**
3
 * FullTextSearch - Full text search framework for Nextcloud
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Maxence Lange <[email protected]>
9
 * @copyright 2018
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 *
25
 */
26
27
namespace OCA\FullTextSearch\Model;
28
29
30
class IndexOptions {
31
32
	/**
33
	 * @var array
34
	 */
35
	private $options = [];
36
37
38
	public function __construct($options = []) {
39
		$this->options = $options;
40
	}
41
42
	/**
43
	 * @return array
44
	 */
45
	public function getOptions() {
46
		return $this->options;
47
	}
48
49
	/**
50
	 * @param array $options
51
	 */
52
	public function setOptions($options) {
53
		$this->options = $options;
54
	}
55
56
	/**
57
	 * @param string $k
58
	 * @param string $v
59
	 */
60
	public function addOption($k, $v) {
61
		$this->options[$k] = $v;
62
	}
63
64
65
	/**
66
	 * @param string $k
67
	 * @param string $default
68
	 *
69
	 * @return array|string
70
	 */
71
	public function getOption($k, $default = '') {
72
		if (array_key_exists($k, $this->options)) {
73
			return $this->options[$k];
74
		}
75
76
		return $default;
77
	}
78
79
}