<commit_before><?php

/**
 * TCP支持类
 * Swoole版本需求：1.8.6+
 * 仅当运行于HttpServer模式时支持
 * 
 * @author ShuangYa
 * @package SYFramework
 * @category Swoole
 * @link http://www.sylingd.com/
 * @copyright Copyright (c) 2015-2016 ShuangYa
 * @license http://lab.sylingd.com/go.php?name=framework&type=license
 */

namespace sy\swoole;

use \Sy;
use \sy\base\SYException;

class TcpServer {
	public static function eventReceive($server, int $fd, int $from_id, string $data) {
		if (Sy::$debug && function_exists('xdebug_start_trace')) {
			xdebug_start_trace();
		}
		$info = $server->connection_info($fd);
		$port = $info['server_port'];
		Server::triggerEventHandle('Receive', [$server, $fd, $from_id, $data]);
		if (Sy::$debug && function_exists('xdebug_stop_trace')) {
			xdebug_stop_trace();
		}
	}
	public static function eventConnect($server, int $fd, int $from_id) {
		$info = $server->connection_info($fd);
		$port = $info['server_port'];
		Server::triggerEventHandle('Connect', [$server, $fd, $from_id]);
	}
	public static function eventClose($server, int $fd, int $from_id) {
		$info = $server->connection_info($fd);
		$port = $info['server_port'];
		Server::triggerEventHandle('Close', [$server, $fd, $from_id]);
	}
}<commit_msg>Fix a bug<commit_after><?php

/**
 * TCP支持类
 * Swoole版本需求：1.8.6+
 * 仅当运行于HttpServer模式时支持
 * 
 * @author ShuangYa
 * @package SYFramework
 * @category Swoole
 * @link http://www.sylingd.com/
 * @copyright Copyright (c) 2015-2016 ShuangYa
 * @license http://lab.sylingd.com/go.php?name=framework&type=license
 */

namespace sy\swoole;

use \Sy;
use \sy\base\SYException;

class TcpServer {
	public static function eventReceive($server, int $fd, int $from_id, string $data) {
		if (Sy::$debug && function_exists('xdebug_start_trace')) {
			xdebug_start_trace();
		}
		$info = $server->connection_info($fd);
		$port = $info['server_port'];
		Server::triggerEventHandle('Receive', $port, [$server, $fd, $from_id, $data]);
		if (Sy::$debug && function_exists('xdebug_stop_trace')) {
			xdebug_stop_trace();
		}
	}
	public static function eventConnect($server, int $fd, int $from_id) {
		$info = $server->connection_info($fd);
		$port = $info['server_port'];
		Server::triggerEventHandle('Connect', $port, [$server, $fd, $from_id]);
	}
	public static function eventClose($server, int $fd, int $from_id) {
		$info = $server->connection_info($fd);
		$port = $info['server_port'];
		Server::triggerEventHandle('Close', $port, [$server, $fd, $from_id]);
	}
}
{'fraction_non_alphanumeric': 0.17924909164311667, 'fraction_numerical': 0.008881711748082357, 'mean_word_length': 5.257575757575758, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7295316', 'n_tokens_mistral': 968, 'n_tokens_neox': 918, 'n_words': 177}