File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 7
7
use Redmine \Exception \MissingParameterException ;
8
8
use Redmine \Exception \SerializerException ;
9
9
use Redmine \Exception \UnexpectedResponseException ;
10
+ use Redmine \Http \HttpFactory ;
11
+ use Redmine \Serializer \JsonSerializer ;
10
12
use Redmine \Serializer \PathSerializer ;
11
13
use Redmine \Serializer \XmlSerializer ;
12
14
@@ -127,11 +129,26 @@ public function getIdByName($project, $name)
127
129
*
128
130
* @param int $id the issue category id
129
131
*
130
- * @return array information about the category
132
+ * @return array|false|string information about the category as array or false|string on error
131
133
*/
132
134
public function show ($ id )
133
135
{
134
- return $ this ->get ('/issue_categories/ ' . urlencode (strval ($ id )) . '.json ' );
136
+ $ this ->lastResponse = $ this ->getHttpClient ()->request (HttpFactory::makeJsonRequest (
137
+ 'GET ' ,
138
+ '/issue_categories/ ' . urlencode (strval ($ id )) . '.json ' ,
139
+ ));
140
+
141
+ $ body = $ this ->lastResponse ->getContent ();
142
+
143
+ if ('' === $ body ) {
144
+ return false ;
145
+ }
146
+
147
+ try {
148
+ return JsonSerializer::createFromString ($ body )->getNormalized ();
149
+ } catch (SerializerException $ e ) {
150
+ return 'Error decoding body as JSON: ' . $ e ->getPrevious ()->getMessage ();
151
+ }
135
152
}
136
153
137
154
/**
You can’t perform that action at this time.
0 commit comments