<commit_before>
/*
 +------------------------------------------------------------------------+
 | Phalcon Framework                                                      |
 +------------------------------------------------------------------------+
 | Copyright (c) 2011-2015 Phalcon Team (http://www.phalconphp.com)       |
 +------------------------------------------------------------------------+
 | This source file is subject to the New BSD License that is bundled     |
 | with this package in the file docs/LICENSE.txt.                        |
 |                                                                        |
 | If you did not receive a copy of the license and are unable to         |
 | obtain it through the world-wide-web, please send an email             |
 | to <EMAIL> so we can send you a copy immediately.       |
 +------------------------------------------------------------------------+
 | Authors: <NAME> <<EMAIL>>                      |
 |          <NAME> <<EMAIL>>                         |
 +------------------------------------------------------------------------+
 */

namespace Phalcon\Forms\Element;

use Phalcon\Forms\Element;
use Phalcon\Forms\ElementInterface;

/**
 * Phalcon\Forms\Element\Select
 *
 * Component SELECT (choice) for forms
 */
class Select extends Element implements ElementInterface {

	protected _optionsValues;

	/**
	 * Phalcon\Forms\Element constructor
	 *
	 * @param string name
	 * @param object|array options
	 * @param array attributes
	 */
	public function __construct(string name, options = null, attributes = null)
	{
		let this->_optionsValues = options;
		parent::__construct(name, attributes);
	}

	/**
	 * Set the choice's options
	 *
	 * @param array|object options
	 * @return \Phalcon\Forms\Element
	 */
	public function setOptions(var options) -> <Element>
	{
		let this->_optionsValues = options;
		return this;
	}

	/**
	 * Returns the choices' options
	 *
	 * @return array|object
	 */
	public function getOptions()
	{
		return this->_optionsValues;
	}

	/**
	 * Adds an option to the current options
	 *
	 * @param array option
	 * @return this
	 */
	public function addOption(var option) -> <Element>
	{
		var key, value;
		for key, value in options {
			let this->_optionsValues[key] = value;
		}
		return this;
	}

	/**
	 * Renders the element widget returning html
	 *
	 * @param array attributes
	 * @return string
	 */
	public function render(attributes = null) -> string
	{
		/**
		 * Merged passed attributes with previously defined ones
		 */
		return \Phalcon\Tag\Select::selectField(this->prepareAttributes(attributes), this->_optionsValues);
	}
}<commit_msg>fix parameter typo in the for loop<commit_after>
/*
 +------------------------------------------------------------------------+
 | Phalcon Framework                                                      |
 +------------------------------------------------------------------------+
 | Copyright (c) 2011-2015 Phalcon Team (http://www.phalconphp.com)       |
 +------------------------------------------------------------------------+
 | This source file is subject to the New BSD License that is bundled     |
 | with this package in the file docs/LICENSE.txt.                        |
 |                                                                        |
 | If you did not receive a copy of the license and are unable to         |
 | obtain it through the world-wide-web, please send an email             |
 | to <EMAIL> so we can send you a copy immediately.       |
 +------------------------------------------------------------------------+
 | Authors: <NAME> <<EMAIL>>                      |
 |          <NAME> <<EMAIL>>                         |
 +------------------------------------------------------------------------+
 */

namespace Phalcon\Forms\Element;

use Phalcon\Forms\Element;
use Phalcon\Forms\ElementInterface;

/**
 * Phalcon\Forms\Element\Select
 *
 * Component SELECT (choice) for forms
 */
class Select extends Element implements ElementInterface {

	protected _optionsValues;

	/**
	 * Phalcon\Forms\Element constructor
	 *
	 * @param string name
	 * @param object|array options
	 * @param array attributes
	 */
	public function __construct(string name, options = null, attributes = null)
	{
		let this->_optionsValues = options;
		parent::__construct(name, attributes);
	}

	/**
	 * Set the choice's options
	 *
	 * @param array|object options
	 * @return \Phalcon\Forms\Element
	 */
	public function setOptions(var options) -> <Element>
	{
		let this->_optionsValues = options;
		return this;
	}

	/**
	 * Returns the choices' options
	 *
	 * @return array|object
	 */
	public function getOptions()
	{
		return this->_optionsValues;
	}

	/**
	 * Adds an option to the current options
	 *
	 * @param array option
	 * @return this
	 */
	public function addOption(var option) -> <Element>
	{
		var key, value;
		for key, value in option {
			let this->_optionsValues[key] = value;
		}
		return this;
	}

	/**
	 * Renders the element widget returning html
	 *
	 * @param array attributes
	 * @return string
	 */
	public function render(attributes = null) -> string
	{
		/**
		 * Merged passed attributes with previously defined ones
		 */
		return \Phalcon\Tag\Select::selectField(this->prepareAttributes(attributes), this->_optionsValues);
	}
}
{'fraction_non_alphanumeric': 0.22735813603908306, 'fraction_numerical': 0.003006388575723412, 'mean_word_length': 1.4908750584932149, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7127978', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1254, 'n_words': 400}