Failed Conditions
Push — master ( 4b5d02...3af7eb )
by Florent
04:35
created

RandomIdGenerator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A generate() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2017 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\Bundle\Server\Service;
15
16
use Base64Url\Base64Url;
17
18
final class RandomIdGenerator
19
{
20
    /**
21
     * @param int $min
22
     * @param int $max
23
     *
24
     * @return string
25
     */
26
    public static function generate(int $min, int $max): string
27
    {
28
        $length = random_int($min, $max);
29
30
        return Base64Url::encode(random_bytes($length));
31
    }
32
}
33