Code Duplication    Length = 29-29 lines in 2 locations

src/FeedIo/Rule/Link.php 1 location

@@ 16-44 (lines=29) @@
13
use FeedIo\Feed\NodeInterface;
14
use FeedIo\RuleAbstract;
15
16
class Link extends RuleAbstract
17
{
18
    const NODE_NAME = 'link';
19
20
    /**
21
     * @param  NodeInterface $node
22
     * @param  \DOMElement   $element
23
     */
24
    public function setProperty(NodeInterface $node, \DOMElement $element) : void
25
    {
26
        $node->setLink($element->nodeValue);
27
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32
    protected function hasValue(NodeInterface $node) : bool
33
    {
34
        return !! $node->getLink();
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40
    protected function addElement(\DomDocument $document, \DOMElement $rootElement, NodeInterface $node) : void
41
    {
42
        $rootElement->appendChild($document->createElement($this->getNodeName(), $node->getLink()));
43
    }
44
}
45

src/FeedIo/Rule/PublicId.php 1 location

@@ 13-41 (lines=29) @@
10
use FeedIo\Feed\NodeInterface;
11
use FeedIo\RuleAbstract;
12
13
class PublicId extends RuleAbstract
14
{
15
    const NODE_NAME = 'guid';
16
17
    /**
18
     * @param  NodeInterface $node
19
     * @param  \DOMElement   $element
20
     */
21
    public function setProperty(NodeInterface $node, \DOMElement $element) : void
22
    {
23
        $node->setPublicId($element->nodeValue);
24
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29
    protected function hasValue(NodeInterface $node) : bool
30
    {
31
        return !! $node->getPublicId();
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37
    protected function addElement(\DomDocument $document, \DOMElement $rootElement, NodeInterface $node) : void
38
    {
39
        $rootElement->appendChild($document->createElement($this->getNodeName(), $node->getPublicId()));
40
    }
41
}
42