RequestBody::__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 request body.
7
 *
8
 * @see https://swagger.io/specification/#requestBodyObject
9
 */
10
class RequestBody extends AbstractObject implements ExtensibleInterface
11
{
12
    /**
13
     * REQUIRED. The content of the request body. The key is a media type or media type range and the value describes
14
     * it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides
15
     * text/*
16
     *
17
     * @see https://tools.ietf.org/html/rfc7231#appendix-D
18
     * @var MediaType[] array<string, MediaType>
19
     */
20
    public $content;
21
22
    /**
23
     * A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for
24
     * rich text representation.
25
     *
26
     * @var string
27
     */
28
    public $description;
29
30
    /**
31
     * Determines if the request body is required in the request. Defaults to false if not specified.
32
     *
33
     * @var bool
34
     */
35
    public $required;
36
37
    /**
38
     * @param MediaType[] $content
39
     * @param string|null $description
40
     * @param bool|null   $required
41
     * @param array       $additionalProperties
42
     */
43 6
    public function __construct(
44
        array $content,
45
        string $description = null,
46
        bool $required = null,
47
        array $additionalProperties = []
48
    ) {
49 6
        parent::__construct($additionalProperties);
50 6
        $this->content     = $content;
51 6
        $this->description = $description;
52 6
        $this->required    = $required;
53 6
    }
54
}
55