<commit_before><?php
/**
 * @author <NAME> <<EMAIL>>
 * @created 2015-07-03
 */
namespace vsc\infrastructure\urls;

use vsc\infrastructure\Object;

class Url extends Object
{
	static protected $QUERY_ENCODING_TYPE = PHP_QUERY_RFC1738;
	static protected $validSchemes = ['http', 'https', 'file'];

	/**
	 * @var string
	 */
	private $scheme;
	/**
	 * @var string
	 */
	private $host;
	/**
	 * @var int
	 */
	private $port;
	/**
	 * @var string
	 */
	private $path;
	/**
	 * @var array
	 */
	private $query = [];
	/**
	 * @var string
	 */
	private $fragment;

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

	/**
	 * @param string $scheme
	 */
	public function setScheme($scheme) {
		if (static::isValidScheme($scheme)) {
			$this->scheme = $scheme;
		}
	}

	/**
	 * @param string $host
	 */
	public function setHost($host) {
		$this->host = $host;
	}

	/**
	 * @param int $port
	 */
	public function setPort($port) {
		$this->port = $port;
	}

	/**
	 * @param string $path
	 */
	public function setPath($path) {
		$this->path = $path;
	}
	/**
	 * @param [] $query
	 */
	public function setQuery($query) {
		$this->query = $query;
	}
	/**
	 * @param string $query
	 */
	public function setRawQuery($query) {
		parse_str($query, $this->query);
	}

	/**
	 * @param string $fragment
	 */
	public function setFragment($fragment) {
		$this->fragment = $fragment;
	}

	/**
	 * @return string
	 */
	public function getScheme() {
		return $this->scheme;
	}

	/**
	 * @return string
	 */
	public function getHost() {
		return $this->host;
	}

	/**
	 * @return int
	 */
	public function getPort() {
		return $this->port;
	}

	/**
	 * @return string
	 */
	public function getPath() {
		return UrlParserA::normalizePath($this->path);
	}

	/**
	 * @return array
	 */
	public function getQuery() {
		return $this->query;
	}

	/**
	 * @param bool $encoded
	 * @return string
	 */
	public function getRawQueryString($encoded = true) {
		return http_build_query($this->getQuery(), '', $encoded ? '&amp;' : '&', static::$QUERY_ENCODING_TYPE);
	}

	/**
	 * @return string
	 */
	public function getFragment() {
		return $this->fragment;
	}

	/**
	 * @param string $schema
	 * @return bool
	 */
	static public function isValidScheme($schema) {
		return in_array($schema, static::$validSchemes);
	}

	/**
	 * @return bool
	 */
	public function hasScheme() {
		return static::isValidScheme($this->scheme);
	}<commit_msg>camelCased a Url property<commit_after><?php
/**
 * @author <NAME> <<EMAIL>>
 * @created 2015-07-03
 */
namespace vsc\infrastructure\urls;

use vsc\infrastructure\Object;

class Url extends Object
{
	static protected $queryEncodingType = PHP_QUERY_RFC1738;
	static protected $validSchemes = ['http', 'https', 'file'];

	/**
	 * @var string
	 */
	private $scheme;
	/**
	 * @var string
	 */
	private $host;
	/**
	 * @var int
	 */
	private $port;
	/**
	 * @var string
	 */
	private $path;
	/**
	 * @var array
	 */
	private $query = [];
	/**
	 * @var string
	 */
	private $fragment;

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

	/**
	 * @param string $scheme
	 */
	public function setScheme($scheme) {
		if (static::isValidScheme($scheme)) {
			$this->scheme = $scheme;
		}
	}

	/**
	 * @param string $host
	 */
	public function setHost($host) {
		$this->host = $host;
	}

	/**
	 * @param int $port
	 */
	public function setPort($port) {
		$this->port = $port;
	}

	/**
	 * @param string $path
	 */
	public function setPath($path) {
		$this->path = $path;
	}
	/**
	 * @param [] $query
	 */
	public function setQuery($query) {
		$this->query = $query;
	}
	/**
	 * @param string $query
	 */
	public function setRawQuery($query) {
		parse_str($query, $this->query);
	}

	/**
	 * @param string $fragment
	 */
	public function setFragment($fragment) {
		$this->fragment = $fragment;
	}

	/**
	 * @return string
	 */
	public function getScheme() {
		return $this->scheme;
	}

	/**
	 * @return string
	 */
	public function getHost() {
		return $this->host;
	}

	/**
	 * @return int
	 */
	public function getPort() {
		return $this->port;
	}

	/**
	 * @return string
	 */
	public function getPath() {
		return UrlParserA::normalizePath($this->path);
	}

	/**
	 * @return array
	 */
	public function getQuery() {
		return $this->query;
	}

	/**
	 * @param bool $encoded
	 * @return string
	 */
	public function getRawQueryString($encoded = true) {
		return http_build_query($this->getQuery(), '', $encoded ? '&amp;' : '&', static::$queryEncodingType);
	}

	/**
	 * @return string
	 */
	public function getFragment() {
		return $this->fragment;
	}

	/**
	 * @param string $schema
	 * @return bool
	 */
	static public function isValidScheme($schema) {
		return in_array($schema, static::$validSchemes);
	}

	/**
	 * @return bool
	 */
	public function hasScheme() {
		return static::isValidScheme($this->scheme);
	}
{'fraction_non_alphanumeric': 0.18068794032324906, 'fraction_numerical': 0.004973062577704103, 'mean_word_length': 3.056302521008403, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 41, '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': '2863304', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1646, 'n_words': 373}