<commit_before><?php

/**
 * @module Streams-tools
 */

/**
 * Renders chat tool.
 * @class Streams chat
 * @constructor
 * @param {array} $options Options for the tool
 * @param {string} $options.publisherId Publisher id of the stream to get messsages from.
 * @param {string} $options.streamName Required. Name of the stream to get messsages from.
 * @param {string} [$options.loadMore] May have one these values: 'scroll', 'click' or 'pull' which indicates what kind of algorithm will be used for loading new messages. 'scroll' means that new messages will be loaded when scrollbar of the chat cointainer reaches the top (for desktop) or whole document scrollbar reaches the top (for android). 'click' will show label with 'Click to see earlier messages' and when user clicks it, new messages will be loaded. Finally, 'pull' implements 'pull-to-refresh' behavior used in many modern applications today when new messages loaded by rubber-scrolling the container by more amount than it actually begins. Defaults to 'scroll' for desktop and Android devices and 'pull' for iOS devices.
*/
function Streams_chat_tool($options)
{
	$user = Users::loggedInUser();
	$userId = $user ? $user->id : '';

	/*
	$defaults = array(
		'loadMore'         => (Q_Request::isTouchscreen() && Q_Request::platform() != 'android') ? 'click' : 'scroll',
		'messagesToLoad'   => 5,
		'messageMaxHeight' => 200
	);
	$options = array_merge($defaults, $options);
	*/
	extract($options);
	
	if (!isset($stream)) {
		$options['publisherId'] = $stream->publisherId;
		$options['streamName'] = $stream->name;
		unset($options);
	} else {
		if (!isset($publisherId)) {
			$publisherId = Streams::requestedPublisherId(true);
		}
		if (!isset($streamName)) {
			$streamName = Streams::requestedName();
		}
		$stream = Streams::fetchOne($userId, $publisherId, $streamName);
		if (!$stream) {
			throw new Q_Exception_MissingRow(array(
				'table'    => 'stream',
				'criteria' => compact('publisherId', 'streamName')
			));
		}
	}


	$options['userId'] = $userId;

	Q_Response::setToolOptions($options);
}<commit_msg>Fixed a typo in previous commit<commit_after><?php

/**
 * @module Streams-tools
 */

/**
 * Renders chat tool.
 * @class Streams chat
 * @constructor
 * @param {array} $options Options for the tool
 * @param {string} $options.publisherId Publisher id of the stream to get messsages from.
 * @param {string} $options.streamName Required. Name of the stream to get messsages from.
 * @param {string} [$options.loadMore] May have one these values: 'scroll', 'click' or 'pull' which indicates what kind of algorithm will be used for loading new messages. 'scroll' means that new messages will be loaded when scrollbar of the chat cointainer reaches the top (for desktop) or whole document scrollbar reaches the top (for android). 'click' will show label with 'Click to see earlier messages' and when user clicks it, new messages will be loaded. Finally, 'pull' implements 'pull-to-refresh' behavior used in many modern applications today when new messages loaded by rubber-scrolling the container by more amount than it actually begins. Defaults to 'scroll' for desktop and Android devices and 'pull' for iOS devices.
*/
function Streams_chat_tool($options)
{
	$user = Users::loggedInUser();
	$userId = $user ? $user->id : '';

	/*
	$defaults = array(
		'loadMore'         => (Q_Request::isTouchscreen() && Q_Request::platform() != 'android') ? 'click' : 'scroll',
		'messagesToLoad'   => 5,
		'messageMaxHeight' => 200
	);
	$options = array_merge($defaults, $options);
	*/
	extract($options);
	
	if (isset($stream)) {
		$options['publisherId'] = $stream->publisherId;
		$options['streamName'] = $stream->name;
		unset($options);
	} else {
		if (!isset($publisherId)) {
			$publisherId = Streams::requestedPublisherId(true);
		}
		if (!isset($streamName)) {
			$streamName = Streams::requestedName();
		}
		$stream = Streams::fetchOne($userId, $publisherId, $streamName);
		if (!$stream) {
			throw new Q_Exception_MissingRow(array(
				'table'    => 'stream',
				'criteria' => compact('publisherId', 'streamName')
			));
		}
	}


	$options['userId'] = $userId;

	Q_Response::setToolOptions($options);
}
{'fraction_non_alphanumeric': 0.13691756272401434, 'fraction_numerical': 0.0019115890083632018, 'mean_word_length': 4.581333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '7554758', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1251, 'n_words': 423}