Passed
Branch master (8fa86f)
by Alexander
04:20
created

XmlConvertibleObject   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getXmlProperties() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: horat1us
5
 * Date: 5/2/17
6
 * Time: 1:55 PM
7
 */
8
9
namespace Horat1us;
10
11
12
/**
13
 * Class XmlConvertibleObject
14
 * @package Horat1us
15
 */
16
class XmlConvertibleObject implements XmlConvertibleInterface
17
{
18
    use XmlConvertible {
19
        getXmlProperties as protected traitXmlProperties;
20
    }
21
22
    /**
23
     * XmlConvertibleObject constructor.
24
     * @param string $xmlElementName
25
     * @param array $xmlChildren
26
     */
27 5
    public function __construct(string $xmlElementName = null, array $xmlChildren = null)
28
    {
29 5
        $this->xmlElementName = $xmlElementName;
30 5
        $this->xmlChildren = $xmlChildren;
31 5
    }
32
33
    /**
34
     * @return array
35
     */
36 5
    public function getXmlProperties(): array
37
    {
38 5
        return $this->traitXmlProperties(array_keys(get_object_vars($this)));
39
    }
40
}