Passed
Push — master ( 624c72...422b2f )
by Vladimir
06:35
created

CheckTrait::setDescr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * This file is part of the `tvi/monitor-bundle` project.
5
 *
6
 * (c) https://github.com/turnaev/monitor-bundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
11
12
namespace Tvi\MonitorBundle\Check;
13
14
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
15
 * @author Vladimir Turnaev <[email protected]>
16
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
17
trait CheckTrait
18
{
19
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
20
     * @var string
21
     */
22
    protected $id;
23
24
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
25
     * @var string[]
26
     */
27
    protected $tags = [];
28
29
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
30
     * @var string
31
     */
32
    protected $group;
33
34
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
35
     * @var string
36
     */
37
    protected $descr;
38
39
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
40
     * @var ?string
41
     */
42
    protected $label;
43
44 17
    public function getId(): string
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getId()
Loading history...
45
    {
46 17
        return $this->id;
47
    }
48
49
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $id should have a doc-comment as per coding-style.
Loading history...
50
     * @return $this
51
     */
52 54
    public function setId(string $id)
53
    {
54 54
        $this->id = $id;
55
56 54
        return $this;
57
    }
58
59
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
60
     * @return string[]
61
     */
62 3
    public function getTags(): array
63
    {
64 3
        return $this->tags;
65
    }
66
67
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
68
     * @param string[] $tags
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
69
     *
70
     * @return $this
71
     */
72 39
    public function setTags(array $tags)
73
    {
74 39
        $this->tags = $tags;
75
76 39
        return $this;
77
    }
78
79 3
    public function getGroup(): string
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getGroup()
Loading history...
80
    {
81 3
        return $this->group;
82
    }
83
84
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $group should have a doc-comment as per coding-style.
Loading history...
85
     * @return $this
86
     */
87 39
    public function setGroup(string $group)
88
    {
89 39
        $this->group = $group;
90
91 39
        return $this;
92
    }
93
94
95 2
    public function getLabel()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getLabel()
Loading history...
96
    {
97 2
        return $this->label;
98
    }
99
100
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $label should have a doc-comment as per coding-style.
Loading history...
101
     * @return $this
102
     */
103 39
    public function setLabel($label)
104
    {
105 39
        $this->label = $label;
106
107 39
        return $this;
108
    }
109
110
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
111
     * @return ?string
112
     */
113
    public function getDescr(): ?string
114
    {
115
        return $this->descr;
116
    }
117
118
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $descr should have a doc-comment as per coding-style.
Loading history...
119
     * @return $this
120
     */
121 34
    public function setDescr(?string $descr)
122
    {
123 34
        $this->descr = $descr;
124
125 34
        return $this;
126
    }
127
128 35
    public function setAdditionParams(array $data)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function setAdditionParams()
Loading history...
129
    {
130 35
        if (array_key_exists('id', $data)) {
131 35
            $this->setId($data['id']);
132
        }
133
134 35
        if (array_key_exists('group', $data)) {
135 35
            $this->setGroup($data['group']);
136
        }
137
138 35
        if (array_key_exists('tags', $data)) {
139 35
            $this->setTags($data['tags']);
140
        }
141
142 35
        if (array_key_exists('label', $data)) {
143 35
            $this->setLabel($data['label']);
144
        }
145
146 35
        if (array_key_exists('descr', $data)) {
147 34
            $this->setDescr($data['descr']);
148
        }
149 35
    }
150
}
151