Code Duplication    Length = 6-6 lines in 4 locations

mod/gc_api/lib/profile.php 4 locations

@@ 486-491 (lines=6) @@
483
				$user_entity->set('sector', json_encode($value));
484
				break;
485
			case 'location':
486
				if (!isset($value['en'])) {
487
					$response['error'] = 4;
488
					$response['message'] = 'missing english location data';
489
					return $response;
490
				}
491
				$locationData = json_decode(json_encode($value['en']), true);
492
				if (!isset($locationData['street'])&&!isset($locationData['city'])&&!isset($locationData['province'])&&!isset($locationData['postalCode'])&&!isset($locationData['country'])&&!isset($locationData['building'])&&!isset($locationData['floor'])&&!isset($locationData['officeNum'])) {
493
					$response['error'] = 4;
494
					$response['message'] = 'invalid location data';
@@ 503-508 (lines=6) @@
500
					return $response;
501
				}
502
503
				if (!isset($value['fr'])) {
504
					$response['error'] = 4;
505
					$response['message'] = 'missing french location data';
506
					return $response;
507
				}
508
				$locationData = json_decode(json_encode($value['fr']), true);
509
				if (!isset($locationData['street'])&&!isset($locationData['city'])&&!isset($locationData['province'])&&!isset($locationData['postalCode'])&&!isset($locationData['country'])&&!isset($locationData['building'])&&!isset($locationData['floor'])&&!isset($locationData['officeNum'])) {
510
					$response['error'] = 4;
511
					$response['message'] = 'invalid location data';
@@ 744-749 (lines=6) @@
741
				}
742
				break;
743
			case 'location':
744
				if (!isset($value['en'])) {
745
					$response['error'] = 4;
746
					$response['message'] = 'missing english location data';
747
					return $response;
748
				}
749
				$locationData = json_decode(json_encode($value['en']), true);
750
				if (!isset($locationData['street'])&&!isset($locationData['city'])&&!isset($locationData['province'])&&!isset($locationData['postalCode'])&&!isset($locationData['country'])&&!isset($locationData['building'])&&!isset($locationData['floor'])&&!isset($locationData['officeNum'])) {
751
					$response['error'] = 4;
752
					$response['message'] = 'invalid location data';
@@ 761-766 (lines=6) @@
758
					return $response;
759
				}
760
761
				if (!isset($value['fr'])) {
762
					$response['error'] = 4;
763
					$response['message'] = 'missing french location data';
764
					return $response;
765
				}
766
				$locationData = json_decode(json_encode($value['fr']), true);
767
				if (!isset($locationData['street'])&&!isset($locationData['city'])&&!isset($locationData['province'])&&!isset($locationData['postalCode'])&&!isset($locationData['country'])&&!isset($locationData['building'])&&!isset($locationData['floor'])&&!isset($locationData['officeNum'])) {
768
					$response['error'] = 4;
769
					$response['message'] = 'invalid location data';