<commit_before><?php
/**
 * LoadTimer Class
 * A simple PHP load time measuring class.
 *
 * Version 1.0.0
 *
 * Copyright (c) 2012 - <NAME> <<EMAIL>>
 */
class LoadTimer
{
	/**
	 * @var The start time for the page load
	 */
	public $start = 0;
	/**
	 * @var The end time for the page load
	 */
	public $end = 0;
	/**
	 * @var The difference between the end and start time, aka the load time
	 */
	public $load_time = 0;

	/**
	 * Start the page load timer
	 */
	function __construct()
	{
		$this->start = $this->currentTime();
	}

	/**
	 * Get the current time
	 *
	 * @return int Current time
	 */
	function currentTime()
	{
		return $this->add(explode(' ', microtime()));
	}

	/**
	 * Finish up the load time script
	 *
	 * @param bool $echo Whether to echo the string or not
	 * @param string $string String formatted for sprintf()
	 * @return int|null If $echo is false, returns the integer value of the load time
	 */
	function end($echo = true, $string = 'Page load took %f seconds')
	{
		$this->end = $this->currentTime();
		$this->load_time = $this->end - $this->start;

		if($echo) 
			echo sprintf($string, $this->load_time);
		else
			return $this->load_time;
	}

	/**
	 * Adds together integer values in an array
	 *
	 * @param array $vals Array of integer values to add together
	 * @return int Total of array values added together
	 */
	function add($vals = array())
	{
		$total = 0;
		for($i = 0; $i < count($vals); $i++)
		{
			$total += $vals[$i];
		}
		return $total;
	}
}<commit_msg>Use microtime(true) instead of explode, some other stuff...<commit_after><?php
/**
 * LoadTimer Class
 * A simple PHP load time measuring class.
 *
 * Version 1.0.0
 *
 * Copyright (c) 2012 - <NAME> <<EMAIL>>
 */
class LoadTimer
{
	/**
	 * @var The start time for the page load
	 */
	private $start;
	/**
	 * @var The end time for the page load
	 */
	private $end;
	/**
	 * @var The difference between the end and start time, aka the load time
	 */
	private $load_time;

	/**
	 * Start the page load timer
	 */
	function __construct($autoStart = false)
	{
		if($autoStart)
			$this->start();
	}

	/**
	 * Start the timer
	 *
	 * @return null
	 */
	function start()
	{
		$this->start = $this->currentTime();
	}

	/**
	 * Get the current time
	 *
	 * @return int Current time
	 */
	public function currentTime()
	{
		return microtime(true);
	}

	/**
	 * Finish up the load time script
	 *
	 * @param bool $echo Whether to echo the string or not
	 * @param string $string String formatted for sprintf()
	 * @return int|null If $echo is false, returns the integer value of the load time
	 */
	function end($echo = false, $string = 'Page load took %f seconds')
	{
		$this->end = $this->currentTime();
		$this->load_time = $this->end - $this->start;

		if($echo) 
			echo sprintf($string, $this->load_time);
		
		return $this->load_time;
	}
}
{'fraction_non_alphanumeric': 0.147234941880944, 'fraction_numerical': 0.006692497358224727, 'mean_word_length': 2.9172413793103447, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 29, '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': '6458266', 'n_tokens_mistral': 1019, 'n_tokens_neox': 918, 'n_words': 326}