State::isDisabled()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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 3
	private function __construct(
16
		private int $state,
17
	) {
18 3
	}
19
20 1
	public static function disabled(): State {
21 1
		return new self(self::DISABLED);
22
	}
23
24 1
	public static function verifying(): State {
25 1
		return new self(self::VERIFYING);
26
	}
27
28 1
	public static function enabled(): State {
29 1
		return new self(self::ENABLED);
30
	}
31
32 3
	public function isDisabled(): bool {
33 3
		return $this->state === self::DISABLED;
34
	}
35
36 3
	public function isVerifying(): bool {
37 3
		return $this->state === self::VERIFYING;
38
	}
39
40 3
	public function isEnabled(): bool {
41 3
		return $this->state === self::ENABLED;
42
	}
43
}
44