Completed
Push — issue/87 ( bbd942 )
by Alex
04:44
created

PublicId   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 28
loc 28
ccs 3
cts 5
cp 0.6
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setProperty() 6 6 1
A createElement() 4 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
 * Created by PhpStorm.
4
 * User: alex
5
 * Date: 22/11/14
6
 * Time: 11:24
7
 */
8
namespace FeedIo\Rule;
9
10
use FeedIo\Feed\NodeInterface;
11
use FeedIo\RuleAbstract;
12
13 View Code Duplication
class PublicId extends RuleAbstract
0 ignored issues
show
Duplication introduced by
This class 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...
14
{
15
    const NODE_NAME = 'guid';
16
17
    /**
18
     * @param  NodeInterface $node
19
     * @param  \DOMElement   $element
20
     * @return mixed
21
     */
22 4
    public function setProperty(NodeInterface $node, \DOMElement $element)
23
    {
24 4
        $node->setPublicId($element->nodeValue);
25
26 4
        return $node;
27
    }
28
29
    /**
30
     * creates the accurate DomElement content according to the $item's property
31
     *
32
     * @param  \DomDocument  $document
33
     * @param  NodeInterface $node
34
     * @return \DomElement
35
     */
36
    public function createElement(\DomDocument $document, NodeInterface $node)
37
    {
38
        return $document->createElement($this->getNodeName(), $node->getPublicId());
39
    }
40
}
41