Completed
Push — master ( da6f26...74726b )
by Andrii
04:01
created

UserMenu::items()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 11
ccs 0
cts 11
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 2
1
<?php
2
3
namespace hipanel\menus;
4
5
class UserMenu extends \hiqdev\menumanager\Menu
6
{
7 View Code Duplication
    public function render($options = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
    {
9
        $defaultOptions = [
10
            'class' => 'UserMenu',
11
            'options' => ['class' => 'sidebar-menu'],
12
        ];
13
14
        return parent::render(array_merge($defaultOptions, $options));
15
    }
16
17
    public function items()
18
    {
19
        return [
20
            'header' => [
21
                'label' => $this->renderView('userMenuHeader'),
0 ignored issues
show
Documentation Bug introduced by
The method renderView does not exist on object<hipanel\menus\UserMenu>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
22
            ],
23
            'body' => [
24
                'label' => $this->renderView('userMenuBody'),
0 ignored issues
show
Documentation Bug introduced by
The method renderView does not exist on object<hipanel\menus\UserMenu>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
25
            ],
26
        ];
27
    }
28
}
29