<commit_before><?php
class Kwc_Newsletter_Detail_MailingFormController extends Kwf_Controller_Action_Auto_Form
{
    protected $_model = 'Kwc_Newsletter_Model';
    protected $_permissions = array('save');

    protected function _initFields()
    {
        parent::_initFields();
        $form = $this->_form;
        $form->setLabelWidth(120);

        $combobox = new Kwf_Form_Field_Radio('status', trlKwf('Start newsletter'));
        $combobox->setAllowBlank(false);
        $combobox->setWidth(150);
        $cards = $form->add(new Kwf_Form_Container_Cards());
        $cards->setCombobox($combobox);

        $card = $cards->add();
        $card->setTitle(trlKwf('Now'));
        $card->setName('start');

        $card = $cards->add();
        $card->setTitle(trlKwf('Later'));
        $card->setName('startLater');
        $card->add(new Kwf_Form_Field_DateTimeField('start_date', trlKwf('Date')));

        $form->add(new Kwf_Form_Field_Select('mails_per_minute', trlKwf('Sending speed')))
            ->setValues(array(
                'slow' => trlKwf('Slow'),
                'normal' => trlKwf('Normal'),
                'fast' => trlKwf('Fast')
            ));
    }

    protected function _beforeSave(Kwf_Model_Row_Interface $row)
    {
        parent::_beforeSave($row);
        if ($row->status == 'start') $row->start_date = null;
    }
}<commit_msg>optimized code in Kwc/Newsletter/Detail/MailingFormController.php<commit_after><?php
class Kwc_Newsletter_Detail_MailingFormController extends Kwf_Controller_Action_Auto_Form
{
    protected $_model = 'Kwc_Newsletter_Model';
    protected $_permissions = array('save');

    protected function _initFields()
    {
        parent::_initFields();
        $form = $this->_form;
        $form->setLabelWidth(120);

        $cards = $form->add(new Kwf_Form_Container_Cards());
        $cards->setCombobox(new Kwf_Form_Field_Radio('status', trlKwf('Start newsletter')));
        $cards->getCombobox()
            ->setAllowBlank(false)
            ->setWidth(150);

        $card = $cards->add();
        $card->setTitle(trlKwf('Now'));
        $card->setName('start');

        $card = $cards->add();
        $card->setTitle(trlKwf('Later'));
        $card->setName('startLater');
        $card->fields->add(new Kwf_Form_Field_DateTimeField('start_date', trlKwf('Date')));

        $form->add(new Kwf_Form_Field_Select('mails_per_minute', trlKwf('Sending speed')))
            ->setValues(array(
                'slow' => trlKwf('Slow'),
                'normal' => trlKwf('Normal'),
                'fast' => trlKwf('Fast')
            ));
    }

    protected function _beforeSave(Kwf_Model_Row_Interface $row)
    {
        parent::_beforeSave($row);
        if ($row->status == 'start') $row->start_date = null;
    }
}
{'fraction_non_alphanumeric': 0.15925394548063126, 'fraction_numerical': 0.00430416068866571, 'mean_word_length': 2.8952513966480447, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '3099081', 'n_tokens_mistral': 938, 'n_tokens_neox': 869, 'n_words': 124}