| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function create(string $component = ''): string |
||
| 30 | { |
||
| 31 | $section = $this->session->getSection(__CLASS__); |
||
| 32 | |||
| 33 | if (!isset($section['token'])) { |
||
| 34 | $section['token'] = Random::generate(10); |
||
| 35 | } |
||
| 36 | |||
| 37 | $hash = hash_hmac('sha1', $component . $this->session->getId(), $section['token'], TRUE); |
||
| 38 | |||
| 39 | return str_replace('/', '_', substr(base64_encode($hash), 0, 8)); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |