JamesMoss\Flywheel\Repository::generateId PHP Method

generateId() protected method

Generates a random, unique ID for a document. The result is returned in base62. This keeps it shorted but still human readable if shared in URLs.
protected generateId ( ) : string
return string The generated ID.
    protected function generateId()
    {
        static $choices = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $id = '';
        while (strlen($id) < 9) {
            $id .= $choices[mt_rand(0, strlen($choices) - 1)];
        }
        return $id;
    }