Completed
Pull Request — master (#3407)
by Antoine
04:50
created

Parameter::getContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace ApiPlatform\Core\OpenApi;
15
16
class Parameter
17
{
18
    private $name;
19
    private $in;
20
    private $description;
21
    private $required;
22
    private $deprecated;
23
    private $allowEmptyValue;
24
    private $schema;
25
    private $explode;
26
    private $allowReserved;
27
    private $style;
28
    private $example;
29
    private $examples;
30
    private $content;
31
32
    public function __construct(string $name, string $in, string $description = '', bool $required = false, bool $deprecated = false, bool $allowEmptyValue = false, array $schema = [], string $style = null, bool $explode = false, bool $allowReserved = false, $example = null, $examples = [], array $content = [])
33
    {
34
        $this->name = $name;
35
        $this->in = $in;
36
        $this->description = $description;
37
        $this->required = $required;
38
        $this->deprecated = $deprecated;
39
        $this->allowEmptyValue = $allowEmptyValue;
40
        $this->schema = $schema;
41
        $this->explode = $explode;
42
        $this->allowReserved = $allowReserved;
43
        $this->example = $example;
44
        $this->examples = $examples;
45
        $this->content = $content;
46
47
        if (null === $style) {
48
            if ('query' === $in || 'cookie' === $in) {
49
                $this->style = 'form';
50
            } elseif ('path' === $in || 'header' === $in) {
51
                $this->style = 'simple';
52
            }
53
        } else {
54
            $this->style = $style;
55
        }
56
    }
57
58
    public function getName()
59
    {
60
        return $this->name;
61
    }
62
63
    public function getIn()
64
    {
65
        return $this->in;
66
    }
67
68
    public function getDescription()
69
    {
70
        return $this->description;
71
    }
72
73
    public function getRequired()
74
    {
75
        return $this->required;
76
    }
77
78
    public function getDeprecated()
79
    {
80
        return $this->deprecated;
81
    }
82
83
    public function getAllowEmptyValue()
84
    {
85
        return $this->allowEmptyValue;
86
    }
87
88
    public function getSchema()
89
    {
90
        return $this->schema;
91
    }
92
93
    public function getExplode()
94
    {
95
        return $this->explode;
96
    }
97
98
    public function getAllowReserved()
99
    {
100
        return $this->allowReserved;
101
    }
102
103
    public function getStyle()
104
    {
105
        return $this->style;
106
    }
107
108
    public function getExample()
109
    {
110
        return $this->example;
111
    }
112
113
    public function getExamples()
114
    {
115
        return $this->examples;
116
    }
117
118
    public function getContent()
119
    {
120
        return $this->content;
121
    }
122
}
123