Test Failed
Pull Request — master (#34)
by Anatoly
02:07
created

Header::getComponentName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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\Annotation\OpenApi;
13
14
/**
15
 * Import classes
16
 */
17
use Sunrise\Http\Router\OpenApi\ComponentObjectInterface;
18
19
/**
20
 * Import functions
21
 */
22
use function spl_object_hash;
23
24
/**
25
 * @Annotation
26
 *
27
 * @Target({"ALL"})
28
 *
29
 * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#header-object
30
 */
31
final class Header extends AbstractAnnotation implements HeaderInterface, ComponentObjectInterface
32
{
33
34
    /**
35
     * {@inheritDoc}
36
     */
37
    protected const IGNORE_FIELDS = ['refName'];
38
39
    /**
40
     * @var string
41
     */
42
    public $refName;
43
44
    /**
45
     * @var string
46
     *
47
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterdescription
48
     */
49
    public $description;
50
51
    /**
52
     * @var bool
53
     *
54
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterrequired
55
     */
56
    public $required;
57
58
    /**
59
     * @var bool
60
     *
61
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterdeprecated
62
     */
63
    public $deprecated;
64
65
    /**
66
     * @var bool
67
     *
68
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterallowemptyvalue
69
     */
70
    public $allowEmptyValue;
71
72
    /**
73
     * @var bool
74
     *
75
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterallowreserved
76
     */
77
    public $allowReserved;
78
79
    /**
80
     * @var \Sunrise\Http\Router\Annotation\OpenApi\SchemaInterface
81
     *
82
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterschema
83
     */
84
    public $schema;
85
86
    /**
87
     * @var mixed
88
     *
89
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterexample
90
     */
91
    public $example;
92
93
    /**
94
     * @var array<\Sunrise\Http\Router\Annotation\OpenApi\ExampleInterface>
95
     *
96
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterexamples
97
     */
98
    public $examples;
99
100
    /**
101
     * {@inheritDoc}
102
     */
103
    public function getComponentName() : string
104
    {
105
        return 'headers';
106
    }
107
108
    /**
109
     * {@inheritDoc}
110
     */
111
    public function getReferenceName() : string
112
    {
113
        return $this->refName ?? spl_object_hash($this);
114
    }
115
}
116