Option   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 34
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A setValue() 0 3 1
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
}