Completed
Push — svgpagetools ( 17ef2a...7c844e )
by Andreas
04:40
created

Back   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 2
1
<?php
2
3
namespace dokuwiki\Menu\Item;
4
5
class Back extends AbstractItem {
6
7
    /** @inheritdoc */
8
    public function __construct() {
9
        global $ID;
10
        parent::__construct();
11
12
        $parent = tpl_getparent($ID);
13
        if(!$parent) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $parent of type false|string is loosely compared to false; this is ambiguous if the string can be empty. You might want to explicitly use === false instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
14
            throw new \RuntimeException("No parent for back action");
15
        }
16
17
        $this->id = $parent;
18
        $this->params = array('do' => '');
19
        $this->accesskey = 'b';
20
    }
21
22
}
23