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

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