public static function getInstance() { if (CoreAttributesSchemaValidator::$this_instance == null) { CoreAttributesSchemaValidator::$this_instance = new CoreAttributesSchemaValidator(); } return CoreAttributesSchemaValidator::$this_instance; }
if ($is_update_operation === FALSE) { $business_id = BusinessIdGenerator::generate($data["pincode"]); $data["business_id"] = $business_id; $data["created_time"] = date('c'); $data["created_by_user"] = $email_id; } //Generate a random 5 digit OTP $data["otp"] = mt_rand(10000, 99999); $data["status"] = "TRANSIENT"; $data["last_updated_time"] = date('c'); $data["last_updated_user"] = $email_id; /** * Validate the SMSVerifiableCore Attributes. On success it * returns TRUE. On some error, it returns the error JSON */ $validator = CoreAttributesSchemaValidator::getInstance(); $is_validation_passed = $validator->validateSMSVerifiableAttributes($data); if ($is_validation_passed !== TRUE) { echo $is_validation_passed; return; } //If a new business entry, check whether it exists already if ($is_update_operation === FALSE && CoreAttributesUtils::exists($data) === TRUE) { $error_json = array("status" => "error", "error" => "Business already exists"); echo json_encode($error_json); return; } //If an update operation, don't re-generate business_id and set $replace to true if ($is_update_operation === TRUE) { $attributes = SimpleDbUtils::genSimpleDbAttributesArray($data, true); } else {