Test Setup Failed
Push — master ( de37f4...b19653 )
by Tomasz
05:59
created

MsLanProfile::setEapConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/* 
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace devices\ms;
10
11
class MsLanProfile
12
{
13
    private $eapConfig;
14
15
    const MS_ONEX_NS = 'http://www.microsoft.com/networking/OneX/v1';
16
17
    /*
18
     * prepare data for the <EapConfig> element. The contents of this element
19
     * depends on the implementation of a particular EAP method and thus is
20
     * delivered by an EAP-specific class.
21
     */
22
    public function setEapConfig($eapConfig)
23
    {
24
        $this->eapConfig = $eapConfig;
25
    }
26
    
27
    public function writeLANprofile()
28
    {
29
        $rootname = 'LANProfile';        
30
        $dom = new \DOMDocument('1.0', 'utf-8');
31
        $root = $dom->createElement($rootname);
32
        $dom->appendChild($root);
33
        $ns = $dom->createAttributeNS( null, 'xmlns' );
34
        $ns->value = "hhttp://www.microsoft.com/networking/LAN/profile/v1";
35
        $root->appendChild($ns);        
36
        \core\DeviceXMLmain::marshalObject($dom, $root, 'WLANprofile', $this->getLANprofile(), '', true);
0 ignored issues
show
Unused Code introduced by
The call to core\DeviceXMLmain::marshalObject() has too many arguments starting with true. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        \core\DeviceXMLmain::/** @scrutinizer ignore-call */ 
37
                             marshalObject($dom, $root, 'WLANprofile', $this->getLANprofile(), '', true);

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. Please note the @ignore annotation hint above.

Loading history...
37
        $dom->formatOutput = true;
38
        $xml = $dom->saveXML();
39
        return($xml);
40
    }
41
  
42
    private function getLANprofile()
43
    {
44
        $element = new \core\DeviceXMLmain();
45
        $element->setChild('MSM', $this->getMSM());
46
        return($element);
47
    }
48
    
49
    private function getMSM()
50
    {
51
        $element = new \core\DeviceXMLmain();
52
        $element->setChild('security', $this->getSecurity());
53
        return($element);
54
    }
55
    
56
    private function getSecurity()
57
    {
58
        $element = new \core\DeviceXMLmain();
59
        $oneX = new \devices\ms\MsOneX();
60
        $element->setChild('OneXEnforced', 'false');
61
        $element->setChild('OneXEnabled', 'true');
62
        $element->setChild('OneX', $oneX->getOneX($this->eapConfig), self::MS_ONEX_NS);
63
        return($element);
64
    }
65
    
66
67
}