HttpSecurityScheme   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 2
cbo 1
dl 0
loc 50
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
A getBearerFormat() 0 4 1
A getScheme() 0 4 1
A hasBearerFormat() 0 4 1
A normalizeOptionalSchemeProperties() 0 6 2
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\SecurityScheme;
9
10
final class HttpSecurityScheme extends SecurityScheme
11
{
12
    private $bearerFormat;
13
14
    private $scheme;
15
16 2
    public function __construct(
17
        string $scheme,
18
        string $bearerFormat = null,
19
        string $description = null,
20
        Extensions $extensions = null
21
    ) {
22 2
        parent::__construct(
23 2
            SecurityScheme::TYPE_HTTP,
24
            $description,
25
            $extensions
26
        );
27 2
        $this->scheme = $scheme;
28 2
        $this->bearerFormat = $bearerFormat;
29
    }
30
31 1
    public function getBearerFormat(): string
32
    {
33 1
        return $this->bearerFormat;
34
    }
35
36 2
    public function getScheme(): string
37
    {
38 2
        return $this->scheme;
39
    }
40
41 2
    public function hasBearerFormat(): bool
42
    {
43 2
        return isset($this->bearerFormat);
44
    }
45
46 2
    protected function normalizeOptionalSchemeProperties(): array
47
    {
48
        return [
49 2
            'bearerFormat' => $this->hasBearerFormat() ? $this->getBearerFormat() : null,
50
        ];
51
    }
52
53 2
    protected function normalizeRequiredSchemeProperties(): array
54
    {
55
        return [
56 2
            'scheme' => $this->getScheme(),
57
        ];
58
    }
59
}
60