Passed
Pull Request — master (#92)
by Christoph
03:17
created

State::disabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @author Christoph Wurst <[email protected]>
5
 *
6
 * Nextcloud - Two-factor Gateway
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
22
namespace OCA\TwoFactorGateway\Service\Gateway;
23
24
25
class State {
26
27
	const DISABLED = 0;
28
	const VERIFYING = 1;
29
	const ENABLED = 2;
30
31
	/** @var int */
32
	private $state;
33
34
	private function __construct(int $state) {
35
		$this->state = $state;
36
	}
37
38
	public static function disabled(): State {
39
		return new self(self::DISABLED);
40
	}
41
42
	public static function verifying(): State {
43
		return new self(self::VERIFYING);
44
	}
45
46
	public static function enabled(): State {
47
		return new self(self::ENABLED);
48
	}
49
50
	public function isDisabled(): bool {
51
		return $this->state === self::DISABLED;
52
	}
53
54
	public function isVerifying(): bool {
55
		return $this->state === self::DISABLED;
56
	}
57
58
	public function isEnabled(): bool {
59
		return $this->state === self::DISABLED;
60
	}
61
62
}
63