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

WorkItem   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 18
c 2
b 0
f 0
dl 0
loc 83
rs 10
ccs 7
cts 7
cp 1
wmc 2

2 Methods

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