<commit_before><?php
class InvalidParameterException extends Exception
{
}

abstract class Parameters
{
	protected $aData = null;
	
	public function __construct()
	{
		$this->aData = null;
	}

	public function Get($sCode, $default = '')
	{
		if (array_key_exists($sCode, $this->aData))
		{
			return $this->aData[$sCode];
		}
		return $default;
	}

	public function ToXML(DOMNode $oRoot, $data = null, $sNodeName = null)
	{
		if ($data === null)
		{
			$data = $this->aData;
		}
				
		if (is_array($data))
		{
			if ($oRoot instanceof DOMDocument)
			{
				$oNode = $oRoot->createElement($sNodeName);
			}
			else
			{
				$oNode = $oRoot->ownerDocument->createElement($sNodeName);
			}
			$oRoot->appendChild($oNode);

			$aKeys = array_keys($data);
			$bNumericKeys = true;
			foreach($aKeys as $idx => $subkey)
			{
				if(((int)$subkey) !== $subkey)
				{
					$bNumericKeys = false;
					break;
				}
			}
			if ($bNumericKeys)
			{
				$oNode->setAttribute("type", "array");
				foreach($data as $key => $value)
				{
					$this->ToXML($oNode, $value , 'item');
				}
			}
			else
			{
				foreach($data as $key => $value)
				{
					$this->ToXML($oNode, $value , $key);
				}
			}
		}
		else
		{
			$oNode = $oRoot->ownerDocument->createElement($sNodeName, $data);
			$oRoot->appendChild($oNode);
		}
		return $oNode;
	}
}

class PHPParameters extends Parameters
{
	public function LoadFromHash($aData)
	{
		$this->aData = $aData;
	}
	
	public function LoadFromFile($sParametersFile)
	{
		if ($this->aData == null)
		{
			require_once($sParametersFile);
			$this->aData = $ITOP_PARAMS;
		}
	}<commit_msg>#851 Ampersand (aka '&') not welcomed in the setup wizard<commit_after><?php
class InvalidParameterException extends Exception
{
}

abstract class Parameters
{
	protected $aData = null;
	
	public function __construct()
	{
		$this->aData = null;
	}

	public function Get($sCode, $default = '')
	{
		if (array_key_exists($sCode, $this->aData))
		{
			return $this->aData[$sCode];
		}
		return $default;
	}

	public function ToXML(DOMNode $oRoot, $data = null, $sNodeName = null)
	{
		if ($data === null)
		{
			$data = $this->aData;
		}
				
		if (is_array($data))
		{
			if ($oRoot instanceof DOMDocument)
			{
				$oNode = $oRoot->createElement($sNodeName);
			}
			else
			{
				$oNode = $oRoot->ownerDocument->createElement($sNodeName);
			}
			$oRoot->appendChild($oNode);

			$aKeys = array_keys($data);
			$bNumericKeys = true;
			foreach($aKeys as $idx => $subkey)
			{
				if(((int)$subkey) !== $subkey)
				{
					$bNumericKeys = false;
					break;
				}
			}
			if ($bNumericKeys)
			{
				$oNode->setAttribute("type", "array");
				foreach($data as $key => $value)
				{
					$this->ToXML($oNode, $value , 'item');
				}
			}
			else
			{
				foreach($data as $key => $value)
				{
					$this->ToXML($oNode, $value , $key);
				}
			}
		}
		else
		{
			$oNode = $oRoot->ownerDocument->createElement($sNodeName);
			$oRoot->appendChild($oNode);
			$oTextNode = $oRoot->ownerDocument->createTextNode($data);
			$oNode->appendChild($oTextNode);
		}
		return $oNode;
	}
}

class PHPParameters extends Parameters
{
	public function LoadFromHash($aData)
	{
		$this->aData = $aData;
	}
	
	public function LoadFromFile($sParametersFile)
	{
		if ($this->aData == null)
		{
			require_once($sParametersFile);
			$this->aData = $ITOP_PARAMS;
		}
	}
{'fraction_non_alphanumeric': 0.16790711521286097, 'fraction_numerical': 0.0008931229532598987, 'mean_word_length': 3.1176470588235294, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 46, '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': '3603610', 'n_tokens_mistral': 1507, 'n_tokens_neox': 1242, 'n_words': 228}