ReleaseBuild::setDescription()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Manavo\DoneDone;
4
5
class ReleaseBuild
6
{
7
8
    private $orderNumbers = null;
9
    private $title = null;
10
    private $description = null;
11
    private $emailBody = null;
12
    private $userIdsToCc = null;
0 ignored issues
show
Unused Code introduced by
The property $userIdsToCc is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
13
14
    /**
15
     * Set issue IDs to include in this release build.
16
     *
17
     * Can be an array of IDs, a comma separated list of IDs,
18
     * or just a single ID.
19
     *
20
     * @param array|string|int $ids
21
     */
22 3
    public function setIssueIds($ids)
23
    {
24 3
        if (is_array($ids)) {
25 3
            $ids = implode(',', $ids);
26 3
        }
27
28 3
        $this->orderNumbers = $ids;
29 3
    }
30
31
    /**
32
     * @param string $description
33
     */
34 3
    public function setDescription($description)
35
    {
36 3
        $this->description = $description;
37 3
    }
38
39
    /**
40
     * @param string $emailBody
41
     */
42 3
    public function setEmailBody($emailBody)
43
    {
44 3
        $this->emailBody = $emailBody;
45 3
    }
46
47
    /**
48
     * @param string $title
49
     */
50 3
    public function setTitle($title)
51
    {
52 3
        $this->title = $title;
53 3
    }
54
55
    /**
56
     * Set user IDs to CC. Can be an array of IDs, a comma separated list of
57
     * IDs, or just a single ID.
58
     *
59
     * @param array|string|int $ids
60
     */
61
//    public function setUserIdsToCc($ids)
62
//    {
63
//        if (is_array($ids)) {
64
//            $ids = implode(',', $ids);
65
//        }
66
//
67
//        $this->userIdsToCc = $ids;
68
//    }
69
70
    /**
71
     * @return array
72
     */
73 18
    public function toArray()
74
    {
75
        $data = [
76 18
            'order_numbers' => $this->orderNumbers,
77 18
            'title'         => $this->title
78 18
        ];
79
80 18
        if ($this->description) {
81 3
            $data['description'] = $this->description;
82 3
        }
83
84 18
        if ($this->emailBody) {
85 3
            $data['email_body'] = $this->emailBody;
86 3
        }
87
88
        /**
89
         * Get a 500 error from DoneDone when this is specified, remove for now
90
         */
91
//        if ($this->userIdsToCc) {
92
//            $data['user_ids_to_cc'] = $this->userIdsToCc;
93
//        }
94
95 18
        return $data;
96
    }
97
98
}
99