Completed
Push — master ( d0bd4d...b4b0fd )
by Igor
23:04
created

Random::fileName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace app\helpers;
4
5
class Random
6
{
7
    /**
8
     * Generate a file name
9
     *
10
     * @param string $extension The file extension
11
     * @return string
12
     */
13
    public static function fileName(string $extension): string
14
    {
15
        $name = date('YmdHis') . substr(md5(microtime() . uniqid()), 0, 10);
16
        return $name . '.' . $extension;
17
    }
18
}
19