Completed
Push — v2.0 ( c502f2...cf0b32 )
by Serhii
02:20
created

OS   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 35
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 24 6
1
<?php
2
/**
3
 * @author Sergey Nehaenko <[email protected]>
4
 * @license GPL
5
 * @copyright Sergey Nehaenko &copy 2016
6
 * @version 2.0
7
 * @project browser-detector
8
 */
9
10
namespace EndorphinStudio\Detector;
11
12
13
class OS extends DataWithVersion
14
{
15
    /** @var string $Family */
16
    public $Family;
17
18
    /**
19
     * OS constructor.
20
     * @param \SimpleXMLElement $xmlData Xml data from file
21
     */
22
    public function __construct($xmlData)
23
    {
24
        parent::__construct($xmlData);
25
        foreach($xmlData->children() as $child)
26
        {
27
            switch($child->getName())
28
            {
29
                case 'family':
30
                    switch($child->__toString())
31
                    {
32
                        case 'UNX':
33
                            $this->Family = UNX;
34
                            break;
35
                        case 'MAC':
36
                            $this->Family = MAC;
37
                            break;
38
                        case 'WIN':
39
                            $this->Family = WIN;
40
                            break;
41
                    }
42
                    break;
43
            }
44
        }
45
    }
46
47
}
48
49
define('UNX','unix');
50
define('WIN','windows');
51
define('MAC','mac');