Menu   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B show() 0 27 2
1
<?php
2
3
/**
4
 * User menu details
5
 *
6
 * PHP Version 5
7
 *
8
 * @category  Plugins
9
 * @package   Users
10
 * @author    Hans-Joachim Piepereit <[email protected]>
11
 * @copyright 2013 cSphere Team
12
 * @license   http://opensource.org/licenses/bsd-license Simplified BSD License
13
 * @link      http://www.csphere.eu
14
 **/
15
16
namespace csphere\plugins\users\classes;
17
18
/**
19
 * User menu details
20
 *
21
 * @category  Plugins
22
 * @package   Users
23
 * @author    Hans-Joachim Piepereit <[email protected]>
24
 * @copyright 2013 cSphere Team
25
 * @license   http://opensource.org/licenses/bsd-license Simplified BSD License
26
 * @link      http://www.csphere.eu
27
 **/
28
29
abstract class Menu
30
{
31
    /**
32
     * User menu if login was passed
33
     *
34
     * @param boolean $box    If view target area is a box
35
     * @param string  $layout Template layout to use
36
     *
37
     * @return void
38
     **/
0 ignored issues
show
Coding Style introduced by
There must be no blank lines after the function comment
Loading history...
39
40
    public static function show($box = false, $layout = '')
41
    {
42
        // Get view object
43
        $loader = \csphere\core\service\Locator::get();
44
        $view   = $loader->load('view');
45
46
        // Get user details from session
47
        $session = new \csphere\core\session\Session();
48
49
        // Set template content
50
        $data = ['user_name' => $session->get('user_name'),
51
                 'user_id'   => $session->get('user_id')];
52
53
        // Set template layout
54
        $tpl    = 'login' . $layout . '_menu';
55
56
        // Box mode needs a different tpl file
57
        if ($box == false) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
58
59
            $view->template('users', $tpl, $data);
60
61
        } else {
62
63
            $view->template('users', "side".$tpl, $data, true);
64
65
        }
66
    }
67
}
68