public/assets/debug_bar/widgets/mails/widget.js   A
last analyzed

Complexity

Total Complexity 7
Complexity/F 1.4

Size

Lines of Code 40
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
c 0
b 0
f 0
dl 0
loc 40
rs 10
cc 0
nc 1
mnd 2
bc 8
fnc 5
bpm 1.6
cpm 1.4
noi 4

1 Function

Rating   Name   Duplication   Size   Complexity  
A PhpDebugBar.Widget.extend.render 0 22 1
1
(function($) {
2
3
    var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
0 ignored issues
show
Bug introduced by
The variable PhpDebugBar seems to be never declared. If this is a global, consider adding a /** global: PhpDebugBar */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
4
5
    /**
6
     * Widget for the displaying mails data
7
     *
8
     * Options:
9
     *  - data
10
     */
11
    var MailsWidget = PhpDebugBar.Widgets.MailsWidget = PhpDebugBar.Widget.extend({
0 ignored issues
show
Unused Code introduced by
The assignment to variable MailsWidget seems to be never used. Consider removing it.
Loading history...
12
13
        className: csscls('mails'),
14
15
        render: function() {
16
            this.$list = new  PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, mail) {
0 ignored issues
show
Bug introduced by
The variable PhpDebugBar seems to be never declared. If this is a global, consider adding a /** global: PhpDebugBar */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
17
                $('<span />').addClass(csscls('subject')).text(mail.subject).appendTo(li);
18
                $('<span />').addClass(csscls('to')).text(mail.to).appendTo(li);
19
                if (mail.headers) {
20
                    var headers = $('<pre />').addClass(csscls('headers')).appendTo(li);
21
                    $('<code />').text(mail.headers).appendTo(headers);
22
                    li.click(function() {
23
                        if (headers.is(':visible')) {
24
                            headers.hide();
25
                        } else {
26
                            headers.show();
27
                        }
28
                    });
29
                }
30
            }});
31
            this.$list.$el.appendTo(this.$el);
32
33
            this.bindAttr('data', function(data) {
34
                this.$list.set('data', data);
35
            });
36
        }
37
38
    });
39
40
})(PhpDebugBar.$);
0 ignored issues
show
Bug introduced by
The variable PhpDebugBar seems to be never declared. If this is a global, consider adding a /** global: PhpDebugBar */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
41