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

Data::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
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 Data
14
{
15
    /**
16
     * @return string
17
     */
18
    public function getName()
19
    {
20
        return $this->Name;
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    public function getType()
27
    {
28
        return $this->Type;
29
    }
30
31
    /**
32
     * @param string $Name
33
     */
34
    public function setName($Name)
35
    {
36
        $this->Name = $Name;
37
    }
38
39
    /**
40
     * @param string $Type
41
     */
42
    public function setType($Type)
43
    {
44
        $this->Type = $Type;
45
    }
46
    /**
47
     * @var string Name
48
     */
49
    protected $Name = 'N\A';
50
    /** @var string Type */
51
    protected $Type = 'N\A';
52
53
    /**
54
     * Data constructor.
55
     * @param \SimpleXMLElement $xmlData Xml data from file
56
     */
57 View Code Duplication
    public function __construct(\SimpleXMLElement $xmlData)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58
    {
59
        if($xmlData !== null)
60
        {
61
            foreach ($xmlData->children() as $child) {
62
                switch ($child->getName()) {
63
                    case 'name':
64
                        $this->Name = $child->__toString();
65
                        break;
66
                    case 'type':
67
                        $this->Type = $child->__toString();
68
                        break;
69
                }
70
            }
71
        }
72
    }
73
}
74