<commit_before><?php
namespace Feeld\Field\SymfonyConsole;
use Symfony\Component\Console\Question\ConfirmationQuestion as SymfonyQuestion;
use \Feeld\Field\CommonProperties\DefaultValueInterface;

/**
 * A checked/unchecked-Question using the Symfony-Console-Component
 *
 * @author <NAME> <<EMAIL>>
 */
class SymfonyConsoleCheckbox extends \Feeld\Field\Checkbox {
    use SymfonyConsoleTrait;
    
    /**
     * RegExp to match true/checked state (default is at least first character 
     * of true/checked Option description, case-insensitive)
     * 
     * @var string
     */
    protected $trueRegExp;
    
    /**
     * Constructor
     * 
     * @param \Feeld\DataType\DataTypeInterface $dataType
     * @param array $options
     * @param mixed $id
     * @param string $trueRegExp
     * @param \Feeld\Display\DisplayInterface $display
     * @throws \Wellid\Exception\DataType
     */
    public function __construct(\Feeld\DataType\DataTypeInterface $dataType = null, array $options = array('yes' => 1, 'no' => 0), $id = null, $trueRegExp = null, \Feeld\Display\DisplayInterface $display = null) {
        parent::__construct($dataType, $options, $id, $display);
        $this->addSanitorMatchValidator();
        
        if(is_null($trueRegExp)) {
            $trueRegExp = '/^'.strtolower(substr($this->getTrueOption(),0,1)).'/i';
        } elseif(!is_string($trueRegExp)) {
            throw new \Wellid\Exception\DataType('trueRegExp', 'string', $trueRegExp);
        }
        
        $this->trueRegExp = $trueRegExp;
    }
    
    /**
     * Creates and returns a Console\Question\Question
     *
     * @return \Symfony\Component\Console\Question\Question 
     */
    protected function buildSymfonyQuestion() {
        $this->symfonyQuestion = new SymfonyQuestion((string)$this->display, ($this instanceof DefaultValueInterface && $this->hasDefault())?$this->getDefault():true, $this->trueRegExp);
        $this->setNormalizerAndValidator();
    }
}
<commit_msg>PHPDoc<commit_after><?php
namespace Feeld\Field\SymfonyConsole;
use Symfony\Component\Console\Question\ConfirmationQuestion as SymfonyQuestion;
use \Feeld\Field\CommonProperties\DefaultValueInterface;

/**
 * A checked/unchecked-Question using the Symfony-Console-Component
 *
 * @author <NAME> <<EMAIL>>
 */
class SymfonyConsoleCheckbox extends \Feeld\Field\Checkbox {
    use SymfonyConsoleTrait;
    
    /**
     * RegExp to match true/checked state (default is at least first character 
     * of true/checked Option description, case-insensitive)
     * 
     * @var string
     */
    protected $trueRegExp;
    
    /**
     * Constructor
     * 
     * @param \Feeld\DataType\DataTypeInterface $dataType
     * @param array $options
     * @param mixed $id
     * @param string $trueRegExp
     * @param \Feeld\Display\DisplayInterface $display
     * @throws \Wellid\Exception\DataType
     */
    public function __construct(\Feeld\DataType\DataTypeInterface $dataType = null, array $options = array('yes' => 1, 'no' => 0), $id = null, $trueRegExp = null, \Feeld\Display\DisplayInterface $display = null) {
        parent::__construct($dataType, $options, $id, $display);
        $this->addSanitorMatchValidator();
        
        if(is_null($trueRegExp)) {
            $trueRegExp = '/^'.strtolower(substr($this->getTrueOption(),0,1)).'/i';
        } elseif(!is_string($trueRegExp)) {
            throw new \Wellid\Exception\DataType('trueRegExp', 'string', $trueRegExp);
        }
        
        $this->trueRegExp = $trueRegExp;
    }
    
    /**
     * Creates and returns a Console\Question\ConfirmationQuestion
     */
    protected function buildSymfonyQuestion() {
        $this->symfonyQuestion = new SymfonyQuestion((string)$this->display, ($this instanceof DefaultValueInterface && $this->hasDefault())?$this->getDefault():true, $this->trueRegExp);
        $this->setNormalizerAndValidator();
    }
}

{'fraction_non_alphanumeric': 0.13282247765006386, 'fraction_numerical': 0.0020434227330779057, 'mean_word_length': 3.1351636747624076, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 31, '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': '3013159', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1141, 'n_words': 226}