forked from Zayon/kanboard-redmine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RedmineTask.php
105 lines (93 loc) · 1.86 KB
/
RedmineTask.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
namespace Kanboard\Plugin\Redmine;
use Kanboard\Core\ExternalTask\ExternalTaskInterface;
/**
* Redmine Task
*
* @package Kanboard\Plugin\Redmine
* @author Pablo Godinez
*/
class RedmineTask implements ExternalTaskInterface
{
/**
* Data of issue
*
* @var array
*/
private $issue;
/**
* Uri, format : "/issue/XXXXX" where XXXXX is issue number
* Used to provide an url for humans
*
* @var string
*/
private $uri;
/**
* @param string $jsonUri Uri of issue
* @param array $issue Issue array returned from Redmine
*/
public function __construct($uri, array $issue)
{
$this->setUri($uri);
$this->setIssue($issue);
}
/**
* Get Issue
*
* @return stdClass
*/
public function getIssue()
{
return (object) $this->issue;
}
/**
* Set Issue
*
* @param array $issue
*/
private function setIssue(array $issue)
{
$this->issue = $issue;
}
/**
* Return Uniform Resource Identifier for the task
*
* @return string
*/
public function getUri()
{
return $this->uri;
}
/**
* Set Uri
*
* @param string $uri
*/
private function setUri($uri)
{
$this->uri = $uri;
}
/**
* Get issue number
*
* @return int issue number
*/
public function getIssueNumber()
{
return $this->issue['id'];
}
/**
* Return a dict to populate the task form
*
* @return array
*/
public function getFormValues()
{
return array(
'title' => $this->issue['subject'],
'reference' => $this->issue['id'],
'date_started' => $this->issue['start_date'],
'description' => $this->issue['description']
);
}
}