<commit_before><?php
class vscUrlParserA extends vscObject implements vscUrlParserI {
	private $sUrl;
	private $aComponents;
	private $bUrlHasNoScheme = false;

	public function __construct ($sUrl = null) {
		if (is_null($sUrl)) {
			$sUrl = 'http' . (vscHttpRequestA::isSecure() ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
		}
		$this->setUrl($sUrl);
	}

	public function __toString() {
		return $this->getCompleteUri(true);
	}

	public function hasScheme () {
		return !$this->bUrlHasNoScheme;
	}

	/**
	 * This exists as the php::parse_url function sometimes breaks inexplicably
	 * @param string $sUrl
	 * @return multitype:string multitype:
	 */
	static public function parse_url ($sUrl = null) {
		if (is_null($sUrl) && is_array($_SERVER) && array_key_exists('REQUEST_URI', $_SERVER)) {
			$sUrl = $_SERVER['REQUEST_URI'];
		}

		$bIsSecure	= false;
		$sHost		= '';
		$sUser		= '';
		$sPass		= '';
		$sFragment	= '';
		$aReturn	= array(
			'scheme'	=> '',
			'host'		=> '',
			'user'		=> '',
			'pass'		=> '',
			'path'		=> '',
			'query'		=> array(),
			'fragment'	=> ''
		);

		try {
			if ( is_file ($sUrl) ) {
				$aReturn['scheme'] = 'file';
				$aReturn['path'] = $sUrl;
				return $aReturn;
			}
		} catch (ErrorException $e) {
			// possible open basedir restriction
			echo ($e->getMessage());<commit_msg>A better fallback for basedir restriction errors<commit_after><?php
class vscUrlParserA extends vscObject implements vscUrlParserI {
	private $sUrl;
	private $aComponents;
	private $bUrlHasNoScheme = false;

	public function __construct ($sUrl = null) {
		if (is_null($sUrl)) {
			$sUrl = 'http' . (vscHttpRequestA::isSecure() ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
		}
		$this->setUrl($sUrl);
	}

	public function __toString() {
		return $this->getCompleteUri(true);
	}

	public function hasScheme () {
		return !$this->bUrlHasNoScheme;
	}

	/**
	 * This exists as the php::parse_url function sometimes breaks inexplicably
	 * @param string $sUrl
	 * @return multitype:string multitype:
	 */
	static public function parse_url ($sUrl = null) {
		if (is_null($sUrl) && is_array($_SERVER) && array_key_exists('REQUEST_URI', $_SERVER)) {
			$sUrl = $_SERVER['REQUEST_URI'];
		}

		$bIsSecure	= false;
		$sHost		= '';
		$sUser		= '';
		$sPass		= '';
		$sFragment	= '';
		$aReturn	= array(
			'scheme'	=> '',
			'host'		=> '',
			'user'		=> '',
			'pass'		=> '',
			'path'		=> '',
			'query'		=> array(),
			'fragment'	=> ''
		);

		try {
			if ( is_file ($sUrl) && is_readable($sUrl) ) {
				$aReturn['scheme'] = 'file';
				$aReturn['path'] = $sUrl;
				return $aReturn;
			}
		} catch (ErrorException $e) {
			// possible open basedir restriction
			$aReturn['path'] = $sUrl;
{'fraction_non_alphanumeric': 0.18640988372093023, 'fraction_numerical': 0.0, 'mean_word_length': 3.5655058043117744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '2227951', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1016, 'n_words': 208}