<commit_before><?php

require_once 'Swat/SwatObject.php';
require_once 'Site/exceptions/SiteException.php';

/**
 * Configuration section for the configuration module
 *
 * @package   Site
 * @copyright 2007 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SiteConfigSection extends SwatObject
{
	// {{{ private properties

	/**
	 * The name of this configuration section
	 *
	 * @var string
	 */
	private $name;

	/**
	 * Settings of this configuration section
	 */
	private $values = array();

	// }}}
	// {{{ public function __construct()

	/**
	 * Creates a new configuration section
	 *
	 * @param string $name the name of this configuration section.
	 * @param array $values an associative array containing values as parsed
	 *                       from an ini file.
	 */
	public function __construct($name, array $values)
	{
		$this->name = (string)$name;
		$this->values = $values;
	}

	// }}}
	// {{{ private function __set()

	/**
	 * Sets a setting of this configuration section
	 *
	 * @param string $name the name of the setting.
	 * @param mixed $value the value of the setting.
	 *
	 * @throws SiteException if the name of the setting being set does not
	 *                       exist in this section.
	 */
	private function __set($name, $value)
	{
		if (!array_key_exists($name, $this->values))
			throw new SiteException(
				sprintf("Can not set configuration setting. Setting '%s' ".
					"does not exist in the section '%s'.",
				$name, $this->name));

		$this->values[$name] = $value;
	}

	// }}}
	// {{{ private function __get()

	/**
	 * Gets a settion of this configuration section
	 *
	 * @param string $name the name of the setting.
	 *
	 * @return mixed the value of the configuration setting.
	 *
	 * @throws SiteException if the setting being set does not exist in this
	 *                       section.
	 */
	private function __get($name)
	{
		if (!array_key_exists($name, $this->values))
			throw new SiteException(
				sprintf("Can not get configuration setting. Setting '%s' ".
					"does not exist in the section '%s'.",
				$name, $this->name));

		return $this->values[$name];
	}

	// }}}
	// {{{ private function __isset()

	/**
	 * Checks for existence of a configuration setting in this section
	 *
	 * @param string $name the name of the configuration setting to check.
	 *
	 * @return boolean true if the configuration setting exists and false if it
	 *                  does not.
	 */
	private function __isset($name)
	{
		return array_key_exists($name, $this->values);
	}

	// }}}
}

?><commit_msg>Values of null are not set in the config.<commit_after><?php

require_once 'Swat/SwatObject.php';
require_once 'Site/exceptions/SiteException.php';

/**
 * Configuration section for the configuration module
 *
 * @package   Site
 * @copyright 2007 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SiteConfigSection extends SwatObject
{
	// {{{ private properties

	/**
	 * The name of this configuration section
	 *
	 * @var string
	 */
	private $name;

	/**
	 * Settings of this configuration section
	 */
	private $values = array();

	// }}}
	// {{{ public function __construct()

	/**
	 * Creates a new configuration section
	 *
	 * @param string $name the name of this configuration section.
	 * @param array $values an associative array containing values as parsed
	 *                       from an ini file.
	 */
	public function __construct($name, array $values)
	{
		$this->name = (string)$name;
		$this->values = $values;
	}

	// }}}
	// {{{ private function __set()

	/**
	 * Sets a setting of this configuration section
	 *
	 * @param string $name the name of the setting.
	 * @param mixed $value the value of the setting.
	 *
	 * @throws SiteException if the name of the setting being set does not
	 *                       exist in this section.
	 */
	private function __set($name, $value)
	{
		if (!array_key_exists($name, $this->values))
			throw new SiteException(
				sprintf("Can not set configuration setting. Setting '%s' ".
					"does not exist in the section '%s'.",
				$name, $this->name));

		$this->values[$name] = $value;
	}

	// }}}
	// {{{ private function __get()

	/**
	 * Gets a settion of this configuration section
	 *
	 * @param string $name the name of the setting.
	 *
	 * @return mixed the value of the configuration setting.
	 *
	 * @throws SiteException if the setting being set does not exist in this
	 *                       section.
	 */
	private function __get($name)
	{
		if (!array_key_exists($name, $this->values))
			throw new SiteException(
				sprintf("Can not get configuration setting. Setting '%s' ".
					"does not exist in the section '%s'.",
				$name, $this->name));

		return $this->values[$name];
	}

	// }}}
	// {{{ private function __isset()

	/**
	 * Checks for existence of a configuration setting in this section
	 *
	 * @param string $name the name of the configuration setting to check.
	 *
	 * @return boolean true if the configuration setting exists and false if it
	 *                  does not.
	 */
	private function __isset($name)
	{
		return (isset($this->values[$name]));
	}

	// }}}
}

?>
{'fraction_non_alphanumeric': 0.1254087324485478, 'fraction_numerical': 0.002308136180034622, 'mean_word_length': 2.8039502560351135, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1044006', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1456, 'n_words': 537}