<commit_before><?php
/*
 * Copyright (c) 2012, <NAME>, http://www.xrstf.de/
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

/**
 * Command class for `hg cat`
 *
 * @see     http://selenic.com/hg/help/cat
 * @package libhg.Command.Cat
 */
class libhg_Command_Cat_Cmd extends libhg_Command_Cat_Base {
	public function __construct($files) {
		$this->files((array) $files);
	}

	/**
	 * evaluate server's respond to runcommand
	 *
	 * @param  libhg_Stream_Readable      $reader  readable stream
	 * @param  libhg_Stream_Writable      $writer  writable stream
	 * @param  libhg_Repository_Interface $repo    used repository
	 * @return libhg_Command_Cat_Result
	 */
	public function evaluate(libhg_Stream_Readable $reader, libhg_Stream_Writable $writer, libhg_Repository_Interface $repo) {
		$text    = trim($reader->readString(libhg_Stream::CHANNEL_OUTPUT));
		$code    = $reader->readReturnValue();
		$options = $this->getCommandOptions();
		$output  = $options->getSingle('-o');

		// output was redirected into a file
		if ($output !== null) {
			return new libhg_Command_Cat_Result($output, true, $code);
		}

		return new libhg_Command_Cat_Result($text, false, $code);
	}
}<commit_msg>avoid the overhead of encoding and decoding the own class members<commit_after><?php
/*
 * Copyright (c) 2012, <NAME>, http://www.xrstf.de/
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

/**
 * Command class for `hg cat`
 *
 * @see     http://selenic.com/hg/help/cat
 * @package libhg.Command.Cat
 */
class libhg_Command_Cat_Cmd extends libhg_Command_Cat_Base {
	public function __construct($files) {
		$this->files((array) $files);
	}

	/**
	 * evaluate server's respond to runcommand
	 *
	 * @param  libhg_Stream_Readable      $reader  readable stream
	 * @param  libhg_Stream_Writable      $writer  writable stream
	 * @param  libhg_Repository_Interface $repo    used repository
	 * @return libhg_Command_Cat_Result
	 */
	public function evaluate(libhg_Stream_Readable $reader, libhg_Stream_Writable $writer, libhg_Repository_Interface $repo) {
		$text = trim($reader->readString(libhg_Stream::CHANNEL_OUTPUT));
		$code = $reader->readReturnValue();

		// output was redirected into a file
		if ($this->output !== null) {
			return new libhg_Command_Cat_Result($this->output, true, $code);
		}

		return new libhg_Command_Cat_Result($text, false, $code);
	}
}
{'fraction_non_alphanumeric': 0.11996991350131628, 'fraction_numerical': 0.003008649868371568, 'mean_word_length': 4.1252408477842, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '6242159', 'n_tokens_mistral': 916, 'n_tokens_neox': 828, 'n_words': 220}