Response::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 10
rs 10
c 0
b 0
f 0
ccs 5
cts 5
cp 1
crap 1
1
<?php
2
3
namespace erasys\OpenApi\Spec\v3;
4
5
/**
6
 * Describes a single response from an API Operation, including design-time, static links to operations based on the
7
 * response.
8
 *
9
 * @see https://swagger.io/specification/#responsesObject
10
 */
11
class Response extends AbstractObject implements ExtensibleInterface
12
{
13
    /**
14
     * REQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
15
     *
16
     * @var string
17
     */
18
    public $description;
19
20
    /**
21
     * Maps a header name to its definition. RFC7230 states header names are case insensitive. If a response header is
22
     * defined with the name "Content-Type", it SHALL be ignored.
23
     *
24
     * @var Header[]|Reference[] array<string, Header>|array<string, Reference>
25
     */
26
    public $headers;
27
28
    /**
29
     * A map containing descriptions of potential response payloads. The key is a media type or media type range and the
30
     * value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g.
31
     * text/plain overrides text/*
32
     *
33
     * @see https://tools.ietf.org/html/rfc7231#appendix-D
34
     * @var MediaType[] array<string, MediaType>
35
     */
36
    public $content;
37
38
    /**
39
     * A map of operations links that can be followed from the response. The key of the map is a short name for the
40
     * link, following the naming constraints of the names for Component Objects.
41
     *
42
     * @see https://swagger.io/specification/#componentsObject
43
     * @var Link[]|Reference[] array<string, Link>|array<string, Reference>
44
     */
45
    public $links;
46
47
    /**
48
     * @param string                    $description
49
     * @param MediaType[]|null          $content
50
     * @param Header[]|Reference[]|null $headers
51
     * @param array                     $additionalProperties
52
     */
53 3
    public function __construct(
54
        string $description,
55
        array $content = null,
56
        array $headers = null,
57
        array $additionalProperties = []
58
    ) {
59 3
        parent::__construct($additionalProperties);
60 3
        $this->description = $description;
61 3
        $this->content     = $content;
62 3
        $this->headers     = $headers;
63 3
    }
64
}
65