Completed
Pull Request — master (#315)
by Elan
01:23
created

Xhgui_Util::simpleUrl()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
class Xhgui_Util
4
{
5
    /**
6
     * Returns an new ObjectId-like string, where its first 8
7
     * characters encode the current unix timestamp and the
8
     * next 16 are random.
9
     *
10
     * @see http://php.net/manual/en/mongodb-bson-objectid.construct.php
11
     *
12
     * @return string
13
     */
14
    public static function generateId()
15
    {
16
        return dechex(time()) . bin2hex(random_bytes(8));
17
    }
18
}
19