Passed
Pull Request — master (#15)
by Thijs
08:28 queued 03:03
created

WorkItem::areaPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 0
cts 0
cp 0
crap 2
1
<?php
2
3
namespace TestMonitor\DevOps\Resources;
4
5
class WorkItem extends Resource
6
{
7
    /**
8
     * The id of the work item.
9
     *
10
     * @var string
11
     */
12
    public $id;
13
14
    /**
15
     * The project for the work item.
16
     *
17
     * @var string
18
     */
19
    public $project;
20
21
    /**
22
     * The team for the work item.
23
     *
24
     * @var string
25
     */
26
    public $team;
27
28
    /**
29
     * The title of the work item.
30
     *
31
     * @var string
32
     */
33
    public $title;
34
35
    /**
36
     * The description for the work item.
37
     *
38
     * @var string
39
     */
40
    public $description;
41
42
    /**
43
     * The type of the work item.
44
     *
45
     * @var string
46
     */
47
    public $workItemType;
48
49
    /**
50
     * The repro steps for the work item.
51
     *
52
     * @var string
53
     */
54 3
    public $stepsToReproduce;
55
56 3
    /**
57 3
     * The url for the work item.
58 3
     *
59 3
     * @var string
60 3
     */
61 3
    public $url;
62
63
    /**
64
     * Create a new resource instance.
65
     *
66
     * @param array $attributes
67
     */
68
    public function __construct(array $attributes)
69
    {
70
        $this->id = $attributes['id'] ?? null;
71
        $this->project = $attributes['project'] ?? null;
72
        $this->team = $attributes['team'] ?? null;
73
        $this->title = $attributes['title'];
74
        $this->description = $attributes['description'] ?? '';
75
        $this->workItemType = $attributes['workItemType'];
76
        $this->stepsToReproduce = $attributes['stepsToReproduce'] ?? '';
77
        $this->url = $attributes['url'] ?? '';
78
    }
79
80
    /**
81
     * Generates the area path.
82
     *
83
     * @return string
84
     */
85
    public function areaPath(): string
86
    {
87
        return "{$this->project}\\{$this->team}";
88
    }
89
}
90