Header::normalizeRequiredProperties()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Objects;
6
7
use Aweapi\Openapi\Extensions;
8
9
final class Header extends Parameter implements HeaderAggregate
10
{
11 12
    public function __construct(
12
        SchemaAggregate $schema = null,
13
        MediaTypes $content = null,
14
        string $description = null,
15
        bool $required = null,
16
        bool $deprecated = false,
17
        bool $allowEmptyValue = false,
18
        string $style = null,
19
        bool $explode = null,
20
        bool $allowReserved = false,
21
        Examples $examples = null,
22
        Extensions $extensions = null
23
    ) {
24 12
        parent::__construct(
25
            // The name MUST not be used.
26 12
            '',
27 12
            'header',
28
            $schema,
29
            $content,
30
            $description,
31
            $required,
32
            $deprecated,
33
            $allowEmptyValue,
34
            $style,
35
            $explode,
36
            $allowReserved,
37
            $examples,
38
            $extensions
39
        );
40
    }
41
42 11
    protected function normalizeRequiredProperties(): array
43
    {
44 11
        $fields = parent::normalizeRequiredProperties();
45
        unset(
46
            // The field `name` MUST NOT be specified, it is given in the corresponding headers map.
47 11
            $fields['name'],
48
            // The field `in` MUST NOT be specified, it is implicitly in `header`.
49 11
            $fields['in']
50
        );
51
52 11
        return $fields;
53
    }
54
}
55