Passed
Branch release/v2.0.0 (f3d8ba)
by Anatoly
03:59
created

ServerVariable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 65
ccs 0
cts 16
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A setEnum() 0 3 1
A setDescription() 0 3 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Fenric <[email protected]>
7
 * @copyright Copyright (c) 2018, Anatoly Fenric
8
 * @license https://github.com/sunrise-php/http-router/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/http-router
10
 */
11
12
namespace Sunrise\Http\Router\OpenApi;
13
14
/**
15
 * OAS Server Variable Object
16
 *
17
 * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#server-variable-object
18
 */
19
class ServerVariable extends AbstractObject
20
{
21
22
    /**
23
     * @var string
24
     */
25
    protected $name;
26
27
    /**
28
     * @var string[]
29
     *
30
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-servervariableenum
31
     */
32
    protected $enum;
33
34
    /**
35
     * @var string
36
     *
37
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-servervariabledefault
38
     */
39
    protected $default;
40
41
    /**
42
     * @var string
43
     *
44
     * @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-servervariabledescription
45
     */
46
    protected $description;
47
48
    /**
49
     * @param string $name
50
     * @param string $default
51
     */
52
    public function __construct(string $name, string $default)
53
    {
54
        $this->name = $name;
55
        $this->default = $default;
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getName() : string
62
    {
63
        return $this->name;
64
    }
65
66
    /**
67
     * @param string ...$enum
68
     *
69
     * @return void
70
     */
71
    public function setEnum(string ...$enum) : void
72
    {
73
        $this->enum = $enum;
74
    }
75
76
    /**
77
     * @param string $description
78
     *
79
     * @return void
80
     */
81
    public function setDescription(string $description) : void
82
    {
83
        $this->description = $description;
84
    }
85
}
86