Test Failed
Push — master ( 9055ab...067459 )
by Stefan
07:43
created

ServerSideCredential::getAll()   A

Complexity

Conditions 5
Paths 4

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 8
nc 4
nop 0
dl 0
loc 11
rs 9.6111
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * *****************************************************************************
5
 * Contributions to this work were made on behalf of the GÉANT project, a 
6
 * project that has received funding from the European Union’s Framework 
7
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
8
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
9
 * 691567 (GN4-1) and No. 731122 (GN4-2).
10
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
11
 * of the copyright in all material which was developed by a member of the GÉANT
12
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
13
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
14
 * UK as a branch of GÉANT Vereniging.
15
 * 
16
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
17
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
18
 *
19
 * License: see the web/copyright.inc.php file in the file structure or
20
 *          <base_url>/copyright.php after deploying the software
21
 */
22
23
/**
24
 * This file contains class definitions and procedures for 
25
 * generation of a generic XML description of a 802.1x configurator
26
 *
27
 * @author Maja Górecka-Wolniewicz <[email protected]>
28
 *
29
 * @package ModuleWriting
30
 */
31
32
namespace devices\xml;
33
34
class ServerSideCredential extends XMLElement {
35
36
    /**
37
     * the CA element (multuiple occurences allowed)
38
     * 
39
     * @var XMLElement
40
     */
41
    protected $CA;
42
43
    /**
44
     * the ServerID element (multiple occurences allowed)
45
     * 
46
     * @var XMLElement
47
     */
48
    protected $ServerID;
49
50
    /**
51
     * the EAPType element
52
     * 
53
     * @var XMLElement
54
     */
55
    protected $EAPType;
56
57
    /**
58
     * 
59
     * @return array
60
     */
61
    public function getAll() {
62
        if (isset(XMLElement::AUTHMETHODELEMENTS['server'][$this->EAPType]) && XMLElement::AUTHMETHODELEMENTS['server'][$this->EAPType]) {
63
            $element = XMLElement::AUTHMETHODELEMENTS['server'][$this->EAPType];
64
            $objectVariables = get_object_vars($this);
65
            $outArray = [];
66
            foreach ($objectVariables as $o => $v) {
67
                if (in_array($o, $element)) {
68
                    $outArray[$o] = $v;
69
                }
70
            }
71
            return $outArray;
72
        }
73
    }
74
75
}
76