Test Failed
Push — master ( a6b51e...5fffdb )
by Gabriel
08:05
created

RandomHelper::generateToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
3
namespace ByTIC\Hello\Utility;
4
5
/**
6
 * Class RandomHelper
7
 * @package ByTIC\Hello\Utility
8
 */
9
final class RandomHelper
10
{
11
    /** @noinspection PhpDocMissingThrowsInspection
12
     * @return mixed
13
     */
14 19
    public static function generateToken()
15
    {
16
        /** @noinspection PhpUnhandledExceptionInspection */
17 19
        $bytes = random_bytes(32);
18 19
        return base_convert(bin2hex($bytes), 16, 36);
19
    }
20
21
    /** @noinspection PhpDocMissingThrowsInspection
22
     * @return string
23
     */
24 19
    public static function generateIdentifier()
25
    {
26
        /** @noinspection PhpUnhandledExceptionInspection */
27 19
        return hash('md5', random_bytes(16));
28
    }
29
}
30