Option::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 5
dl 0
loc 13
rs 10
1
<?php
2
3
namespace pjpawel\LightApi\Command\Input;
4
5
class Option
6
{
7
8
    public const OPTIONAL = 1;
9
    public const REQUIRED = 2;
10
11
    public string $name;
12
    public ?string $shortcut;
13
    public int $type;
14
    public mixed $default;
15
    public ?string $description;
16
    public ?string $value = null;
17
18
    public function __construct(
19
        string $name,
20
        string $shortcut = null,
21
        int $type = Option::OPTIONAL,
22
        mixed $default = null,
23
        string $description = null
24
    )
25
    {
26
        $this->name = $name;
27
        $this->shortcut = $shortcut;
28
        $this->type = $type;
29
        $this->default = $default;
30
        $this->description = $description;
31
    }
32
33
    /**
34
     * @param string|null $value
35
     */
36
    public function setValue(?string $value): void
37
    {
38
        $this->value = $value;
39
    }
40
}