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(e) {
154
                        if (e.namespace !== 'bs.modal') return true;
155
                        var selection = jQuery('div[role=\"grid\"]').yiiGridView('getSelectedRows');
156
                        $.post('{$this->actionUrl}', {selection: selection}).done(function (data) {
157
                            $('#{$this->id} .modal-body').html(data);
158
                        });
159
                    }");
160
                } else {
161
                    $this->clientEvents['show.bs.modal'] = new JsExpression("function(e) {
162
                        if (e.namespace !== 'bs.modal') return true;
163
                        var selection = jQuery('div[role=\"grid\"]').yiiGridView('getSelectedRows');
164
                        $.get('{$this->actionUrl}', {selection: selection}).done(function (data) {
165
                            $('#{$this->id} .modal-body').html(data);
166
                        });
167
                    }");
168
                }
169
            } else {
@@ 169-183 (lines=15) @@
166
                        });
167
                    }");
168
                }
169
            } else {
170
                if ($this->usePost) {
171
                    $this->clientEvents['show.bs.modal'] = new JsExpression("function(e) {
172
                        if (e.namespace !== 'bs.modal') return true;
173
                        $.post('{$this->actionUrl}').done(function (data) {
174
                            $('#{$this->id} .modal-body').html(data);
175
                        });
176
                    }");
177
                } else {
178
                    $this->clientEvents['show.bs.modal'] = new JsExpression("function(e) {
179
                        if (e.namespace !== 'bs.modal') return true;
180
                        $.get('{$this->actionUrl}').done(function (data) {
181
                            $('#{$this->id} .modal-body').html(data);
182
                        });
183
                    }");
184
                }
185
            }
186
        }