<commit_before><?php
/**
 * Vision PHP-Framework
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2012-2013 <NAME>
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */ 
namespace Vision\Form\Control;

use Vision\Html\Element as HtmlElement;
use Vision\Html\ElementFactory;
use Vision\Form\Decorator;
use Vision\Validator;

/**
 * Checkbox
 *
 * @author <NAME> <<EMAIL>>
 */ 
class Checkbox extends MultiOptionControlAbstract 
{
    /** @type string $input */
    protected $tag = 'input';
    
    /** @type array $attributes */
    protected $attributes = array('type' => 'checkbox');
    
    /** @type bool $isVoid */
    protected $isVoid = true; 
    
    /**
     * @return void
     */
    public function init() 
    {
        $label = new Decorator\Label;
        $label->setPlacement('APPEND');
        $label->getDecorator()->addClass('label-checkbox');
        
        $li = new Decorator\Li;
        
        $this->addDecorator($label)
             ->addDecorator($li);
        $this->setRequired(false);
    }
    
    /**
     * @return string
     */
    public function __toString() 
    {   
        $content = '';
        
        foreach ($this->options as $option => $label) {
            $this->removeAttribute('checked');
            $this->setLabel($label);
            $this->setAttribute('value', $option);            
            
            if ($this->checkForPreSelection($option)) {
                $this->setAttribute('checked', 'checked');
            }         

            $content .= parent::__toString();
        }
        
        return $content;
    }
    
    /**
     * @return array
     */
    public function getValidators()
    {
        $options = $this->getOptions();
        $count = count($options);
        
        if ($count > 1) {
            $this->addValidator(new Validator\InArray(array('haystack' => $options)));
        }
        
        return $this->validators;
    }
}<commit_msg>Proper var naming<commit_after><?php
/**
 * Vision PHP-Framework
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2012-2013 <NAME>
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */ 
namespace Vision\Form\Control;

use Vision\Html\Element as HtmlElement;
use Vision\Html\ElementFactory;
use Vision\Form\Decorator;
use Vision\Validator;

/**
 * Checkbox
 *
 * @author <NAME> <<EMAIL>>
 */ 
class Checkbox extends MultiOptionControlAbstract 
{
    /** @type string $input */
    protected $tag = 'input';
    
    /** @type array $attributes */
    protected $attributes = array('type' => 'checkbox');
    
    /** @type bool $isVoid */
    protected $isVoid = true; 
    
    /**
     * @return void
     */
    public function init() 
    {
        $label = new Decorator\Label;
        $label->setPlacement('APPEND');
        $label->getDecorator()->addClass('label-checkbox');
        
        $li = new Decorator\Li;
        
        $this->addDecorator($label)
             ->addDecorator($li);
        $this->setRequired(false);
    }
    
    /**
     * @return string
     */
    public function __toString() 
    {   
        $html = '';
        
        foreach ($this->options as $option => $label) {
            $this->removeAttribute('checked');
            $this->setLabel($label);
            $this->setAttribute('value', $option);            
            
            if ($this->checkForPreSelection($option)) {
                $this->setAttribute('checked', 'checked');
            }         

            $html .= parent::__toString();
        }
        
        return $html;
    }
    
    /**
     * @return array
     */
    public function getValidators()
    {
        $options = $this->getOptions();
        $count = count($options);
        
        if ($count > 1) {
            $this->addValidator(new Validator\InArray(array('haystack' => $options)));
        }
        
        return $this->validators;
    }
}
{'fraction_non_alphanumeric': 0.15317845289762574, 'fraction_numerical': 0.004595353586928772, 'mean_word_length': 1.8494545454545455, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 55, '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': '2121160', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1130, 'n_words': 216}