Server::__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.
7
 *
8
 * @see https://swagger.io/specification/#serverObject
9
 */
10
class Server extends AbstractObject implements ExtensibleInterface
11
{
12
    /**
13
     * REQUIRED. A URL to the target host.
14
     * This URL supports Server Variables and MAY be relative,
15
     * to indicate that the host location is relative to the location where the OpenAPI document is being served.
16
     * Variable substitutions will be made when a variable is named in {brackets}.
17
     *
18
     * @var string
19
     */
20
    public $url;
21
22
    /**
23
     * An optional string describing the host designated by the URL.
24
     * CommonMark syntax MAY be used for rich text representation.
25
     *
26
     * @var string
27
     */
28
    public $description;
29
30
    /**
31
     * A map between a variable name and its value. The value is used for substitution in the server's URL template.
32
     *
33
     * @var ServerVariable[] array<string, ServerVariable>
34
     */
35
    public $variables;
36
37
    /**
38
     * @param string      $url
39
     * @param string|null $description
40
     * @param array|null  $variables
41
     * @param array       $additionalProperties
42
     */
43 6
    public function __construct(
44
        string $url,
45
        string $description = null,
46
        array $variables = null,
47
        array $additionalProperties = []
48
    ) {
49 6
        parent::__construct($additionalProperties);
50 6
        $this->url         = $url;
51 6
        $this->description = $description;
52 6
        $this->variables   = $variables;
53 6
    }
54
}
55