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

Link::addElement()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 4
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of the feed-io package.
4
 *
5
 * (c) Alexandre Debril <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace FeedIo\Rule;
12
13
use FeedIo\Feed\NodeInterface;
14
use FeedIo\RuleAbstract;
15
16 View Code Duplication
class Link 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...
17
{
18
    const NODE_NAME = 'link';
19
20
    /**
21
     * @param  NodeInterface $node
22
     * @param  \DOMElement   $element
23
     */
24 4
    public function setProperty(NodeInterface $node, \DOMElement $element) : void
25
    {
26 4
        $node->setLink($element->nodeValue);
27 4
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32 5
    protected function hasValue(NodeInterface $node) : bool
33
    {
34 5
        return !! $node->getLink();
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40 2
    protected function addElement(\DomDocument $document, \DOMElement $rootElement, NodeInterface $node) : void
41
    {
42 2
        $rootElement->appendChild($document->createElement($this->getNodeName(), $node->getLink()));
43 2
    }
44
}
45