Code Duplication    Length = 5-5 lines in 4 locations

mod/gc_api/lib/profile.php 4 locations

@@ 497-501 (lines=5) @@
494
					$response['message'] = 'invalid location data';
495
					return $response;
496
				}
497
				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'])) {
498
					$response['error'] = 4;
499
					$response['message'] = 'missing location data';
500
					return $response;
501
				}
502
503
				if (!isset($value['fr'])) {
504
					$response['error'] = 4;
@@ 514-518 (lines=5) @@
511
					$response['message'] = 'invalid location data';
512
					return $response;
513
				}
514
				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'])) {
515
					$response['error'] = 4;
516
					$response['message'] = 'missing location data';
517
					return $response;
518
				}
519
520
				$user_entity->set('addressString', json_encode($value["en"]));
521
				$user_entity->set('addressStringFr', json_encode($value["fr"]));
@@ 755-759 (lines=5) @@
752
					$response['message'] = 'invalid location data';
753
					return $response;
754
				}
755
				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'])) {
756
					$response['error'] = 4;
757
					$response['message'] = 'missing location data';
758
					return $response;
759
				}
760
761
				if (!isset($value['fr'])) {
762
					$response['error'] = 4;
@@ 772-776 (lines=5) @@
769
					$response['message'] = 'invalid location data';
770
					return $response;
771
				}
772
				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'])) {
773
					$response['error'] = 4;
774
					$response['message'] = 'missing location data';
775
					return $response;
776
				}
777
				break;
778
			case 'email':
779
				$connection = mysqli_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass, $CONFIG->dbname)or die(mysqli_error($connection));