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

PublicId::setProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 6
loc 6
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
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