@@ 16-43 (lines=28) @@ | ||
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 | * @return mixed |
|
24 | */ |
|
25 | public function setProperty(NodeInterface $node, \DOMElement $element) |
|
26 | { |
|
27 | $node->setLink($element->nodeValue); |
|
28 | ||
29 | 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 | public function createElement(\DomDocument $document, NodeInterface $node) |
|
40 | { |
|
41 | return $document->createElement($this->getNodeName(), $node->getLink()); |
|
42 | } |
|
43 | } |
|
44 |
@@ 13-40 (lines=28) @@ | ||
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 | * @return mixed |
|
21 | */ |
|
22 | public function setProperty(NodeInterface $node, \DOMElement $element) |
|
23 | { |
|
24 | $node->setPublicId($element->nodeValue); |
|
25 | ||
26 | 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 |