ServerVariable::__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
 * An object representing a Server Variable for server URL template substitution.
7
 *
8
 * @see https://swagger.io/specification/#serverVariableObject
9
 */
10
class ServerVariable extends AbstractObject implements ExtensibleInterface
11
{
12
    /**
13
     * REQUIRED. The default value to use for substitution, and to send,
14
     * if an alternate value is not supplied. Unlike the Schema Object's default,
15
     * this value MUST be provided by the consumer.
16
     *
17
     * @var string
18
     */
19
    public $default;
20
21
    /**
22
     * An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
23
     *
24
     * @var string
25
     */
26
    public $description;
27
28
    /**
29
     * An enumeration of string values to be used if the substitution options are from a limited set.
30
     *
31
     * @var string[]
32
     */
33
    public $enum;
34
35
    /**
36
     * @param string   $default
37
     * @param string   $description
38
     * @param string[] $enum
39
     * @param array    $additionalProperties
40
     */
41 6
    public function __construct(
42
        string $default,
43
        string $description = null,
44
        array $enum = null,
45
        array $additionalProperties = []
46
    ) {
47 6
        parent::__construct($additionalProperties);
48 6
        $this->default     = $default;
49 6
        $this->description = $description;
50 6
        $this->enum        = $enum;
51 6
    }
52
}
53