Close_Button   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A about() 0 4 1
A init() 0 4 1
A get_css() 0 2 1
A hook_article_button() 0 8 2
A api_version() 0 2 1
1
<?php
2
class Close_Button extends Plugin {
3
    private $host;
4
5
    public function init($host) {
6
        $this->host = $host;
7
8
        $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
9
    }
10
11
    public function about() {
12
        return array(1.0,
13
            "Adds a button to close article panel",
14
            "fox");
15
    }
16
17
    public function get_css() {
18
        return "i.icon-close-article { color : red; }";
19
    }
20
21
    /**
22
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
23
     */
24
    public function hook_article_button($line) {
0 ignored issues
show
Unused Code introduced by
The parameter $line is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public function hook_article_button(/** @scrutinizer ignore-unused */ $line) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
        if (!get_pref("COMBINED_DISPLAY_MODE")) {
26
            $rv = "<i class='material-icons icon-close-article'
27
				style='cursor : pointer' onclick='Article.close()'
28
				title='".__('Close article')."'>close</i>";
29
        }
30
31
        return $rv;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $rv does not seem to be defined for all execution paths leading up to this point.
Loading history...
32
    }
33
34
    public function api_version() {
35
        return 2;
36
    }
37
38
}
39