RandomValidator::generate()   A
last analyzed

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
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
namespace Ubiquity\security\csrf\generators;
3
4
class RandomValidator implements GeneratorInterface {
5
6
	public function generate(?string $value = null): string {
7
		$bytes = random_bytes((int) ($value ?? 32));
8
		return \rtrim(\strtr(\base64_encode($bytes), '+/', '-_'), '=');
9
	}
10
}
11
12