Completed
Push — issue/134 ( d0dc5e...07c20b )
by Alex
01:47
created

Link::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
 * 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
     * @return mixed
24
     */
25 4
    public function setProperty(NodeInterface $node, \DOMElement $element)
26
    {
27 4
        $node->setLink($element->nodeValue);
28
29 4
        return $this;
30
    }
31
32
    /**
33
     * creates the accurate DomElement content according to the $item's property
34
     *
35
     * @param  \DomDocument  $document
36
     * @param  NodeInterface $node
37
     * @return \DomElement
38
     */
39 2
    public function createElement(\DomDocument $document, NodeInterface $node)
40
    {
41 2
        return $document->createElement($this->getNodeName(), $node->getLink());
42
    }
43
}
44