Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function nextKey($context = []): string |
||
21 | { |
||
22 | $key = bin2hex(random_bytes(intdiv($this->keyLength, 2))); |
||
23 | |||
24 | $ext = isset($context['mime_type']) ? $this->guesser->guessExtension($context['mime_type']) : null; |
||
25 | |||
26 | $dir = ltrim(($context['prefix'] ?? '') . '/' . date('Y/m/d', time()), '/'); |
||
27 | |||
28 | return rtrim(sprintf('%s/%s.%s', $dir, $key, $ext), '.'); |
||
29 | } |
||
31 |