Passed
Push — master ( ae19cb...d3647d )
by Roeland
15:17 queued 10s
created

SettingsManager::enforcePasswordProtection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright Copyright (c) 2017 Bjoern Schiessle <[email protected]>
7
 *
8
 * @author Bjoern Schiessle <[email protected]>
9
 * @author Roeland Jago Douma <[email protected]>
10
 *
11
 * @license GNU AGPL version 3 or any later version
12
 *
13
 * This program is free software: you can redistribute it and/or modify
14
 * it under the terms of the GNU Affero General Public License as
15
 * published by the Free Software Foundation, either version 3 of the
16
 * License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU Affero General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU Affero General Public License
24
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
 *
26
 */
27
28
namespace OCA\ShareByMail\Settings;
29
30
use OCP\IConfig;
31
32
class SettingsManager {
33
34
	/** @var IConfig */
35
	private $config;
36
37
	private $sendPasswordByMailDefault = 'yes';
38
39
	private $replyToInitiatorDefault = 'yes';
40
41
	public function __construct(IConfig $config) {
42
		$this->config = $config;
43
	}
44
45
	/**
46
	 * should the password for a mail share be send to the recipient
47
	 *
48
	 * @return bool
49
	 */
50
	public function sendPasswordByMail(): bool {
51
		$sendPasswordByMail = $this->config->getAppValue('sharebymail', 'sendpasswordmail', $this->sendPasswordByMailDefault);
52
		return $sendPasswordByMail === 'yes';
53
	}
54
55
	/**
56
	 * should add reply to with initiator mail
57
	 *
58
	 * @return bool
59
	 */
60
	public function replyToInitiator(): bool {
61
		$replyToInitiator = $this->config->getAppValue('sharebymail', 'replyToInitiator', $this->replyToInitiatorDefault);
62
		return $replyToInitiator === 'yes';
63
	}
64
}
65