<commit_before><?php
/**
 * @package		CSTester
 * @author		<NAME> <<EMAIL>>
 * @copyright	Copyright (c) 2013, <NAME>
 * @license		MIT License, see license.txt
 */
namespace	nazarpc;
/**
 * CSTester class for testing of PHP applications
 */
class CSTester {
	protected	$tests_directory,
				$test_file,
				$cli,
				$port				= 8001,
				$title;
	/**
	 * @param string $tests_directory	Absolute path to tests directory
	 */
	function __construct ($tests_directory) {
		$this->tests_directory	= $tests_directory;
		$this->cli				= PHP_SAPI == 'cli';
		@ini_set('error_log', "$tests_directory/error.log");
		$this->title			= json_decode(file_get_contents("$this->tests_directory/tests.json"), true)['title'];
		/**
		 * Detect file, where tester was called
		 */
		$debug_backtrace		= debug_backtrace();
		$this->test_file		= array_pop($debug_backtrace)['file'];
		unset($debug_backtrace);
		if ($_SERVER['DOCUMENT_ROOT']) {
			$this->test_file	= str_replace(rtrim($_SERVER['DOCUMENT_ROOT'], '/').'/', '', $this->test_file);
		} else {
			$this->test_file	= array_pop(explode('/', $this->test_file));
		}
	}
	/**
	 * Set port number (for CLI mode only)
	 *
	 * @param int $port Default - 8001
	 */
	function set_port ($port) {
		if ($this->cli) {
			$this->port	= (int)$port;
		}
	}
	/**
	 * Run testing<commit_msg>Tiny fix for strict standards in Travis CI<commit_after><?php
/**
 * @package		CSTester
 * @author		<NAME> <<EMAIL>>
 * @copyright	Copyright (c) 2013, <NAME>
 * @license		MIT License, see license.txt
 */
namespace	nazarpc;
/**
 * CSTester class for testing of PHP applications
 */
class CSTester {
	protected	$tests_directory,
				$test_file,
				$cli,
				$port				= 8001,
				$title;
	/**
	 * @param string $tests_directory	Absolute path to tests directory
	 */
	function __construct ($tests_directory) {
		$this->tests_directory	= $tests_directory;
		$this->cli				= PHP_SAPI == 'cli';
		@ini_set('error_log', "$tests_directory/error.log");
		$this->title			= json_decode(file_get_contents("$this->tests_directory/tests.json"), true)['title'];
		/**
		 * Detect file, where tester was called
		 */
		$debug_backtrace		= debug_backtrace();
		$this->test_file		= array_pop($debug_backtrace)['file'];
		unset($debug_backtrace);
		if ($_SERVER['DOCUMENT_ROOT']) {
			$this->test_file	= str_replace(rtrim($_SERVER['DOCUMENT_ROOT'], '/').'/', '', $this->test_file);
		} else {
			$this->test_file	= explode('/', $this->test_file);
			$this->test_file	= array_pop($this->test_file);
		}
	}
	/**
	 * Set port number (for CLI mode only)
	 *
	 * @param int $port Default - 8001
	 */
	function set_port ($port) {
		if ($this->cli) {
			$this->port	= (int)$port;
		}
	}
	/**
	 * Run testing
{'fraction_non_alphanumeric': 0.17526921648718902, 'fraction_numerical': 0.008911994058670627, 'mean_word_length': 3.8107142857142855, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 35, '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': '6926390', 'n_tokens_mistral': 1082, 'n_tokens_neox': 955, 'n_words': 200}