<commit_before><?php

namespace Kregel\FormModel\Frameworks;

class Materialize extends Plain
{
    /**
     * Generate the form.
     *
     * @param array $options
     *
     * @return string
     */
    public function form(array $options = [])
    {
        $method = empty($options['method']) ? $options['method'] : '';
        if (in_array(strtolower($method), ['get', 'post'])) {
            $real_method = $method;
        } else {
            $real_method = 'POST';
        }
        $options['method'] = $real_method;
        $options['action'] = $this->location;

        return '<form '.$this->attributes($options).'>'.// Pass the method through so the form knows how to handle it's self (with laravel)
        $this->method($method).// Check and fill the csrf token if it's configured for it.
        $this->csrf().$this->buildForm().$this->submit(['class' => 'btn waves-effect waves-light']).'</form>';
    }

    /**
     * Generate a submit button for the form.
     *
     * @param array $options
     *
     * @return string
     */
    public function submit(array $options = [])
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '<div class="input-field">
                '.(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$this->genId($label).'">'.$label.'</label>').parent::plainSubmit(array_merge([
            'class' => 'btn waves-effect waves-light pull-right',
        ], $options)).'</div>
        </div>';
    }

    /**
     * Generate a select.
     *
     * @param array $configs
     * @param mixed $options
     *
     * @return string
     */
    public function select(array $configs, $options)
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '
        <div class="input-field">
        '.parent::plainSelect(array_merge([
            'id' => $this->genId($label),
        ], $configs), $options).(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$label.'">'.$this->inputToRead($label).'</label>').'
        </div>
         ';
    }

    /**
     * Generate a textarea.
     *
     * @param array  $options
     * @param string $text
     *
     * @return string
     */
    public function textarea(array $options, $text = '')
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '
            <div class="input-field">
                '.parent::plainTextarea(array_merge([
            'class' => 'materialize-textarea',
            'id'    => $this->genId($label),
        ], $options), $text).'
                '.(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$this->genId($label).'">'.$this->inputToRead($label).'</label>').'
            </div>';
    }

    /**
     * Generate an input area.
     *
     * @param array $options
     *
     * @return string
     */
    public function input(array $options)
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '
        <div class="input-field">
                '.parent::plainInput(array_merge([
            'class' => 'validate',
            'id'    => $this->genId($label),
            'value' => $this->model->$label() instanceof \Illuminate\Database\Eloquent\Relations\Relation ? $this->model->$label : ''
        ], $options)).(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$this->genId($label).'">'.$this->inputToRead($label).'</label>').'
        </div>
        ';
    }
}<commit_msg>Add Materialize value -fix<commit_after><?php

namespace Kregel\FormModel\Frameworks;

class Materialize extends Plain
{
    /**
     * Generate the form.
     *
     * @param array $options
     *
     * @return string
     */
    public function form(array $options = [])
    {
        $method = empty($options['method']) ? $options['method'] : '';
        if (in_array(strtolower($method), ['get', 'post'])) {
            $real_method = $method;
        } else {
            $real_method = 'POST';
        }
        $options['method'] = $real_method;
        $options['action'] = $this->location;

        return '<form '.$this->attributes($options).'>'.// Pass the method through so the form knows how to handle it's self (with laravel)
        $this->method($method).// Check and fill the csrf token if it's configured for it.
        $this->csrf().$this->buildForm().$this->submit(['class' => 'btn waves-effect waves-light']).'</form>';
    }

    /**
     * Generate a submit button for the form.
     *
     * @param array $options
     *
     * @return string
     */
    public function submit(array $options = [])
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '<div class="input-field">
                '.(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$this->genId($label).'">'.$label.'</label>').parent::plainSubmit(array_merge([
            'class' => 'btn waves-effect waves-light pull-right',
        ], $options)).'</div>
        </div>';
    }

    /**
     * Generate a select.
     *
     * @param array $configs
     * @param mixed $options
     *
     * @return string
     */
    public function select(array $configs, $options)
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '
        <div class="input-field">
        '.parent::plainSelect(array_merge([
            'id' => $this->genId($label),
        ], $configs), $options).(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$label.'">'.$this->inputToRead($label).'</label>').'
        </div>
         ';
    }

    /**
     * Generate a textarea.
     *
     * @param array  $options
     * @param string $text
     *
     * @return string
     */
    public function textarea(array $options, $text = '')
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '
            <div class="input-field">
                '.parent::plainTextarea(array_merge([
            'class' => 'materialize-textarea',
            'id'    => $this->genId($label),
        ], $options), $text).'
                '.(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$this->genId($label).'">'.$this->inputToRead($label).'</label>').'
            </div>';
    }

    /**
     * Generate an input area.
     *
     * @param array $options
     *
     * @return string
     */
    public function input(array $options)
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '
        <div class="input-field">
                '.parent::plainInput(array_merge([
            'class' => 'validate',
            'id'    => $this->genId($label),
            'value' => $this->model->$label() instanceof \Illuminate\Database\Eloquent\Relations\Relation ? '' : $this->model->$label
        ], $options)).(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$this->genId($label).'">'.$this->inputToRead($label).'</label>').'
        </div>
        ';
    }
}
{'fraction_non_alphanumeric': 0.20572450805008943, 'fraction_numerical': 0.0022017338654190177, 'mean_word_length': 2.0524989500209996, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 95, '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': '513776', 'n_tokens_mistral': 2222, 'n_tokens_neox': 2180, 'n_words': 421}