<commit_before><?php
class HttpError extends Exception {
	public function __construct(
	$message, $code = 0, Exception $previous = null) {
		$this->sendHeaders($message, $code);
		$this->displayError($code);
		exit;
	}

	private function sendHeaders($message, $code) {
		header($_SERVER["SERVER_PROTOCOL"] . " " . $code . " " . $message);
	}

	private function displayError($code) {
		$fileName = $code . ".html";
		$pathArray = array(
			APPROOT . DS . "PageView" . DS . DIR . DS,
			APPROOT . DS . "PageView" . DS,
			GTROOT . DS . "Framework" . DS . "Error" . DS 
		);

		foreach ($pathArray as $path) {
			if(is_dir($path)) {
				if(file_exists($path . $fileName)) {
					ob_clean();
					require $path . $fileName;
					break;
				}
			}
		}
	}
}
?><commit_msg>HTTP Errors can be called by only passing their error code.<commit_after><?php
class HttpError extends Exception {
	private $_errorCodeMessage = array(
		301 => "Moved Permanently",
		400 => "Bad Request",
		401 => "Unauthorized",
		403 => "Forbidden",
		404 => "Not Found",
		408 => "Request Timeout",
		410 => "Gone",
		429 => "Too Many Requests",
		500 => "Internal Server Error",
		501 => "Not Implemented",
		503 => "Service Unavailable"
	);

	public function __construct(
	$code, Exception $previous = null, $message = null) {
		if(is_null($message)) {
			if(array_key_exists($code, $this->_errorCodeMessage)) {
				$message = $this->_errorCodeMessage[$code];
			}
			else {
				$code = 500;
				$message = $this->_errorCodeMessage[$code];
			}
		}

		$this->sendHeaders($code, $message);
		$this->displayError($code);
		exit;
	}

	private function sendHeaders($code, $message) {
		header($_SERVER["SERVER_PROTOCOL"] . " " . $code . " " . $message);
	}

	private function displayError($code) {
		$fileName = $code . ".html";
		$pathArray = array(
			APPROOT . DS . "PageView" . DS . DIR . DS,
			APPROOT . DS . "PageView" . DS,
			GTROOT . DS . "Framework" . DS . "Error" . DS 
		);

		foreach ($pathArray as $path) {
			if(is_dir($path)) {
				if(file_exists($path . $fileName)) {
					ob_clean();
					require $path . $fileName;
					break;
				}
			}
		}
	}
}
?>
{'fraction_non_alphanumeric': 0.17173607861488066, 'fraction_numerical': 0.01731399157697707, 'mean_word_length': 3.0801526717557253, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '1657522', 'n_tokens_mistral': 873, 'n_tokens_neox': 747, 'n_words': 177}