Completed
Branch 2.0.1 (3659a8)
by Serhii
03:59
created

OS   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 35
rs 10
wmc 7
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
C __construct() 0 24 7
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(\SimpleXMLElement $xmlData)
23
    {
24
        parent::__construct($xmlData);
25
        if($xmlData !== null)
26
        {
27
            foreach ($xmlData->children() as $child) {
28
                switch ($child->getName()) {
29
                    case 'family':
30
                        switch ($child->__toString()) {
31
                            case 'UNX':
32
                                $this->Family = UNX;
33
                                break;
34
                            case 'MAC':
35
                                $this->Family = MAC;
36
                                break;
37
                            case 'WIN':
38
                                $this->Family = WIN;
39
                                break;
40
                        }
41
                        break;
42
                }
43
            }
44
        }
45
    }
46
47
}
48
49
define('UNX','unix');
50
define('WIN','windows');
51
define('MC','mac');
52