Failed Conditions
Push — master ( cccd95...989cb2 )
by Florent
03:57
created

AccessTokenIdGenerator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createAccessTokenId() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 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\SecurityBundle\Tests\TestBundle\Entity;
15
16
use OAuth2Framework\Component\Core\AccessToken\AccessTokenId;
17
use OAuth2Framework\Component\Core\AccessToken\AccessTokenIdGenerator as AccessTokenManagerInterface;
18
use OAuth2Framework\Component\Core\Client\ClientId;
19
use OAuth2Framework\Component\Core\DataBag\DataBag;
20
use OAuth2Framework\Component\Core\ResourceOwner\ResourceOwnerId;
21
use OAuth2Framework\Component\Core\ResourceServer\ResourceServerId;
22
23
class AccessTokenIdGenerator implements AccessTokenManagerInterface
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function createAccessTokenId(ResourceOwnerId $resourceOwnerId, ClientId $clientId, DataBag $parameters, DataBag $metadatas, ? ResourceServerId $resourceServerId): AccessTokenId
29
    {
30
        $length = random_int(50, 100);
31
32
        return AccessTokenId::create(bin2hex(random_bytes($length)));
33
    }
34
}
35