<commit_before><?php
/**
 * @license https://raw.github.com/mediaslave/phrails/master/LICENSE The MIT License
 * @package html
 */
/**
 * class description
 *
 * @package html
 */
class ResultSetSelect extends Select
{
	protected $optionDisplay = 'name';
	protected $id = 'id';
	protected $optgroup = 'optgroup';
	protected $Group = null;
	/**
	 * Constructor
	 *
	 * @param string $name
	 * @param string $selectedValue
	 * @param Option $optionsTags
	 * @param string or array $options
	 * @author <NAME>
	 */
	function __construct($name, array $resultSet, $selectedValue=null, $options=null, $optionDisplay='name', $id='id', $optgroup='optgroup')
	{
		$this->Group = new HashArray();
		$this->optionDisplay = $optionDisplay;
		$this->id = $id;
		$this->optgroup = $optgroup;
		$options = $this->preparePrompt($options);
		foreach($resultSet as $record){
			$id = $this->id;
			$select = false;
			if($record->$id === $selectedValue)
				$select = true;
			$this->fillHashOrDisplay($record, $select);
		}
		$this->createOptGroup();
		parent::__construct($name, $selectedValue, null, $options);
	}

	/**
	 * Fill the Group HashArray or the display depending on if the
	 * result set has an optgroup property
	 *<commit_msg>Fixed bug when selecting the correct option.  0!==''<commit_after><?php
/**
 * @license https://raw.github.com/mediaslave/phrails/master/LICENSE The MIT License
 * @package html
 */
/**
 * class description
 *
 * @package html
 */
class ResultSetSelect extends Select
{
	protected $optionDisplay = 'name';
	protected $id = 'id';
	protected $optgroup = 'optgroup';
	protected $Group = null;
	/**
	 * Constructor
	 *
	 * @param string $name
	 * @param string $selectedValue
	 * @param Option $optionsTags
	 * @param string or array $options
	 * @author <NAME>
	 */
	function __construct($name, array $resultSet, $selectedValue=null, $options=null, $optionDisplay='name', $id='id', $optgroup='optgroup')
	{
		$this->Group = new HashArray();
		$this->optionDisplay = $optionDisplay;
		$this->id = $id;
		$this->optgroup = $optgroup;
		$options = $this->preparePrompt($options);
		foreach($resultSet as $record){
			$id = $this->id;
			$select = false;
			if((string)$record->$id === (string)$selectedValue)
				$select = true;
			$this->fillHashOrDisplay($record, $select);
		}
		$this->createOptGroup();
		parent::__construct($name, $selectedValue, null, $options);
	}

	/**
	 * Fill the Group HashArray or the display depending on if the
	 * result set has an optgroup property
	 *
{'fraction_non_alphanumeric': 0.16060727127447064, 'fraction_numerical': 0.00039952057530962844, 'mean_word_length': 4.216666666666667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, 'https://': 2, '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': '2193059', 'n_tokens_mistral': 849, 'n_tokens_neox': 784, 'n_words': 207}