Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 72.72% |
Changes | 0 |
1 | <?php |
||
14 | class Random extends AKey |
||
15 | { |
||
16 | /** @var int */ |
||
17 | protected $keyLength = 64; |
||
18 | |||
19 | /** @var string[] */ |
||
20 | public static $possibilities = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; |
||
21 | |||
22 | 1 | public function fromSharedKey(string $key): string |
|
23 | { |
||
24 | 1 | return $key . TargetSearch::FILE_DRIVER_SUFF; |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * @return AKey |
||
29 | * @codeCoverageIgnore do you really want to check random key generator? |
||
30 | */ |
||
31 | public function generateKeys(): parent |
||
32 | { |
||
33 | $this->sharedKey = $this->generateRandomText($this->keyLength, static::$possibilities); |
||
34 | return $this; |
||
|
|||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @param int $length |
||
39 | * @param string[] $possibilities |
||
40 | * @return string |
||
41 | */ |
||
42 | 1 | public static function generateRandomText(int $length, array $possibilities): string |
|
50 | } |
||
51 | } |
||
52 |