Skip to content

Commit 9fb3dad

Browse files
committed
Merge pull request #2 from Keanor/master
search feature
2 parents 2a436d8 + 4009097 commit 9fb3dad

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed

src/Issue/IssueSearchResult.php

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: keanor
5+
* Date: 29.07.15
6+
* Time: 13:12
7+
*/
8+
9+
namespace JiraRestApi\Issue;
10+
11+
/**
12+
* Issue search result
13+
*
14+
* @package JiraRestApi\Issue
15+
*/
16+
class IssueSearchResult
17+
{
18+
/**
19+
* @var string
20+
*/
21+
protected $expand;
22+
23+
/**
24+
* @var int
25+
*/
26+
protected $startAt;
27+
28+
/**
29+
* @var int
30+
*/
31+
protected $maxResults;
32+
33+
/**
34+
* @var int
35+
*/
36+
protected $total;
37+
38+
/**
39+
* @var Issue[]
40+
*/
41+
protected $issues;
42+
43+
/**
44+
* @return int
45+
*/
46+
public function getStartAt()
47+
{
48+
return $this->startAt;
49+
}
50+
51+
/**
52+
* @param int $startAt
53+
*/
54+
public function setStartAt($startAt)
55+
{
56+
$this->startAt = $startAt;
57+
}
58+
59+
/**
60+
* @return int
61+
*/
62+
public function getMaxResults()
63+
{
64+
return $this->maxResults;
65+
}
66+
67+
/**
68+
* @param int $maxResults
69+
*/
70+
public function setMaxResults($maxResults)
71+
{
72+
$this->maxResults = $maxResults;
73+
}
74+
75+
/**
76+
* @return int
77+
*/
78+
public function getTotal()
79+
{
80+
return $this->total;
81+
}
82+
83+
/**
84+
* @param int $total
85+
*/
86+
public function setTotal($total)
87+
{
88+
$this->total = $total;
89+
}
90+
91+
/**
92+
* @return Issue[]
93+
*/
94+
public function getIssues()
95+
{
96+
return $this->issues;
97+
}
98+
99+
/**
100+
* @param Issue[] $issues
101+
*/
102+
public function setIssues($issues)
103+
{
104+
$this->issues = $issues;
105+
}
106+
107+
/**
108+
* @return string
109+
*/
110+
public function getExpand()
111+
{
112+
return $this->expand;
113+
}
114+
115+
/**
116+
* @param string $expand
117+
*/
118+
public function setExpand($expand)
119+
{
120+
$this->expand = $expand;
121+
}
122+
}

src/Issue/IssueService.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,34 @@ public function transition($issueIdOrKey, $transition)
198198

199199
$this->log->addDebug('getTransitions result='.var_export($ret, true));
200200
}
201+
202+
/**
203+
* Search issues
204+
*
205+
* @param $jql
206+
* @param int $startAt
207+
* @param int $maxResults
208+
* @param array $fields
209+
*
210+
* @return object
211+
*/
212+
public function search($jql, $startAt=0, $maxResults=15, $fields=[])
213+
{
214+
$data = json_encode(array(
215+
'jql' => $jql,
216+
'startAt' => $startAt,
217+
'maxResults' => $maxResults,
218+
'fields' => $fields
219+
));
220+
221+
$ret = $this->exec("search", $data, 'POST');
222+
223+
$result = $this->json_mapper->map(
224+
json_decode($ret), new IssueSearchResult()
225+
);
226+
227+
return $result;
228+
}
201229
}
202230

203231
?>

0 commit comments

Comments
 (0)