File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 7
7
use Redmine \Exception ;
8
8
use Redmine \Exception \SerializerException ;
9
9
use Redmine \Exception \UnexpectedResponseException ;
10
+ use Redmine \Http \HttpFactory ;
10
11
use Redmine \Serializer \JsonSerializer ;
11
12
use Redmine \Serializer \PathSerializer ;
12
13
use Redmine \Serializer \XmlSerializer ;
@@ -132,17 +133,30 @@ public function all(array $params = [])
132
133
* @param int $id the issue id
133
134
* @param array $params extra associated data
134
135
*
135
- * @return array information about the issue
136
+ * @return array|false|string information about the issue as array or false|string on error
136
137
*/
137
138
public function show ($ id , array $ params = [])
138
139
{
139
140
if (isset ($ params ['include ' ]) && is_array ($ params ['include ' ])) {
140
141
$ params ['include ' ] = implode (', ' , $ params ['include ' ]);
141
142
}
142
143
143
- return $ this ->get (
144
+ $ this ->lastResponse = $ this ->getHttpClient ()->request (HttpFactory::makeJsonRequest (
145
+ 'GET ' ,
144
146
PathSerializer::create ('/issues/ ' . urlencode (strval ($ id )) . '.json ' , $ params )->getPath ()
145
- );
147
+ ));
148
+
149
+ $ body = $ this ->lastResponse ->getContent ();
150
+
151
+ if ('' === $ body ) {
152
+ return false ;
153
+ }
154
+
155
+ try {
156
+ return JsonSerializer::createFromString ($ body )->getNormalized ();
157
+ } catch (SerializerException $ e ) {
158
+ return 'Error decoding body as JSON: ' . $ e ->getPrevious ()->getMessage ();
159
+ }
146
160
}
147
161
148
162
/**
You can’t perform that action at this time.
0 commit comments