Code Duplication    Length = 16-18 lines in 2 locations

src/Grid/Filter/Presenter/Select.php 1 location

@@ 76-91 (lines=16) @@
73
     *
74
     * @return $this
75
     */
76
    protected function loadRemoteOptions($url, $parameters = [], $options = [])
77
    {
78
        $ajaxOptions = [
79
            'url' => $url.'?'.http_build_query($parameters),
80
        ];
81
82
        $ajaxOptions = json_encode(array_merge($ajaxOptions, $options));
83
84
        $this->script = <<<EOT
85
86
$.ajax($ajaxOptions).done(function(data) {
87
  $(".{$this->getElementClass()}").select2({data: data});
88
});
89
90
EOT;
91
    }
92
93
    /**
94
     * Load options from ajax.

src/Form/Field/Select.php 1 location

@@ 194-211 (lines=18) @@
191
     *
192
     * @return $this
193
     */
194
    protected function loadRemoteOptions($url, $parameters = [], $options = [])
195
    {
196
        $ajaxOptions = [
197
            'url' => $url.'?'.http_build_query($parameters),
198
        ];
199
200
        $ajaxOptions = json_encode(array_merge($ajaxOptions, $options));
201
202
        $this->script = <<<EOT
203
204
$.ajax($ajaxOptions).done(function(data) {
205
  $("{$this->getElementClassSelector()}").select2({data: data});
206
});
207
208
EOT;
209
210
        return $this;
211
    }
212
213
    /**
214
     * Load options from ajax results.