Completed
Push — master ( 9b78f7...5dcb4f )
by Andreas
08:15 queued 03:39
created

Back::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 0
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace dokuwiki\Menu\Item;
4
5
/**
6
 * Class Back
7
 *
8
 * @fixme where is this used?
9
 * @fixme missing SVG
10
 */
11
class Back extends AbstractItem {
12
13
    /** @inheritdoc */
14
    public function __construct() {
15
        global $ID;
16
        parent::__construct();
17
18
        $parent = tpl_getparent($ID);
19
        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...
20
            throw new \RuntimeException("No parent for back action");
21
        }
22
23
        $this->id = $parent;
24
        $this->params = array('do' => '');
25
        $this->accesskey = 'b';
26
    }
27
28
}
29