Code Duplication    Length = 15-15 lines in 2 locations

src/widgets/AjaxModal.php 2 locations

@@ 152-166 (lines=15) @@
149
        $quotedHtml = Json::htmlEncode($this->loadingHtml);
150
        if (!isset($this->clientEvents['show.bs.modal'])) {
151
            if ($this->bulkPage) {
152
                if ($this->usePost) {
153
                    $this->clientEvents['show.bs.modal'] = new JsExpression("function() {
154
                        var selection = jQuery('div[role=\"grid\"]').yiiGridView('getSelectedRows');
155
                        $.post('{$this->actionUrl}', {selection: selection}).done(function (data) {
156
                            $('#{$this->id} .modal-body').html(data);
157
                        });
158
                    }");
159
                } else {
160
                    $this->clientEvents['show.bs.modal'] = new JsExpression("function() {
161
                        var selection = jQuery('div[role=\"grid\"]').yiiGridView('getSelectedRows');
162
                        $.get('{$this->actionUrl}', {selection: selection}).done(function (data) {
163
                            $('#{$this->id} .modal-body').html(data);
164
                        });
165
                    }");
166
                }
167
            } else {
168
                if ($this->usePost) {
169
                    $this->clientEvents['show.bs.modal'] = new JsExpression("function() {
@@ 167-181 (lines=15) @@
164
                        });
165
                    }");
166
                }
167
            } else {
168
                if ($this->usePost) {
169
                    $this->clientEvents['show.bs.modal'] = new JsExpression("function() {
170
                        $.post('{$this->actionUrl}').done(function (data) {
171
                            $('#{$this->id} .modal-body').html(data);
172
                        });
173
                    }");
174
                } else {
175
                    $this->clientEvents['show.bs.modal'] = new JsExpression("function() {
176
                        $.get('{$this->actionUrl}').done(function (data) {
177
                            $('#{$this->id} .modal-body').html(data);
178
                        });
179
                    }");
180
                }
181
            }
182
        }
183
        if (!isset($this->clientEvents['hidden.bs.modal'])) {
184
            $this->clientEvents['hidden.bs.modal'] = new JsExpression("function() {