<commit_before><?php

class Crunchbutton_Message_Incoming_Sms extends Cana_Model {
	public static function route($request) {

		$from = Phone::clean($request['From']);
		$to = Phone::clean($request['To']);
		$body = trim($request['Body']);
		$admin = Admin::getByPhone($from, true);

		if (!$from || !$body) {
			// error
			header('HTTP/1.0 400 Bad Request');
			exit;
		}
		
		$params = [
			'body' => $body,
			'from' => $from,
			'to' => $to,
			'sid' => $request['SmsMessageSid']
		];

		Phone_Log::log($to, $from, 'message', 'incoming');

		// routing for drivers and support
		if ($admin->id_admin) {
			Log::debug([
				'type' => 'driver-sms',
				'action' => 'message received',
				'id_admin' => $admin->id_admin,
				'name' => $admin->name,
				'from' => $from,
				'body' => $body
			]);
			
			$params['admin'] = $admin;

			if ($admin->isDriver()) {
				$msg[] = (new Message_Incoming_Driver($params))->response;
			}

			if ($msg[0]->stop !== true && $admin->isSupport()) {
				$msg[] = (new Message_Incoming_Support($params))->response;
			}

			if ($msg[0]->msg || ($msg[1] && $msg[1]->msg)) {
				Message_Incoming_Response::twilioSms($msg, $to);
				exit;
			}
		}
		
		if (($msg[0] && $msg[0]->stop !== true) || ($msg[1] && $msg[1]->stop !== true)) {
			// routing for incoming support messges
			$msg[] = (new Message_Incoming_Customer($params))->response;
			if ($msg) {
				Message_Incoming_Response::twilioSms($msg, $to);
				exit;
			}
		}
	}
}<commit_msg>prevent passthru<commit_after><?php

class Crunchbutton_Message_Incoming_Sms extends Cana_Model {
	public static function route($request) {

		$from = Phone::clean($request['From']);
		$to = Phone::clean($request['To']);
		$body = trim($request['Body']);
		$admin = Admin::getByPhone($from, true);

		if (!$from || !$body) {
			// error
			header('HTTP/1.0 400 Bad Request');
			exit;
		}
		
		$params = [
			'body' => $body,
			'from' => $from,
			'to' => $to,
			'sid' => $request['SmsMessageSid']
		];

		Phone_Log::log($to, $from, 'message', 'incoming');

		// routing for drivers and support
		if ($admin->id_admin) {
			Log::debug([
				'type' => 'driver-sms',
				'action' => 'message received',
				'id_admin' => $admin->id_admin,
				'name' => $admin->name,
				'from' => $from,
				'body' => $body
			]);
			
			$params['admin'] = $admin;

			if ($admin->isDriver()) {
				$msg[] = (new Message_Incoming_Driver($params))->response;
			}

			if ($msg[0]->stop !== true && $admin->isSupport()) {
				$msg[] = (new Message_Incoming_Support($params))->response;
			}

			if ($msg[0]->msg || ($msg[1] && $msg[1]->msg)) {
				Message_Incoming_Response::twilioSms($msg, $to);
				exit;
			}
			
			foreach ($msg as $m) {
				if ($m->stop) {
					exit;
				}
			}
		}

		// routing for incoming support messges
		$msg[] = (new Message_Incoming_Customer($params))->response;
		if ($msg) {
			Message_Incoming_Response::twilioSms($msg, $to);
			exit;
		}
	}
}
{'fraction_non_alphanumeric': 0.22048315753657707, 'fraction_numerical': 0.00748553929908132, 'mean_word_length': 3.3684992570579495, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1457107', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1070, 'n_words': 205}