<commit_before><?php

namespace TwbBundle\Form\View\Helper;

class TwbBundleFormElement extends \Zend\Form\View\Helper\FormElement implements \Zend\I18n\Translator\TranslatorAwareInterface {

    /**
     * @var string
     */
    protected static $addonFormat = '<%s class="%s">%s</%s>';

    /**
     * @var string
     */
    protected static $inputGroupFormat = '<div class="input-group %s">%s</div>';

    /**
     * Translator (optional)
     * @var \Zend\I18n\Translator\Translator
     */
    protected $translator;

    /**
     * Translator text domain (optional)
     * @var string
     */
    protected $translatorTextDomain = 'default';

    /**
     * Whether translator should be used
     * @var boolean
     */
    protected $translatorEnabled = true;

    /**
     * Instance map to view helper
     *
     * @var array
     */
    protected $classMap = array(
        'Zend\Form\Element\Button' => 'formbutton',
        'Zend\Form\Element\Captcha' => 'formcaptcha',
        'Zend\Form\Element\Csrf' => 'formhidden',
        'Zend\Form\Element\Collection' => 'formcollection',
        'Zend\Form\Element\DateTimeSelect' => 'formdatetimeselect',
        'Zend\Form\Element\DateSelect' => 'formdateselect',
        'Zend\Form\Element\MonthSelect' => 'formmonthselect',
        'TwbBundle\Form\Element\StaticElement' => 'formStatic',
    );

    /**
     * Render an element
     * @param \Zend\Form\ElementInterface $oElement
     * @return string
     */
    public function render(\Zend\Form\ElementInterface $oElement) {
        //Add form-controll class
        $sElementType = $oElement->getAttribute('type');

        if (!in_array($sElementType, array('file', 'checkbox', 'radio', 'submit', 'multi_checkbox', 'static', 'button', 'reset'))) {
            if ($sElementClass = $oElement->getAttribute('class')) {
                if (!preg_match('/(\s|^)form-control(\s|$)/', $sElementClass)) {
                    $oElement->setAttribute('class', trim($sElementClass . ' form-control'));
                }<commit_msg>Fix issue with Collection rendering<commit_after><?php

namespace TwbBundle\Form\View\Helper;

class TwbBundleFormElement extends \Zend\Form\View\Helper\FormElement implements \Zend\I18n\Translator\TranslatorAwareInterface {

    /**
     * @var string
     */
    protected static $addonFormat = '<%s class="%s">%s</%s>';

    /**
     * @var string
     */
    protected static $inputGroupFormat = '<div class="input-group %s">%s</div>';

    /**
     * Translator (optional)
     * @var \Zend\I18n\Translator\Translator
     */
    protected $translator;

    /**
     * Translator text domain (optional)
     * @var string
     */
    protected $translatorTextDomain = 'default';

    /**
     * Whether translator should be used
     * @var boolean
     */
    protected $translatorEnabled = true;

    /**
     * Instance map to view helper
     *
     * @var array
     */
    protected $classMap = array(
        'Zend\Form\Element\Button' => 'formbutton',
        'Zend\Form\Element\Captcha' => 'formcaptcha',
        'Zend\Form\Element\Csrf' => 'formhidden',
        'Zend\Form\Element\Collection' => 'formcollection',
        'Zend\Form\Element\DateTimeSelect' => 'formdatetimeselect',
        'Zend\Form\Element\DateSelect' => 'formdateselect',
        'Zend\Form\Element\MonthSelect' => 'formmonthselect',
        'TwbBundle\Form\Element\StaticElement' => 'formStatic',
    );

    /**
     * Render an element
     * @param \Zend\Form\ElementInterface $oElement
     * @return string
     */
    public function render(\Zend\Form\ElementInterface $oElement) {
        //Add form-controll class
        $sElementType = $oElement->getAttribute('type');

        if (
            !in_array($sElementType, array('file', 'checkbox', 'radio', 'submit', 'multi_checkbox', 'static', 'button', 'reset'))
            && !($oElement instanceof \Zend\Form\Element\Collection)
        ) {
            if ($sElementClass = $oElement->getAttribute('class')) {
                if (!preg_match('/(\s|^)form-control(\s|$)/', $sElementClass)) {
                    $oElement->setAttribute('class', trim($sElementClass . ' form-control'));
                }
{'fraction_non_alphanumeric': 0.15564573883981858, 'fraction_numerical': 0.0019097636667462401, 'mean_word_length': 2.559898045879354, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 33, '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': '5213557', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1250, 'n_words': 229}