Passed
Branch release/v2.0.0 (f3d8ba)
by Anatoly
03:59
created

OAuthFlow   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 70
ccs 0
cts 15
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addScope() 0 3 1
A setTokenUrl() 0 3 1
A setRefreshUrl() 0 3 1
A setAuthorizationUrl() 0 3 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Fenric <[email protected]>
7
 * @copyright Copyright (c) 2018, Anatoly Fenric
8
 * @license https://github.com/sunrise-php/http-router/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/http-router
10
 */
11
12
namespace Sunrise\Http\Router\OpenApi;
13
14
/**
15
 * OAS OAuth Flow Object
16
 *
17
 * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#oauth-flow-object
18
 */
19
class OAuthFlow extends AbstractObject
20
{
21
22
    /**
23
     * @var string
24
     *
25
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-oauthflowauthorizationurl
26
     */
27
    protected $authorizationUrl;
28
29
    /**
30
     * @var string
31
     *
32
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-oauthflowtokenurl
33
     */
34
    protected $tokenUrl;
35
36
    /**
37
     * @var string
38
     *
39
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-oauthflowrefreshurl
40
     */
41
    protected $refreshUrl;
42
43
    /**
44
     * @var string[]
45
     *
46
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-oauthflowscopes
47
     */
48
    protected $scopes;
49
50
    /**
51
     * @param string $authorizationUrl
52
     *
53
     * @return void
54
     */
55
    public function setAuthorizationUrl(string $authorizationUrl) : void
56
    {
57
        $this->authorizationUrl = $authorizationUrl;
58
    }
59
60
    /**
61
     * @param string $tokenUrl
62
     *
63
     * @return void
64
     */
65
    public function setTokenUrl(string $tokenUrl) : void
66
    {
67
        $this->tokenUrl = $tokenUrl;
68
    }
69
70
    /**
71
     * @param string $refreshUrl
72
     *
73
     * @return void
74
     */
75
    public function setRefreshUrl(string $refreshUrl) : void
76
    {
77
        $this->refreshUrl = $refreshUrl;
78
    }
79
80
    /**
81
     * @param string $name
82
     * @param string $description
83
     *
84
     * @return void
85
     */
86
    public function addScope(string $name, string $description) : void
87
    {
88
        $this->scopes[$name] = $description;
89
    }
90
}
91