Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
48 | 16 | protected function generateValidLayoutKey(string $key): string |
|
49 | { |
||
50 | 16 | $keyLen = 16; |
|
51 | |||
52 | 16 | if (!str_contains($key, '-') |
|
53 | 16 | && strlen($key) === $keyLen) { |
|
54 | 16 | return $key; |
|
55 | } |
||
56 | |||
57 | // The key is either generated by Javascript or not strong enough. |
||
58 | // Before assigning a new valid key we'll keep track of this one |
||
59 | // in order to keep it usable in a Flexible::findGroup($key) search. |
||
60 | 2 | $this->_key = $key; |
|
61 | |||
62 | 2 | return 'c' . Str::random($keyLen-7) . date('ymd'); |
|
63 | } |
||
65 |