GrantTypeManager   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setGrantType() 0 4 1
A getGrantType() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: GCC-MED
5
 * Date: 09/03/2018
6
 * Time: 09:53
7
 */
8
9
namespace OAuth2\AuthorizationGrantTypes;
10
11
12
class GrantTypeManager
13
{
14
    protected $grantTypes = [];
15
16
    /**
17
     * @param string $identifier
18
     * @param GrantTypeInterface $grantType
19
     * @return GrantTypeManager
20
     *
21
     * @see https://tools.ietf.org/html/rfc6749#section-4.5
22
     * The client uses an extension grant type by specifying the grant type
23
     * using an absolute URI (defined by the authorization server) as the
24
     * value of the "grant_type" parameter of the token endpoint, and by
25
     * adding any additional parameters necessary.
26
     */
27
    public function setGrantType(string $identifier, GrantTypeInterface $grantType): self
28
    {
29
        $this->grantTypes[$identifier] = $grantType;
30
        return $this;
31
    }
32
33
    public function getGrantType(string $identifier): ?GrantTypeInterface
34
    {
35
        return $this->grantTypes[$identifier] ?? null;
36
    }
37
}