Test Failed
Push — master ( 90252a...135589 )
by Waaaaaaaaaa
02:31
created

Config::setRelease()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Logfile;
4
5
class Config
6
{
7
    protected $path = '';
8
9
    protected $tags = [];
10
11
    protected $user = [];
12
13
    protected $release = '';
14
15
    public function hasPath(): bool
16
    {
17
        return !empty($this->path);
18
    }
19
20
    public function getPath(): string
21
    {
22
        return $this->path;
23
    }
24
25
    public function setPath(string $path): void
26
    {
27
        $realpath = realpath($path);
28
29
        if (false === $realpath) {
30
            throw new \InvalidArgumentException('Path does not exist: '.$path);
31
        }
32
33
        $this->path = $realpath . '/';
34
    }
35
36
    public function hasTags(): bool
37
    {
38
        return !empty($this->tags);
39
    }
40
41
    public function getTags(): array
42
    {
43
        return $this->tags;
44
    }
45
46
    public function setTags(array $tags): void
47
    {
48
        $this->tags = $tags;
49
    }
50
51
    public function addTag(string $key, $value): void
52
    {
53
        $this->tags[$key] = $value;
54
    }
55
56
    public function hasUser(): bool
57
    {
58
        return !empty($this->user);
59
    }
60
61
    public function getUser(): array
62
    {
63
        return $this->user;
64
    }
65
66
    public function setUser(array $user): void
67
    {
68
        $this->user = $user;
69
    }
70
71
    public function hasRelease(): bool
72
    {
73
        return !empty($this->release);
74
    }
75
76
    public function getRelease(): string
77
    {
78
        return $this->release;
79
    }
80
81
    public function setRelease(string $release)
82
    {
83
        $this->release = $release;
84
    }
85
}
86