Completed
Push — master ( 4c7da2...64af60 )
by Alex
02:34 queued 46s
created

PublicId::createElement()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php declare(strict_types=1);
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
     */
21 6
    public function setProperty(NodeInterface $node, \DOMElement $element) : void
22
    {
23 6
        $node->setPublicId($element->nodeValue);
24 6
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29 3
    protected function hasValue(NodeInterface $node) : bool
30
    {
31 3
        return !! $node->getPublicId();
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37 3
    protected function addElement(\DomDocument $document, \DOMElement $rootElement, NodeInterface $node) : void
38
    {
39 3
        $rootElement->appendChild($document->createElement($this->getNodeName(), $node->getPublicId()));
40 3
    }
41
}
42