Code Duplication    Length = 5-5 lines in 2 locations

apps/dav/lib/SystemTag/SystemTagPlugin.php 1 location

@@ 164-168 (lines=5) @@
161
	 * @throws UnsupportedMediaType if the content type is not supported
162
	 */
163
	private function createTag($data, $contentType = 'application/json') {
164
		if (explode(';', $contentType)[0] === 'application/json') {
165
			$data = json_decode($data, true);
166
		} else {
167
			throw new UnsupportedMediaType();
168
		}
169
170
		if (!isset($data['name'])) {
171
			throw new BadRequest('Missing "name" attribute');

apps/comments/lib/Dav/CommentsPlugin.php 1 location

@@ 225-229 (lines=5) @@
222
	 * @throws UnsupportedMediaType if the content type is not supported
223
	 */
224
	private function createComment($objectType, $objectId, $data, $contentType = 'application/json') {
225
		if (explode(';', $contentType)[0] === 'application/json') {
226
			$data = json_decode($data, true);
227
		} else {
228
			throw new UnsupportedMediaType();
229
		}
230
231
		$actorType = $data['actorType'];
232
		$actorId = null;