<commit_before><?php

namespace Snap\Node\Form;

class Control extends \Snap\Node\Form\Row {
	static protected
		$instances = 0;
	
	protected function baseClass(){
		return 'form-control-row';
	}
	
	public function __construct( $settings = array() ){
		$name = isset($settings['name']) ? $settings['name'] : get_class($this).'_'.static::$instances++;
		
		$buttons = isset($settings['buttons']) 
			? $settings['buttons'] : array( 'Submit' => 'submit', 'Reset' => 'reset');
			
		// $settings['alignment'] = count($buttons);
		
		parent::__construct($settings);
			
		$i = 0;
		foreach( $buttons as $val => $type ){
			$this->append( new \Snap\Node\Form\Input\Button(array(
					'input' => new \Snap\Lib\Form\Input\Basic($name, $val),
					'text'  => $val,
					'type'  => $type,
			)) );
		}
	}
}<commit_msg>Allowing the control to accept an input type<commit_after><?php

namespace Snap\Node\Form;

class Control extends \Snap\Node\Form\Row {
	static protected
		$instances = 0;
	
	protected function baseClass(){
		return 'form-control-row';
	}
	
	public function __construct( $settings = array() ){
		if( !is_array($settings) ){
			$settings = array( 'input' => $settings );
		}
		
		parent::__construct( $settings );
	}
	
	protected function parseSettings( $settings = array() ){
		if ( isset($settings['input']) ){
			$input = $settings['input'];
			$name = $input->getName();
			
			foreach( $input->getOptions() as $value => $display ){
				$this->append( new \Snap\Node\Form\Input\Button(array(
					'input' => new \Snap\Lib\Form\Input\Basic($name, $value),
					'text'  => $display,
					'type'  => 'submit',
				)) );
			}
		}else{
			$name = 'formControl_'.static::$instances++;
			$this->append( new \Snap\Node\Form\Input\Button(array(
				'input' => new \Snap\Lib\Form\Input\Basic($name, 'submit'),
				'text'  => 'Reset',
				'type'  => 'submit',
			)) );
			$this->append( new \Snap\Node\Form\Input\Button(array(
				'input' => new \Snap\Lib\Form\Input\Basic($name, 'reset'),
				'text'  => 'Reset',
				'type'  => 'reset',
			)) );
			
		}
		
		parent::parseSettings($settings);
	}
}
{'fraction_non_alphanumeric': 0.20238095238095238, 'fraction_numerical': 0.0014285714285714286, 'mean_word_length': 3.423157894736842, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '5692887', 'n_tokens_mistral': 842, 'n_tokens_neox': 715, 'n_words': 143}