<commit_before><?php
    require_once(dirname(__FILE__).'/../includes/application.php');

    $output = array(
        'response' => false,
        'message' => 'Something went wrong'
    );
    if (!empty($UserObj)) {
        if (isset($_POST) && isset($_POST['type'])) {
            switch ($_POST['type']) {
                case 'send_sms_circle_of_trust':
                    $types = array(
                        'come_get_me',
                        'need_interruption',
                        'need_to_talk'
                    );
                    if (!empty($_POST['msg_type']) &&
                        in_array($_POST['msg_type'], $types)
                    ) {
                        $msg_type = $_POST['msg_type'];
                        $message = '';
                        switch ($msg_type) {
                            case $types[0]:
                                $message = "Come and get me.I need help getting home safely.
                                Call ASAP to get my Location.
                                via FirstAide web app";
                                break;
                            
                            case $types[1]:
                                $message = "Call and pretend you need me.
                                I need an interruption.
                                via FirstAide web app";
                                break;
                            
                            case $types[2]:
                                $message = "I need to talk.
                                via FirstAide web app";
                                break;
                            
                            default:
                                break;
                        }
                        $numbers = $UserObj->getCircleOfTrustNumbers();
                        if (!empty($message) && !empty($numbers)) {
                            $n = new FirstAide\Notification();
                            $output = $n->sendMultipleSms($numbers, $message);
                        } else {
                            $output['message'] = 'Something went wrong';
                        }
                    } else {
                        $output['message'] = "Invalid Request";
                    }
                    break;
                
                default:
                    break;
            }
        }
    } else {
        $output['message'] = 'Invalid Credentials. Please login before updating details.';
    }

    FirstAide\Utils::jsonify($output);<commit_msg>seperated logics from switch case and enhanced modularity<commit_after><?php
    require_once(dirname(__FILE__).'/../includes/application.php');
    $output = array(
        'response' => false,
        'message' => 'Something went wrong'
    );
    if (!empty($UserObj)) {
        if (isset($_POST) && isset($_POST['type'])) {
            switch ($_POST['type']) {
                case 'send_sms_circle_of_trust':
                    $types = array_keys(FirstAide\Notification::$messages);
                    if (!empty($_POST['msg_type']) &&
                        in_array($_POST['msg_type'], $types)
                    ) {
                        $messages = FirstAide\Notification::$messages;
                        $message = $messages[$_POST['msg_type']];
                        $numbers = $UserObj->getCircleOfTrustNumbers();
                        $n = new FirstAide\Notification();
                        $output = $n->sendMultipleSms($numbers, $message);
                    } else {
                        $output['message'] = "Invalid Request";
                    }
                    break;
                
                default:
                    break;
            }
        }
    } else {
        $output['message'] = 'Invalid Credentials. Please login before updating details.';
    }
    FirstAide\Utils::jsonify($output);
{'fraction_non_alphanumeric': 0.10843067546978162, 'fraction_numerical': 0.0007618080243778568, 'mean_word_length': 0.9567809239940388, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2620115', 'n_tokens_mistral': 924, 'n_tokens_neox': 861, 'n_words': 181}