Completed
Push — master ( 935a4f...80b369 )
by Veaceslav
01:53
created

OAuth2SecurityScheme   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 29
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getFlows() 0 4 1
A normalizeRequiredSchemeProperties() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Objects\SecurityScheme;
6
7
use Aweapi\Openapi\Extensions;
8
use Aweapi\Openapi\Objects\OAuthFlows;
9
use Aweapi\Openapi\Objects\SecurityScheme;
10
11
final class OAuth2SecurityScheme extends SecurityScheme
12
{
13
    private $flows;
14
15 2
    public function __construct(
16
        OAuthFlows $flows,
17
        string $description = null,
18
        Extensions $extensions = null
19
    ) {
20 2
        parent::__construct(
21 2
            SecurityScheme::TYPE_OAUTH2,
22
            $description,
23
            $extensions
24
        );
25 2
        $this->flows = $flows;
26
    }
27
28 2
    public function getFlows(): OAuthFlows
29
    {
30 2
        return $this->flows;
31
    }
32
33 2
    protected function normalizeRequiredSchemeProperties(): array
34
    {
35
        return [
36 2
            'flows' => $this->getFlows()->jsonSerialize(),
37
        ];
38
    }
39
}
40