<commit_before><?php

namespace Encore\Admin\Form\Field;

use Encore\Admin\Facades\Admin;
use Encore\Admin\Form\Field;
use Illuminate\Contracts\Support\Arrayable;

class Select extends Field
{
    protected static $css = [
        '/packages/admin/AdminLTE/plugins/select2/select2.min.css',
    ];

    protected static $js = [
        '/packages/admin/AdminLTE/plugins/select2/select2.full.min.js',
    ];

    public function render()
    {
        if (empty($this->script)) {
            $this->script = "$(\"#{$this->id}\").select2({allowClear: true, placeholder: \"{$this->placeholder}\"});";
        }

        if (is_callable($this->options)) {
            $options = call_user_func($this->options, $this->value);
            $this->options($options);
        }

        $this->options = array_filter($this->options);

        return parent::render()->with(['options' => $this->options]);
    }

    /**
     * Set options.
     *
     * @param array|callable|string $options
     *
     * @return $this|mixed
     */
    public function options($options = [])
    {
        // remote options
        if (is_string($options)) {
            return call_user_func_array([$this, 'loadOptionsFromRemote'], func_get_args());<commit_msg>Update Select.php<commit_after><?php

namespace Encore\Admin\Form\Field;

use Encore\Admin\Facades\Admin;
use Encore\Admin\Form\Field;
use Illuminate\Contracts\Support\Arrayable;

class Select extends Field
{
    protected static $css = [
        '/packages/admin/AdminLTE/plugins/select2/select2.min.css',
    ];

    protected static $js = [
        '/packages/admin/AdminLTE/plugins/select2/select2.full.min.js',
    ];

    public function render()
    {
        if (empty($this->script)) {
            $placeholder = isset($this->placeholder) ? $this->placeholder : $this->label;
            $this->script = "$(\"#{$this->id}\").select2({allowClear: true, placeholder: \"{$placeholder}\"});";
        }

        if (is_callable($this->options)) {
            $options = call_user_func($this->options, $this->value);
            $this->options($options);
        }

        $this->options = array_filter($this->options);

        return parent::render()->with(['options' => $this->options]);
    }

    /**
     * Set options.
     *
     * @param array|callable|string $options
     *
     * @return $this|mixed
     */
    public function options($options = [])
    {
        // remote options
        if (is_string($options)) {
            return call_user_func_array([$this, 'loadOptionsFromRemote'], func_get_args());
{'fraction_non_alphanumeric': 0.1673166926677067, 'fraction_numerical': 0.0039001560062402497, 'mean_word_length': 2.5824022346368714, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6406053', 'n_tokens_mistral': 778, 'n_tokens_neox': 766, 'n_words': 124}