Install_Helper_IntranetMaintenance::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
class Install_Helper_IntranetMaintenance {
4
    
5
    private $kernel;
6
    private $db;
7
    
8
    public function __construct($kernel, $db) 
9
    {
10
        $this->kernel = $kernel;
11
        $this->db = $db;
12
    }
13
    
14
    
15
    
16
    public function createAlternativeIntranet() 
17
    {
18
        
19
        require_once 'Intraface/modules/intranetmaintenance/IntranetMaintenance.php';
20
        $intranet = new IntranetMaintenance();
21
        $intranet->save(array('name' => 'Test', 'identifier' => 'test'), 1);
0 ignored issues
show
Unused Code introduced by
The call to IntranetMaintenance::save() has too many arguments starting with 1.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
22
        $intranet->setModuleAccess('administration', 2);
0 ignored issues
show
Unused Code introduced by
The call to IntranetMaintenance::setModuleAccess() has too many arguments starting with 2.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
23
        $intranet->setModuleAccess('modulepackage', 2);
0 ignored issues
show
Unused Code introduced by
The call to IntranetMaintenance::setModuleAccess() has too many arguments starting with 2.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
24
        
25
        require_once 'Intraface/modules/intranetmaintenance/UserMaintenance.php';
26
        $user = new UserMaintenance(1);
27
        $user->setIntranetAccess(2);
28
        $user->setModuleAccess('administration', 2);
29
        $user->setModuleAccess('modulePackage', 2);
30
        
31
    }
32
}
33
34
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
35