Server::getUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
namespace FatCode\OpenApi\Annotation;
4
5
use FatCode\Annotation\Target;
6
use FatCode\OpenApi\Annotation\Server\Variable;
7
8
/**
9
 * Server definition.
10
 *
11
 * @Annotation
12
 * @Target(Target::TARGET_ANNOTATION)
13
 */
14
class Server
15
{
16
    /**
17
     * @Required
18
     * @var string
19
     */
20
    public $id;
21
22
    /**
23
     * @var string
24
     */
25
    public $port = '80';
26
27
    /**
28
     * @var string
29
     */
30
    public $host = 'localhost';
31
32
    /**
33
     * An optional string describing the host designated by the URL.
34
     * CommonMark syntax MAY be used for rich text representation.
35
     * @var string
36
     */
37
    public $description;
38
39
    /**
40
     * @var Variable[]
41
     */
42
    public $variables;
43
44
    /**
45
     * A URL to the target host. This URL supports Server Variables and MAY be relative,
46
     * to indicate that the host location is relative to the location where the OpenAPI
47
     * document is being served. Variable substitutions will be made when a variable
48
     * is named in {brackets}.
49
     *
50
     * @var string
51
     */
52
    public $url = 'http://{host}:{port}/';
53
54
    public function getUrl() : string
55
    {
56
        return $this->url;
57
    }
58
}
59