Completed
Pull Request — master (#8)
by
unknown
02:25
created

XmlFormat   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 13.79 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 8
loc 58
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 8 8 1
A getXpath() 0 4 1
A getRowNodeName() 0 4 1
A getRootNodeName() 0 4 1
A getEncoding() 0 4 1
A getVersion() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Mathielen\ImportEngine\Storage\Format;
4
5
class XmlFormat extends Format
6
{
7
    private $xpath;
8
9
    protected $name = 'XML File';
10
    protected $id = 'xml';
11
12 2
    protected $rowNodeName;
13
    protected $rootNodeName;
14 2
    protected $encoding;
15 2
    protected $version;
16
17 1 View Code Duplication
    public function __construct($xpath = null, $rowNodeName='node', $rootNodeName = 'root', $encoding = null, $version = '1.0')
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...
18
    {
19 1
        $this->xpath = $xpath;
20
        $this->rowNodeName = $rowNodeName;
21
        $this->rootNodeName = $rootNodeName;
22
        $this->encoding = $encoding;
23
        $this->version = $version;
24
    }
25
26
    public function getXpath()
27
    {
28
        return $this->xpath;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getRowNodeName()
35
    {
36
        return $this->rowNodeName;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getRootNodeName()
43
    {
44
        return $this->rootNodeName;
45
    }
46
47
    /**
48
     * @return null
49
     */
50
    public function getEncoding()
51
    {
52
        return $this->encoding;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getVersion()
59
    {
60
        return $this->version;
61
    }
62
}
63