Passed
Pull Request — master (#640)
by Vitor
03:36
created

State::isVerifying()   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
 * SPDX-FileCopyrightText: 2024 Christoph Wurst <[email protected]>
5
 * SPDX-License-Identifier: AGPL-3.0-or-later
6
 */
7
8
namespace OCA\TwoFactorGateway\Provider\Gateway;
9
10
class State {
11
	public const DISABLED = 0;
12
	public const VERIFYING = 1;
13
	public const ENABLED = 2;
14
15
	private function __construct(
16
		private int $state,
17
	) {
18
	}
19
20
	public static function disabled(): State {
21
		return new self(self::DISABLED);
22
	}
23
24
	public static function verifying(): State {
25
		return new self(self::VERIFYING);
26
	}
27
28
	public static function enabled(): State {
29
		return new self(self::ENABLED);
30
	}
31
32
	public function isDisabled(): bool {
33
		return $this->state === self::DISABLED;
34
	}
35
36
	public function isVerifying(): bool {
37
		return $this->state === self::VERIFYING;
38
	}
39
40
	public function isEnabled(): bool {
41
		return $this->state === self::ENABLED;
42
	}
43
}
44