Code Duplication    Length = 10-11 lines in 2 locations

mod/questions/lib/hooks.php 2 locations

@@ 295-304 (lines=10) @@
292
	// expert only changes
293
	if (questions_experts_enabled()) {
294
		// check if an expert can edit a question
295
		if (!$returnvalue && ($entity instanceof ElggQuestion)) {
296
			$container = $entity->getContainerEntity();
297
			if (!($container instanceof ElggGroup)) {
298
				$container = elgg_get_site_entity();
299
			}
300
			
301
			if (questions_is_expert($container, $user)) {
302
				$returnvalue = true;
303
			}
304
		}
305
		
306
		// an expert should be able to edit an answer, so fix this
307
		if (!$returnvalue && ($entity instanceof ElggAnswer)) {
@@ 312-322 (lines=11) @@
309
			if ($entity->getOwnerGUID() !== $user->getGUID()) {
310
				$question = $entity->getContainerEntity();
311
				
312
				if ($question instanceof ElggQuestion) {
313
					$container = $question->getContainerEntity();
314
					if (!($container instanceof ElggGroup)) {
315
						$container = elgg_get_site_entity();
316
					}
317
					
318
					// if the user is an expert
319
					if (questions_is_expert($container, $user)) {
320
						$returnvalue = true;
321
					}
322
				}
323
			}
324
		}
325
	}