@@ 141-144 (lines=4) @@ | ||
138 | $paperHiveString = $this->fetchDiscussions($bookId); |
|
139 | $paperHiveDiscussions = json_decode($paperHiveString, true); |
|
140 | $disscussionCount = -1; |
|
141 | if (json_last_error() === JSON_ERROR_NONE && isset($paperHiveDiscussions['discussions'])) { |
|
142 | // Silently ignore discussions as this might indicate temporary unavailability |
|
143 | $disscussionCount = count($paperHiveDiscussions['discussions']); |
|
144 | } |
|
145 | return new DataResponse($disscussionCount, Http::STATUS_OK); |
|
146 | } |
|
147 | ||
@@ 238-240 (lines=3) @@ | ||
235 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
|
236 | } |
|
237 | $discussionCount = -1; |
|
238 | if (json_last_error() === JSON_ERROR_NONE && isset($paperHiveDiscussions['discussions'])) { |
|
239 | $discussionCount = count($paperHiveDiscussions['discussions']); |
|
240 | } |
|
241 | ||
242 | // Save the file |
|
243 | $title = $paperHiveObject['metadata']['title']; |