Passed
Push — master ( b3e27e...db1dbb )
by Jean-Christophe
01:47
created

ContentSecurityManager::getNonce()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 2
rs 10
cc 1
nc 1
nop 1
1
<?php
2
namespace Ubiquity\security\csp;
3
4
class ContentSecurityManager {
5
6
	private static NonceGenerator $nonceGenerator;
7
8
	public static function start(string $nonceGeneratorClass = null) {
9
		$nonceGeneratorClass ??= NonceGenerator::class;
10
		self::$nonceGenerator = new $nonceGeneratorClass();
11
	}
12
13
	public static function getNonce(string $name) {
14
		return self::$nonceGenerator->getNonce($name);
15
	}
16
17
	public static function isStarted(): bool {
18
		return isset(self::$nonceGenerator);
19
	}
20
}
21
22